From BlenderWiki
[edit] Building 2.5 for OSX
Pre-requisite: OSX dev tools need to be installed (They are included in OSX DVDs, or can be downloaded from http://developer.apple.com)
[edit] First step : Download
The first step is to get the latest Blender source code from Blender.org's SVN repository. Copy and paste the following instructions into a terminal window. These will create a blender-svn folder off your home directory and download the latest trunk (main) source code. An internet connection is needed.
[edit] Blender source code
cd ~ mkdir blender-svn cd blender-svn svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/blender
If you want to update your svn checkout to the latest source (in ~/blender-svn/blender/ )...
svn update blender
or just simply svn up blender.
[edit] External libs
The external libs needed for building blender have been precompiled for ppc & intel 32bit 10.4 & 10.5, and intel 64bit 10.5.
Inside the same blender-svn folder, enter the following instructions depending on the type of build you want to make:
- PowerPC 32bit 10.4 and later
mkdir lib cd lib svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/darwin-8.0.0-powerpc
- Intel 32bit 10.4 and later
mkdir lib cd lib svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/darwin-8.x.i386
- PowerPC, Intel 32bit & 64bit 10.5 and later
mkdir lib cd lib svn checkout https://svn.blender.org/svnroot/bf-blender/trunk/lib/darwin-9.x.universal
[edit] Ranlib
Sometimes you might need to run ranlib from the command line on libraries that have not been updated, but are still in SVN. Ranlib builds an index of all the functions inside the library so the compiler can find them. If a library has not been indexed you will receive a message during link stating "could not read symbols: Archive has no index; run ranlib..." or something to that effect.
You can run ranlib from the command line for single libraries easily:
ranlib libfoo.a
If you need to run ranlib on multiple directories, however, this can be a hassle. The following Python script can be run from the command line and can recursively run ranlib on all libraries that need it within your chosen architecture. You will need to chmod +x this script in order to run it, or save it to a file and use the command line python interpreter. Don't forget to change the base directory so that it points to your chosen architecture.
#!/usr/bin/python
# runranlib.py
import os
base = './lib/darwin-8.x.i386/'
paths = os.listdir(base)
print ""
libsToMod = []
for p in paths:
# special case
if p == "python":
continue
if p[0] != '.':
try:
libs = os.listdir(base + p + "/lib/")
except:
continue
for l in libs:
if l[0] != '.':
libsToMod.append(p + "/lib/" + l)
libsToMod.append("python/lib/python3.1/libpython3.1.a")
for l in libsToMod:
print("Fixing: %s..." % l)
os.system('ranlib %s%s' % (base, l))
print("... done.\n")
[edit] Second step : build
You can perform the build using any of three following methods :
[edit] Scons
You need to copy blender/config/darwin-config.py up one directory (bf-blender/blender) and rename as user-config.py:
cd ~/blender-svn/blender cp config/darwin-config.py user-config.py
Then you change the flags at the very top to match your needs. Don't actually change darwin-config.py.
- MACOSX_ARCHITECTURE needs to be set to the correct architecture : ppc, i386 (Intel 32bit) or x86_64 (Intel 64bit)
After a first successful build, you can afterwards ("expert mode") tweak the other settings to make an optimized build.
Then launch the build:
python scons/scons.py -j 2
Change "2" to the actual number of CPU cores you have in your system to accelerate the build process.
If everything went fine, the resulting blender.app will reside here: blender-svn/build/darwin/bin/blender.app
[edit] CMake / Xcode
Download and install CMake utility from :
http://www.cmake.org/cmake/resources/software.html
The easiest way is to use the GUI application to configure the variables. You need to set:
- Generate for XCode
- Destination folder "Where to build the binaries" to "blender-svn/bf-blender"
- CMAKE_OSX_ARCHITECTURES to one of ppc, i386, x86_64
- CMAKE_OSX_DEPLOYMENT_TARGET to the OSX version you want to build for (10.4, 10.5, 10.6)
- CMAKE_OSX_SYSROOT to the OSX SDK of the OSX version you specified the line above, e.g. for 10.4: "/Developer/SDKs/MacOSX10.4u.sdk"
- WITH_LIBS10.5 set to ON if you want to build for 10.5, using the darwin-9.x.universal libs you downloaded
- USE_QTKIT must be set to ON if you want Quicktime with a 64bit build
Configure & Generate the project files
Then open XCode and load the project located in "blender-svn/bf_blender/blender.xcodeproj" And now build! Note: you need to set in the build preferences panel to use gcc 4.0 instead of gcc4.2 if you want to build for 10.4







