Building OpenSG 2.x on Mac OS X 10.4 Tiger
- Install Xcode. Xcode is available on the MacOS X Install DVD, or for free download from the Apple web site.
- To be able to load textures from JPEG-, PNG- and TIFF-Files, you have to install the respective libraries (libjpeg from http://www.ijg.org/, libpng from http://www.libpng.org/ and libtiff from http://www.libtiff.org/). I strongly recommend installing these libraries using the Fink package manager. Fink is available for free download from http://fink.sf.net/. You have to download different versions of Fink depending on the MacOS X version you are using, so make sure that you get the right one. Follow the instructions on the Fink download page to install the package manager. After installing the Fink package manager, you have to install the packages for the libraries. I recommend using the “Fink Commander” GUI application included in the Fink disk image. Install the following packages: “libjpeg”, “libpng3” and “libtiff”. There are packages with similar names, make sure that you fetch the right ones! You have the choice between installing binary (precompiled) versions and versions from source – both are working, but I recommend installing the binary versions, because it takes less time.
- Start the “Terminal” application. It is located in “/Applications/Utilities/”. The OpenSG build system is based on Unix tools, so you have to work on the command line. Whenever this document tells you to enter a command, do it in the Terminal window!
- Install “boost”. Boost is available from http://www.boost.org/. You will need at least version 1.33.
When you have an Intel Mac, the simplest way to get boost is to install the package from Fink – the name of the package is “boost1.33”. Unfortunately, the package is broken – you have to adjust a symbolic link:
cd /sw/lib ln -s libboost_filesystem-1_33_1.dylib libboost_filesystem.dylib
When you have a PowerPC Mac, there is no fink package available. Instead, you have to compile boost yourself. First of all you have to install the boost build system “boost-jam”. You can get the source code from the boost web page and compile boost-jam yourself, but I recommend to use the package from Fink – the name of the package is “boost-jam”.
After installing the build system, download the boost source code. You can either download the source as a tar file (boost_1_33_1.tar.gz) or as a zip file (boost_1_33_1.zip). Enter one of the following commands to unzip the files, depending on whether you took the tar or the zip file:
tar -xzf boost_1_33_1.tar.gz unzip boost_1_33_1.zipChange into the boost directory, build and install boost. By default, boost gets installed under “/usr/local/include/” and “/usr/local/lib/”. When these places are ok for you, enter the follwing commands:
cd boost_1_33_1 bjam installWhen you prefer not to install software into system directories, you can also tell the build system to install boost into your home directory (into “~/include” and “~/lib”):
cd boost_1_33_1 bjam --prefix=$HOME install
- Install a Subversion client that is able to communicate via SSL. You can download such a client from http://subversion.tigris.org/, but again I recommend to use Fink – the name of the package is “svn-client-ssl”.
- Install “scons”. scons is available from Fink, but unfortunately only version 0.96.1. OpenSG needs at least version 0.96.92. For this reason you have to download scons from http://www.scons.org/. Go to the download page. In the first section you will find a link to the pre-release 0.96.93. Download scons either as a tar file (scons-0.96.93.tar.gz) or as a zip file (scons-0.96.93.zip). Enter one of the following commands to unzip the files, depending on whether you took the tar or the zip file:
tar -xzf scons-0.96.93.tar.gz unzip scons-0.96.93.zip
Change into the directory “scons-0.96.93” to install scons. By default, scons gets installed into “/usr/bin/” and “/usr/lib/scons/”. When these places are ok for you, enter the follwing commands:cd scons-0.96.93 python setup.py install
When you prefer not to install software into system directories, you can also tell the installer to install scons into your home directory (into “~/bin” and “~/lib/scons”):cd scons-0.96.93 python setup.py install --prefix=$HOME
In this case, you have to add “~bin” to your PATH environment variable:export PATH=$PATH:~/bin
- Download OpenSG from the Subversion server. When downloading OpenSG for the first time, you have to enter the following command (it creates a new directory called “OpenSG2” in the current directory and downloads the OpenSG source code into that directory):
svn co https://opensg.vrsource.org/svn/trunk OpenSG2
When doing this for the first time, SVN will complain about the server certificate. This is ok, simply accept it permanently. When you need to update your local version of OpenSG with the current version from the Subversion server later on, you simply go into the OpenSG root directory and enter the following command:svn update
- Change into the OpenSG root directory and start the build process. When you do that for the first time, you have to tell scons about where to find the jpeg, png, tiff and boost library as well as the architecture to compile for and whether you want to compile an optimized or debug version of OpenSG.
When you have an Intel Mac, enter the following commands:
cd OpenSG2 scons jpeg=/sw png=/sw tiff=/sw BoostBaseDir=/sw var_type=optimized var_arch=ia32 darwin_universal=False
Of course, when you did not install the jpeg, png, tiff and boost library from Fink, you have to adjust the pathes accordingly.
When you have a PowerPC Mac, enter the following commands to create an optimized version of OpenSG:
cd OpenSG2 scons jpeg=/sw png=/sw tiff=/sw BoostBaseDir=$HOME BoostIncludeDir=$HOME/include/boost-1_33_1 var_type=optimized var_arch=ppc darwin_universal=FalseAgain, you may have to adjust the pathes when you did not follow the recommendations in this document.
After compiling, you will find the OpenSG libraries, headers and binaries under “OpenSG2/build.darwin/instlinks”. When you need to compile OpenSG again, simply call scons without the arguments – scons keeps the settings from the first call.
