]> Git Repo - VerusCoin.git/blame - build-osx.txt
Merge branch 'remove-4way' of github.com:jgarzik/bitcoin into tmp
[VerusCoin.git] / build-osx.txt
CommitLineData
fc73ad64 1Copyright (c) 2010 Laszlo Hanyecz
0a61b0df 2Distributed under the MIT/X11 software license, see the accompanying
3file license.txt or http://www.opensource.org/licenses/mit-license.php.
4This product includes software developed by the OpenSSL Project for use in
5the OpenSSL Toolkit (http://www.openssl.org/). This product includes
8bb5edc1
MC
6cryptographic software written by Eric Young ([email protected]) and UPnP
7software written by Thomas Bernard.
0a61b0df 8
9
10Mac OS X build instructions
11Laszlo Hanyecz ([email protected])
12
13
14Tested on 10.5 and 10.6 intel. PPC is not supported because it's big-endian.
15
16All of the commands should be executed in Terminal.app.. it's in
17/Applications/Utilities
18
19You need to install XCode with all the options checked so that the compiler
20and everything is available in /usr not just /Developer
21I think it comes on the DVD but you can get the current version from
22http://developer.apple.com
23
24
251. Pick a directory to work inside.. something like ~/bitcoin works. The
26structure I use looks like this:
27(~ is your home directory)
28
29~/bitcoin
30~/bitcoin/trunk # source code
31~/bitcoin/deps # dependencies.. like libraries and headers needed to compile
32~/bitcoin/Bitcoin.app # the application bundle where you can run the app
33
34Just execute: mkdir ~/bitcoin
35This will create the top dir for you..
36
37WARNING: do not use the ~ notation with the configure scripts.. use the full
38name of the directory, for example /Users/james/bitcoin/deps for a user named
39'james'. In my examples I am using 'macosuser' so make sure you change that.
40
412. Check out the trunk version of the bitcoin code from subversion:
42
43cd ~/bitcoin
44svn checkout https://bitcoin.svn.sourceforge.net/svnroot/bitcoin/trunk
45
46This will make ~/bitcoin/trunk for you with all the files from subversion.
47
483. Get and build the dependencies
49
50
51Boost
52-----
53
54Download from http://www.boost.org/users/download/
55I'm assuming it ended up in ~/Downloads..
56
57mkdir ~/bitcoin/deps
58cd ~/bitcoin/deps
59tar xvjf ~/Downloads/boost_1_42_0.tar.bz2
60cd boost_1_42_0
61./bootstrap.sh
d7f02872
DL
62./bjam architecture=combined address-model=32_64 macosx-version=10.5 macosx-version-min=10.5 link=static runtime-link=static --toolset=darwin --prefix=/Users/macosuser/bitcoin/deps install
63
64If you're using Snow Leopard, you will need to specify 10.6 as your Mac OS X
65version instead of 10.5.
0a61b0df 66
67This part takes a while.. use your judgement and fix it if something doesn't
68build for some reason.
69
70Change the prefix to whatever your directory is (my username in this example
71is macosuser). I'm also running on 10.6 so i have macosx-version=10.6 change
72to 10.5 if you're using leopard.
73
74This is what my output looked like at the end:
75...failed updating 2 targets...
76...skipped 144 targets...
77...updated 8074 targets...
78
79
80OpenSSL
81-------
82
83Download from http://www.openssl.org/source/
84
85We would like to build this as a 32 bit/64 bit library so we actually build it
862 times and join it together here.. If you downloaded with safari it already
87uncompressed it so it will just be a tar not a tar.gz
88
89cd ~/bitcoin/deps
90tar xvf ~/Downloads/openssl-1.0.0.tar
91mv openssl-1.0.0 openssl-1.0.0-i386
92tar xvf ~/Downloads/openssl-1.0.0.tar
93mv openssl-1.0.0 openssl-1.0.0-x86_64
94# build i386 (32 bit intel) binary
95cd openssl-1.0.0-i386
d7f02872 96./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/bitcoin/deps/openssl darwin-i386-cc && make
0a61b0df 97make install # only do this on one of the architectures, to install the headers
98cd ..
99# build x86_64 (64 bit intel) binary
100cd openssl-1.0.0-x86_64
d7f02872 101./Configure --prefix=/Users/macosuser/bitcoin/deps --openssldir=/Users/macosuser/bitcoin/deps/openssl darwin64-x86_64-cc && make
0a61b0df 102cd ..
103
104# combine the libs
105cd ~/bitcoin/deps
106lipo -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
107lipo -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
108
109Verify your binaries
110
111file lib/libcrypto.a
112
113output should look like this:
114
8bb5edc1 115lib/libcrypto.a: Mach-O universal binary with 2 architectures
0a61b0df 116lib/libcrypto.a (for architecture i386): current ar archive random library
117lib/libcrypto.a (for architecture x86_64): current ar archive random library
118
119
8bb5edc1
MC
120miniupnpc
121---------
122
123The process for miniupnpc (optional) is similar to that of OpenSSL.
124
125Download from http://miniupnp.tuxfamily.org/files/.
126
127cd ~/bitcoin/deps
128tar xvf ~/Downloads/miniupnpc-1.5.tar
129mv miniupnpc-1.5 miniupnpc-1.5-x86_64
130tar xvf ~/Downloads/miniupnpc-1.5.tar
131mv miniupnpc-1.5 miniupnpc-1.5-i386
132# build x86_64 (64 bit intel) binary
133cd miniupnpc-1.5-x86_64
134export CFLAGS="-arch x86_64"
135export LDFLAGS="-arch x86_64"
136export PREFIX="/Users/macuser/bitcoin/deps"
137make && make install
138# build i386 (32 bit intel) binary
139cd miniupnpc-1.5-i386
140export CFLAGS="-arch i386"
141export LDFLAGS="-arch i386"
142export PREFIX="/Users/macuser/bitcoin/deps"
143make
144
145# combine the libs
146cd ~/bitcoin/deps
147lipo -arch i386 miniupnpc-1.5-i386/libminiupnpc.a -arch x86_64 miniupnpc-1.5-x86_64/libminiupnpc.a -o lib/libminiupnpc.a -create
148
149Verify your binaries
150
151file lib/libminiupnpc.a
152
153output should look like this:
154
155lib/libminiupnpc.a: Mach-O universal binary with 2 architectures
156lib/libminiupnpc.a (for architecture i386): current ar archive random library
157lib/libminiupnpc.a (for architecture x86_64): current ar archive random library
158
159
0a61b0df 160Berkeley DB
161-----------
162
163Download from http://freshmeat.net/projects/berkeleydb/
164
165cd ~/bitcoin/deps
166tar xvf ~/Downloads/db-4.8.26.tar
167cd db-4.8.26/build_unix
168../dist/configure --prefix=/Users/macosuser/bitcoin/deps --enable-cxx && make && make install
169
170
171wxWidgets
172---------
173
174This is the big one..
175
176Check it out from svn
177
178cd ~/bitcoin/deps
179svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk
180
181This will make a wxWidgets-trunk directory in deps.
182
183Use this script snippet, change your prefix to whatever your dir is:
184
185PREFIX=~/bitcoin/deps
186SRCDIR="$PREFIX/wxWidgets-trunk"
187BUILDDIR="$SRCDIR/macbuild"
188
189cd "$PREFIX" &&
190#svn checkout http://svn.wxwidgets.org/svn/wx/wxWidgets/trunk wxWidgets-trunk &&
191cd "$SRCDIR" &&
192
193[ -f include/wx/hashmap.h.orig ] || cp include/wx/hashmap.h include/wx/hashmap.h.orig &&
194sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashmap.h.orig > include/wx/hashmap.h &&
195
196[ -f include/wx/hashset.h.orig ] || cp include/wx/hashset.h include/wx/hashset.h.orig &&
197sed 's/if wxUSE_STL/if 0 \&\& wxUSE_STL/g' < include/wx/hashset.h.orig > include/wx/hashset.h &&
198
199
200
201rm -vrf "$BUILDDIR" &&
202mkdir "$BUILDDIR" &&
203cd "$BUILDDIR" &&
204
205../configure --prefix="$PREFIX" \
206--with-osx_cocoa \
207--disable-shared \
208--disable-debug_flag \
209--with-macosx-version-min=10.5 \
210--enable-stl \
211--enable-utf8 \
212--enable-universal_binary \
213--with-libjpeg=builtin \
214--with-libpng=builtin \
215--with-regex=builtin \
216--with-libtiff=builtin \
217--with-zlib=builtin \
218--with-expat=builtin \
219--with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk &&
220
221
222find . -name Makefile |
223while read i; do
224 echo $i;
225 sed 's/-arch i386/-arch i386 -arch x86_64/g' < "$i" > "$i".new &&
226 mv "$i" "$i".old &&
227 mv "$i".new "$i";
228done
229
230
231
232make &&
233make install
234
235
236
237Now you should be able to build bitcoin
238
239cd ~/bitcoin/trunk
240make -f makefile.osx bitcoin
241
242Before you can run it, you need to create an application bundle for Mac OS.
243Create the directories in terminal using mkdir and copy the files into place.
244They are available at http://heliacal.net/~solar/bitcoin/mac-build/
245You need the Info.plist and the .ins file. The Contents/MacOS/bitcoin file is
246the output of the build.
247Your directory structure should look like this:
248
249Bitcoin.app
250Bitcoin.app/Contents
251Bitcoin.app/Contents/Info.plist
252Bitcoin.app/Contents/MacOS
253Bitcoin.app/Contents/MacOS/bitcoin
254Bitcoin.app/Contents/Resources
255Bitcoin.app/Contents/Resources/BitcoinAppIcon.icns
256
257To run it you can just click the Bitcoin.app in Finder, or just do open
258~/bitcoin/Bitcoin.app
259If you want to run it with arguments you can just run it without backgrounding
260by specifying the full name in terminal:
261~/bitcoin/Bitcoin.app/Contents/MacOS/bitcoin -addnode=192.75.207.66
This page took 0.046919 seconds and 4 git commands to generate.