Porting Tribler to Mac OS/XThis page may be outdated. See MacBuildFromScratch This page contains the steps that were required to port Tribler to Mac OS/X. See also UniversalBinaryHowto for making an Universal Binary. See also VlcMacHowto for how to build VLC including Python bindings on Mac OS/X. PrerequisitesTo do this, you'll need:
Download some stuffFirst, pull the Tribler source from SVN, and chdir to it: /usr/local/bin/svn co http://svn.tribler.org/abc/tags/tribler-3.3.6 tribler-3.3.6 cd tribler-3.3.6 Tribler needs a modified M2Crypto library, which in turn requires OpenSSL. As the OpenSSL that ships with Mac OS/X is too old (0.9.7), we need to download a newer version at http://www.openssl.org/source/. Get at least version 0.9.8, and unpack it somewhere: wget http://www.openssl.org/source/openssl-0.9.8e.tar.gz tar xfz openssl-0.9.8e.tar.gz Next, pull the modified M2Crypto source from SVN: /usr/local/bin/svn co http://svn.tribler.org/m2crypto/branches/main m2crypto Alternatively, you can use the official M2Crypto release starting with 0.16. You'll need to edit setup.py such that it statically links OpenSSL's libssl.a and libcrypto.a. Compile OpenSSL and M2CryptoFirst, we compile OpenSSL: cd openssl ./config make cd .. For Intel Mac, it seems that the "shared" flag is needed if config fails. Next, we compile M2Crypto: cd m2crypto python setup.py build cd .. Newer versions of Python include bsddb. If not available, set it up: wget http://downloads.sleepycat.com/db-4.4.20.tar.gz tar xfz db-4.4.20.tar.gz mv db-4.4.20 db cd db/build_unix ../dist/configure make cd ../.. wget http://surfnet.dl.sourceforge.net/sourceforge/pybsddb/bsddb3-4.4.2.tar.gz tar xfz bsddb3-4.4.2.tar.gz mv bsddb3-4.4.2 bsddb3 cd bsddb3 python setup.py --berkeley-db-libdir=../db/build_unix/ --berkeley-db-incdir=../db/build_unix --berkeley-db=../db/build_unix/.libs/ build Run itYou can run Tribler by typing: LIBDIR=`ls m2crypto/build/ | grep "lib."` export PYTHONPATH=m2crypto/build/$LIBDIR/:bsddb3/build/$LIBDIR/ pythonw abc.py (You should have only one lib directory in m2crypto/build/). Create a setup scriptTo create an application bundle Tribler.app, I use the bundlebuilder extension to python. I prefer it over the more recent py2app as bundlebuilder allows me to ship libraries along *and* force them to be used before the ones installed on the user's system. Anyway, setuptriblermac.py contains the most recent setup script. Run the following command to build build/Tribler.app: python setuptriblermac.py build If all goes well, a disk image is available as Tribler.dmg. You, however, may need to edit setuptriblermac.py, e.g. if you've installed a newer version of wxPython than 2.6. Required patchesTribler needed patching on the following:
Issues
Tips and TricksLinking with the right libsWhen shipping an application on Mac OS/X, you must make sure you don't link to unshipped libraries which aren't part of a default Mac install. This can happen if you installed libraries system-wide, and subsequently link Tribler dynamically against those. Shipping the libraries doesn't help, since Mac OS/X (or gcc) includes absolute links to the installed libraries. There are two ways of detecting whether this is happening:
There are also two ways of fixing this problem:
|