Compiling for Mac OS X is generally the same as other platforms.

Dependencies (version I have used successfully in parens):

boost (1_34_1)

cmake (2.4.8)

fftw (2.1.5)

gsl (1.8)

hdf5 (1.6.6)

jpeg (v6b)

png (1.2.23)

numpy (1.0.4)

Qt/Mac (3.3.8)

szip (2.1)

tiff (3.8.2)

zlib (1.2.1)

====================

You have two routes available. You can install the above dependencies using a package manager such as fink or macports. This is the easier and faster option, but has the downside of making it more difficult to distribute your built package or moving it to a different machine. If you choose this option, please skip to the end.

The other option is to build all dependencies manually from source. This is the method I chose for the self-contained EMAN package. However, some of the packages required either patches or some careful massaging to compile properly. It will require a bit more effort than using the package manager.

====================

Preparing to compile:

I opted to place my build environment in a disk image to make it easier to move it from machine to machine. Use Disk Utility to create a sparse disk image with a max size of 50gb (it will shrink to the total size of the files contained.)

I called the disk image "EMAN" and used the following directory structure for organization.

attachment:dirstructure.jpg

"build" is for EMAN build files. "dep" is the dependency tree root. "extlib" is for modified dependency libraries. "EMAN" is for the EMAN source itself. "Resources" are support files to be used in the creation of Mac OS X app bundles. "src" is for downloaded source tarballs and patches. "stage" is where the EMAN package will be prepared for distribution. "vars10.x.sh" is for environment variables specific to building for each Mac OS X version.

Because 10.4 and 10.5 use different versions of Python, I decided to build EMAN and dep libraries separately for each deployment target.


/!\ Edit conflict - other version:


My build environment was 10.5 Leopard on Intel host using Xcode 3.0 for the 10.5 build and a parallel install of Xcode 2.5 in /Xcode2.5 for the 10.4 build. I have not personally built for 10.4 on a 10.4 host, but the instructions for 10.5 on a 10.5 host will probably work.

For simplicity's sake, I will only discuss building for 10.5 in these instructions.

Mac OS X supports multiple architectures in a single "universal" or "fat" binary/library. This is achieved by passing -arch flags to gcc (this is a special Apple-gcc flag) which will take care of all the details. Alternatively you can compile for different architectures separately and merge them together afterwards, but this did not need to be done with the current version of Apple's tools. For 10.5 I built both 32 and 64 bit versions for both Intel and PowerPC (i386, x86_64, ppc, ppc64.) On 10.4 I built only 32 bit versions for Intel and PowerPC.

The following environment variables were sufficient to get clean universal builds of dependencies in most cases. I put these in vars10.5.sh for quick access:

#10.5 export BROOT=/Volumes/EMAN/ export CPUCOUNT=8 export ARCH=i386 export MACOSX_DEPLOYMENT_TARGET=10.5 export PREFIX=$BROOT/dep/$MACOSX_DEPLOYMENT_TARGET export EXECPREFIX=$PREFIX/$ARCH export UARCH="-arch i386 -arch ppc -arch x86_64 -arch ppc64" export SROOT="-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" export LDF="-Wl,-headerpad_max_install_names" export CFLAGS="$SROOT $UARCH -O2 -g" export LDFLAGS="$UARCH $LDF" export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin


/!\ Edit conflict - your version:


My build environment was 10.5 Leopard on Intel host using Xcode 3.0 for the 10.5 build. I have not personally built for 10.4 on a 10.4 host, but the instructions for 10.5 will probably work. Building for 10.4 target on a 10.5 host is possible and requires Xcode 2.5 to be installed in parallel to Xcode 3.0.

For simplicity's sake, I will only discuss building for 10.5 in these instructions.

Mac OS X supports multiple architectures in a single "universal" or "fat" binary/library. This is achieved by passing -arch flags to gcc (this is a special Apple-gcc flag) which will take care of all the details. Alternatively you can compile for different architectures separately and merge them together afterwards, but this did not need to be done with the current version of Apple's tools. For 10.5 I built both 32 and 64 bit versions for both Intel and PowerPC (i386, x86_64, ppc, ppc64.) On 10.4 I built only 32 bit versions for Intel and PowerPC.

The following environment variables were sufficient to get clean universal builds of dependencies in most cases. I put these in vars10.5.sh for quick access:

#10.5 export BROOT=/Volumes/EMAN/ export CPUCOUNT=8 export ARCH=i386 export MACOSX_DEPLOYMENT_TARGET=10.5 export PREFIX=$BROOT/dep/$MACOSX_DEPLOYMENT_TARGET export EXECPREFIX=$PREFIX/$ARCH export UARCH="-arch i386 -arch ppc -arch x86_64 -arch ppc64" export SROOT="-isysroot /Developer/SDKs/MacOSX10.5.sdk -mmacosx-version-min=10.5" export LDF="-Wl,-headerpad_max_install_names" export CFLAGS="$SROOT $UARCH -O2 -g" export LDFLAGS="$UARCH $LDF" export PATH=/bin:/usr/bin:/usr/sbin:/sbin:/usr/local/bin


/!\ End of edit conflict