more addr message error checking
[VerusCoin.git] / build-osx.txt
CommitLineData
9c1e9f0b 1Mac OS X build instructions\r
2Laszlo Hanyecz (solar@heliacal.net)\r
3\r
4\r
5Tested on 10.5 and 10.6 intel. PPC is not supported because it's big-endian.\r
6\r
7All of the commands should be executed in Terminal.app.. it's in\r
8/Applications/Utilities\r
9\r
10You need to install XCode with all the options checked so that the compiler\r
11and everything is available in /usr not just /Developer\r
12I think it comes on the DVD but you can get the current version from\r
13http://developer.apple.com\r
14\r
15\r
161. Pick a directory to work inside.. something like ~/bitcoin works. The\r
17structure I use looks like this:\r
18(~ is your home directory)\r
19\r
20~/bitcoin\r
21~/bitcoin/trunk # source code\r
22~/bitcoin/deps # dependencies.. like libraries and headers needed to compile\r
23~/bitcoin/Bitcoin.app # the application bundle where you can run the app\r
24\r
25Just execute: mkdir ~/bitcoin\r
26This will create the top dir for you..\r
27\r
28WARNING: do not use the ~ notation with the configure scripts.. use the full\r
29name of the directory, for example /Users/james/bitcoin/deps for a user named\r
30'james'. In my examples I am using 'macosuser' so make sure you change that.\r
31\r
322. Check out the trunk version of the bitcoin code from subversion:\r
33\r
34cd ~/bitcoin\r
35svn checkout https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk\r
36\r
37This will make ~/bitcoin/trunk for you with all the files from subversion. \r
38\r
393. Get and build the dependencies\r
40\r
41\r
42Boost\r
43-----\r
44\r
45Download from http://www.boost.org/users/download/\r
46I'm assuming it ended up in ~/Downloads..\r
47\r
48mkdir ~/bitcoin/deps\r
49cd ~/bitcoin/deps\r
50tar xvjf ~/Downloads/boost_1_42_0.tar.bz2\r
51cd boost_1_42_0\r
52./bootstrap.sh\r
53./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 install\r
54\r
55This part takes a while.. use your judgement and fix it if something doesn't\r
56build for some reason.\r
57\r
58Change the prefix to whatever your directory is (my username in this example\r
59is macosuser). I'm also running on 10.6 so i have macosx-version=10.6 change\r
60to 10.5 if you're using leopard.\r
61\r
62This is what my output looked like at the end:\r
63...failed updating 2 targets...\r
64...skipped 144 targets...\r
65...updated 8074 targets...\r
66\r
67\r
68OpenSSL\r
69-------\r
70\r
71Download from http://www.openssl.org/source/\r
72\r
73We would like to build this as a 32 bit/64 bit library so we actually build it\r
742 times and join it together here.. If you downloaded with safari it already\r
75uncompressed it so it will just be a tar not a tar.gz\r
76\r
77cd ~/bitcoin/deps\r
78tar xvf ~/Downloads/openssl-1.0.0.tar\r
79mv openssl-1.0.0 openssl-1.0.0-i386\r
80tar xvf ~/Downloads/openssl-1.0.0.tar\r
81mv openssl-1.0.0 openssl-1.0.0-x86_64\r
82# build i386 (32 bit intel) binary\r
83cd openssl-1.0.0-i386\r
84./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin-i386-cc && make\r
85make install # only do this on one of the architectures, to install the headers\r
86cd ..\r
87# build x86_64 (64 bit intel) binary\r
88cd openssl-1.0.0-x86_64\r
89./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/deps/openssl darwin64-x86_64-cc && make\r
90cd ..\r
91\r
92# combine the libs\r
93cd ~/bitcoin/deps\r
94lipo -arch i386 openssl-1.0.0-i386/libcrypto.a -arch x86_64 openssl-1.0.0-x86_64/libcrypto.a -o lib/libcrypto.a -create\r
95lipo -arch i386 openssl-1.0.0-i386/libssl.a -arch x86_64 openssl-1.0.0-x86_64/libssl.a -o lib/libssl.a -create\r
96\r
97Verify your binaries\r
98\r
99file lib/libcrypto.a\r
100\r
101output should look like this:\r
102\r
103ib/libcrypto.a: Mach-O universal binary with 2 architectures\r
104lib/libcrypto.a (for architecture i386): current ar archive random library\r
105lib/libcrypto.a (for architecture x86_64): current ar archive random library\r
106\r
107\r
108Berkeley DB\r
109-----------\r
110\r
111Download from http://freshmeat.net/projects/berkeleydb/\r
112\r
113cd ~/bitcoin/deps\r
114tar xvf ~/Downloads/db-4.8.26.tar\r
115cd db-4.8.26/build_unix\r
116../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install\r
117\r
118\r
119wxWidgets\r
120---------\r
121\r
122This is the big one..\r
123\r
124Check it out from svn\r
125\r
126cd ~/bitcoin/deps\r
127svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk\r
128\r
129This will make a wxWidgets-trunk directory in deps.\r
130\r
131Use this script snippet, change your prefix to whatever your dir is:\r
132\r
133PREFIX=~/bitcoin/deps\r
134SRCDIR="$PREFIX/wxWidgets-trunk"\r
135BUILDDIR="$SRCDIR/macbuild"\r
136\r
137cd "$PREFIX" &&\r
138#svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk &&\r
139cd "$SRCDIR" &&\r
140\r
141[ -f include/wx/hashmap.h.orig ] || cp include/wx/hashmap.h include/wx/hashmap.h.orig &&\r
142sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashmap.h.orig > include/wx/hashmap.h &&\r
143\r
144[ -f include/wx/hashset.h.orig ] || cp include/wx/hashset.h include/wx/hashset.h.orig &&\r
145sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashset.h.orig > include/wx/hashset.h &&\r
146\r
147\r
148\r
149rm -vrf "$BUILDDIR" &&\r
150mkdir "$BUILDDIR" &&\r
151cd "$BUILDDIR" &&\r
152\r
153../configure --prefix="$PREFIX" \\r
154--with-osx_cocoa \\r
155--disable-shared \\r
156--disable-debug_flag \\r
157--with-macosx-version-min=10.5 \\r
158--enable-stl \\r
159--enable-utf8 \\r
160--enable-universal_binary \\r
161--with-libjpeg=builtin \\r
162--with-libpng=builtin \\r
163--with-regex=builtin \\r
164--with-libtiff=builtin \\r
165--with-zlib=builtin \\r
166--with-expat=builtin \\r
167--with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk &&\r
168\r
169\r
170find . -name Makefile | \r
171while read i; do \r
172 echo $i; \r
173 sed 's/-arch i386/-arch i386 -arch x86_64/g' < "$i" > "$i".new && \r
174 mv "$i" "$i".old && \r
175 mv "$i".new "$i"; \r
176done\r
177\r
178\r
179\r
180make && \r
181make install\r
182\r
183\r
184\r
185Now you should be able to build bitcoin\r
186\r
187cd ~/bitcoin/trunk\r
188make -f makefile.osx bitcoin\r
189\r
190Before you can run it, you need to create an application bundle for Mac OS.\r
191Create the directories in terminal using mkdir and copy the files into place.\r
192They are available at http://heliacal.net/~solar/bitcoin/mac-build/\r
193You need the Info.plist and the .ins file. The Contents/MacOS/bitcoin file is\r
194the output of the build.\r
195Your directory structure should look like this:\r
196\r
197Bitcoin.app\r
198Bitcoin.app/Contents\r
199Bitcoin.app/Contents/Info.plist\r
200Bitcoin.app/Contents/MacOS\r
201Bitcoin.app/Contents/MacOS/bitcoin\r
202Bitcoin.app/Contents/Resources\r
203Bitcoin.app/Contents/Resources/BitcoinAppIcon.icns\r
204\r
205To run it you can just click the Bitcoin.app in Finder, or just do open\r
206~/bitcoin/Bitcoin.app\r
207If you want to run it with arguments you can just run it without backgrounding\r
208by specifying the full name in terminal:\r
209~/bitcoin/Bitcoin.app/Contents/MacOS/bitcoin -addnode=192.75.207.66\r
This page took 0.041328 seconds and 4 git commands to generate.