Universal BinaryA universal binary is a Mac executable which contains native code for both PPC and i386 platforms. This page contains an incomplete guide on how Tribler was made Universal. It is incomplete because for some odd reason, I didn't have to recompile bsddb? PrerequisitesYou need:
Global picture
OpenSSLOpenSSL needs to be compiled twice: once for each platform. The following script can be used, following instructions http://developer.apple.com/opensource/buildingopensourceuniversal.html: #!/bin/bash mkdir -p build-ppc build-i386 # build PPC version make clean ./Configure darwin-ppc-cc make build_libs mv *.a build-ppc # build i386 version make clean ./Configure 386 darwin-i386-cc make build_libs "CC=cc -arch i386" mv *.a build-i386 # merge them for i in libssl.a libcrypto.a do lipo -create -output $i build-ppc/$i build-i386/$i ranlib $i done You can verify that the created libraries are indeed fat: $ file *.a libcrypto.a: Mach-O fat file with 2 architectures libcrypto.a (for architecture ppc): current ar archive libcrypto.a (for architecture i386): current ar archive random library libssl.a: Mach-O fat file with 2 architectures libssl.a (for architecture ppc): current ar archive libssl.a (for architecture i386): current ar archive random library M2CryptoM2Crypto should compile correctly. Make sure you use the universal version of Python: rm -rf build python2.4 setup.py build To verify the result: $ file build/lib.macosx-*-fat-*/M2Crypto/__m2crypto.so build/lib.macosx-10.3-fat-2.4/M2Crypto/__m2crypto.so: Mach-O fat file with 2 architectures build/lib.macosx-10.3-fat-2.4/M2Crypto/__m2crypto.so (for architecture i386): Mach-O bundle i386 build/lib.macosx-10.3-fat-2.4/M2Crypto/__m2crypto.so (for architecture ppc): Mach-O bundle ppc TriblerFinally we can build Tribler: python2.4 setuptriblermac.py build Verify the resulting application on both platforms to be sure :) |