Bitcoin v0.3.10 · 2010-08-15
build-osx.txt
1Copyright (c) 2009-2010 Satoshi Nakamoto2Distributed under the MIT/X11 software license, see the accompanying3file license.txt or http://www.opensource.org/licenses/mit-license.php.4This product includes software developed by the OpenSSL Project for use in5the OpenSSL Toolkit (http://www.openssl.org/). This product includes6cryptographic software written by Eric Young (eay@cryptsoft.com).789Mac OS X build instructions10Laszlo Hanyecz (solar@heliacal.net)111213Tested on 10.5 and 10.6 intel. PPC is not supported because it's big-endian.1415All of the commands should be executed in Terminal.app.. it's in16/Applications/Utilities1718You need to install XCode with all the options checked so that the compiler19and everything is available in /usr not just /Developer20I think it comes on the DVD but you can get the current version from21http://developer.apple.com2223241. Pick a directory to work inside.. something like ~/bitcoin works. The25structure I use looks like this:26(~ is your home directory)2728~/bitcoin29~/bitcoin/trunk # source code30~/bitcoin/deps # dependencies.. like libraries and headers needed to compile31~/bitcoin/Bitcoin.app # the application bundle where you can run the app3233Just execute: mkdir ~/bitcoin34This will create the top dir for you..3536WARNING: do not use the ~ notation with the configure scripts.. use the full37name of the directory, for example /Users/james/bitcoin/deps for a user named38'james'. In my examples I am using 'macosuser' so make sure you change that.39402. Check out the trunk version of the bitcoin code from subversion:4142cd ~/bitcoin43svn checkout https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk4445This will make ~/bitcoin/trunk for you with all the files from subversion. 46473. Get and build the dependencies484950Boost51-----5253Download from http://www.boost.org/users/download/54I'm assuming it ended up in ~/Downloads..5556mkdir ~/bitcoin/deps57cd ~/bitcoin/deps58tar xvjf ~/Downloads/boost_1_42_0.tar.bz259cd boost_1_42_060./bootstrap.sh61./bjam architecture=combined address-model=32_64 macosx-version=10.6 macosx-version-min=10.5 link=static runtime-link=static --toolset=darwin --prefix=/Users/macosuser/bitcoin/deps install6263This part takes a while.. use your judgement and fix it if something doesn't64build for some reason.6566Change the prefix to whatever your directory is (my username in this example67is macosuser). I'm also running on 10.6 so i have macosx-version=10.6 change68to 10.5 if you're using leopard.6970This is what my output looked like at the end:71...failed updating 2 targets...72...skipped 144 targets...73...updated 8074 targets...747576OpenSSL77-------7879Download from http://www.openssl.org/source/8081We would like to build this as a 32 bit/64 bit library so we actually build it822 times and join it together here.. If you downloaded with safari it already83uncompressed it so it will just be a tar not a tar.gz8485cd ~/bitcoin/deps86tar xvf ~/Downloads/openssl-1.0.0.tar87mv openssl-1.0.0 openssl-1.0.0-i38688tar xvf ~/Downloads/openssl-1.0.0.tar89mv openssl-1.0.0 openssl-1.0.0-x86_6490# build i386 (32 bit intel) binary91cd openssl-1.0.0-i38692./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin-i386-cc && make93make install # only do this on one of the architectures, to install the headers94cd ..95# build x86_64 (64 bit intel) binary96cd openssl-1.0.0-x86_6497./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin64-x86_64-cc && make98cd ..99100# combine the libs101cd ~/bitcoin/deps102lipo -arch i386 openssl-1.0.0-i386/libcrypto.a -arch x86_64 openssl-1.0.0-x86_64/libcrypto.a -o lib/libcrypto.a -create103lipo -arch i386 openssl-1.0.0-i386/libssl.a -arch x86_64 openssl-1.0.0-x86_64/libssl.a -o lib/libssl.a -create104105Verify your binaries106107file lib/libcrypto.a108109output should look like this:110111ib/libcrypto.a: Mach-O universal binary with 2 architectures112lib/libcrypto.a (for architecture i386): current ar archive random library113lib/libcrypto.a (for architecture x86_64): current ar archive random library114115116Berkeley DB117-----------118119Download from http://freshmeat.net/projects/berkeleydb/120121cd ~/bitcoin/deps122tar xvf ~/Downloads/db-4.8.26.tar123cd db-4.8.26/build_unix124../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install125126127wxWidgets128---------129130This is the big one..131132Check it out from svn133134cd ~/bitcoin/deps135svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk136137This will make a wxWidgets-trunk directory in deps.138139Use this script snippet, change your prefix to whatever your dir is:140141PREFIX=~/bitcoin/deps142SRCDIR="$PREFIX/wxWidgets-trunk"143BUILDDIR="$SRCDIR/macbuild"144145cd "$PREFIX" &&146#svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk &&147cd "$SRCDIR" &&148149[ -f include/wx/hashmap.h.orig ] || cp include/wx/hashmap.h include/wx/hashmap.h.orig &&150sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashmap.h.orig > include/wx/hashmap.h &&151152[ -f include/wx/hashset.h.orig ] || cp include/wx/hashset.h include/wx/hashset.h.orig &&153sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashset.h.orig > include/wx/hashset.h &&154155156157rm -vrf "$BUILDDIR" &&158mkdir "$BUILDDIR" &&159cd "$BUILDDIR" &&160161../configure --prefix="$PREFIX" \162--with-osx_cocoa \163--disable-shared \164--disable-debug_flag \165--with-macosx-version-min=10.5 \166--enable-stl \167--enable-utf8 \168--enable-universal_binary \169--with-libjpeg=builtin \170--with-libpng=builtin \171--with-regex=builtin \172--with-libtiff=builtin \173--with-zlib=builtin \174--with-expat=builtin \175--with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk &&176177178find . -name Makefile | 179while read i; do 180 echo $i; 181 sed 's/-arch i386/-arch i386 -arch x86_64/g' < "$i" > "$i".new && 182 mv "$i" "$i".old && 183 mv "$i".new "$i"; 184done185186187188make && 189make install190191192193Now you should be able to build bitcoin194195cd ~/bitcoin/trunk196make -f makefile.osx bitcoin197198Before you can run it, you need to create an application bundle for Mac OS.199Create the directories in terminal using mkdir and copy the files into place.200They are available at http://heliacal.net/~solar/bitcoin/mac-build/201You need the Info.plist and the .ins file. The Contents/MacOS/bitcoin file is202the output of the build.203Your directory structure should look like this:204205Bitcoin.app206Bitcoin.app/Contents207Bitcoin.app/Contents/Info.plist208Bitcoin.app/Contents/MacOS209Bitcoin.app/Contents/MacOS/bitcoin210Bitcoin.app/Contents/Resources211Bitcoin.app/Contents/Resources/BitcoinAppIcon.icns212213To run it you can just click the Bitcoin.app in Finder, or just do open214~/bitcoin/Bitcoin.app215If you want to run it with arguments you can just run it without backgrounding216by specifying the full name in terminal:217~/bitcoin/Bitcoin.app/Contents/MacOS/bitcoin -addnode=192.75.207.66
Click a line number to link to it; use #L10-L20 for a range. "=" next to a version means the file is identical there.
