forked from bitcoin/bitcoin
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-iOS.txt
217 lines (190 loc) · 7.59 KB
/
build-iOS.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
Copyright (c) 2011 Ehud Ben-Reuven
Distributed under the MIT/X11 software license, see the accompanying
file license.txt or http://www.opensource.org/licenses/mit-license.php.
This product includes software developed by the OpenSSL Project for use in
the OpenSSL Toolkit (http://www.openssl.org/). This product includes
cryptographic software written by Eric Young (eay@cryptsoft.com).
BitCoin iOS (iPhone) build instructions
Ehud Ben-Reuven (udi@benreuven.com)
* Create project directory
* Add bitcoin.org project
* Add openssl
* Add boost
* Add Berkley db
* Add Three20
* Add BitCoin App project
============================
= Create project directory =
============================
# create a tmp directory
mkdir ~/tmp
cd ~/tmp
export TMP=`pwd`
# create a project directory. For example:
mkdir ~/BitCoinProj
cd ~/BitCoinProj
export PROJ=`pwd`
===========================
= Add BitCoin App project =
===========================
# This is an example of an App project using bitcoin
# You need to install all the modules described below before continuing!
#
cd $PROJ
git clone git://github.com/udibr/bitcoinApp BitCoin
cd BitCoin
open BitCoin.xcodeproj
# Make sure scheme "BitCoin | iPhone 4.3 Simulator" is selected" (but the code also runs on a device)
# Build & Run
# to build a release version dont forget to fix the identifier to your company (BitCoin->TARGETS/BitCoin->Summary/Identifier)
===============
= Add Three20 =
===============
# This is used by the example App and has nothing to do with bitcoin itself
# you can decide not to use/install it
cd $PROJ
git clone git://github.com/facebook/three20.git
# NOTE, I am using version 1.0.5 of Three20. I have "patched" it using category files in my project (look for file that starts with TT and end with +BC) If you are using a latter version you will have to check that the patch does not need an update (when using category your method replaces the original method so if the original was updated by git, you need to also update the patch.)
open three20/samples/TTTwitter/TTTwitter.xcodeproj
#select scheme "TTTwitter | iPhone 4.3 Simulator"
#build (this is necessary to copy the header files into the correct place, dont have a better way)
===========================
= Add bitcoin.org project =
===========================
git clone git@github.com:udibr/bitcoin.git bitcoin.org
# any changes I made are surronded by "#if TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR"
===============
= Add openssl =
===============
mkdir $TMP/openssl
mkdir $TMP/openssl/openssl_i386
mkdir $TMP/openssl/openssl_armv6
mkdir $TMP/openssl/openssl_armv7
# following http://www.therareair.com/2009/01/01/tutorial-how-to-compile-openssl-for-the-iphone/
# download openssl-1.0.0d.tar.gz from http://www.openssl.org/source/ and open to $TMP/openssl
cd $TMP/openssl/openssl-1.0.0d/
./config --openssldir=$TMP/openssl/openssl_i386/ no-asm
# edit Makefile:
# Find CFLAG and add to the BEGINNING!!:
-D__OpenBSD__
# exit editor and run
make
make install
make clean
./config --openssldir=$TMP/openssl/openssl_armv6/ no-asm
# edit Makefile:
# Find CC= cc and change it to:
CC= /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
# Find -arch i386 in CFLAG and change it to:
-arch armv6
# Find CFLAG and add to the BEGINNING!!:
-isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk -D__OpenBSD__
# Find SHARED_LDFLAGS=-arch i386 -dynamiclib and change it to:
SHARED_LDFLAGS=-arch armv6 -dynamiclib
# Find PEX_LIBS= -Wl, -search_paths_firstxc and change it to:
PEX_LIBS= -Wl
# edit crypto/ui/ui_openssl.c and at line 407:
# replace
static volatile sig_atomic_t intr_signal;
# to
static volatile int intr_signal;
# exit editor and run
make
make install
# repeat the process for armv7 (use $TMP/openssl/openssl_armv7/)
cd $TMP/openssl
cp -R openssl_i386/include include
mkdir lib
lipo -create openssl_i386/lib/libcrypto.a openssl_armv6/lib/libcrypto.a openssl_armv7/lib/libcrypto.a -output lib/libcrypto.a
lipo -create openssl_i386/lib/libssl.a openssl_armv6/lib/libssl.a openssl_armv7/lib/libssl.a -output lib/libssl.a
mkdir $PROJ/openssl
cp -R $TMP/openssl/include $PROJ/openssl/include
cp -R $TMP/openssl/lib $PROJ/openssl/lib
=============
= Add boost =
=============
# following http://goodliffe.blogspot.com/2010/09/building-boost-framework-for-ios-iphone.html
cd $PROJ
git clone git://gitorious.org/boostoniphone/boostoniphone.git
cd boostoniphone
# edit boost.sh :
# change SDK from 4.2 to 4.3
# replace 4.2.1 to 4.3 (many places)
# NOTE use boost_1_44_0 that comes with git. dont try newer boost versions
# run:
./boost.sh
==================
= Add Berkley DB =
==================
# following http://ankitthakur.wordpress.com/2011/01/16/build-scripts-for-berkely-db-static-libraries-with-ios-development/
# download http://www.oracle.com/technetwork/database/berkeleydb/downloads/index.html
# open in $TMP
cd $TMP/db-5.1.19
mkdir build_i386
mkdir build_armv6
mkdir build_armv7
cd build_unix
export DEV_iSimulator=/Developer/Platforms/iPhoneSimulator.platform/Developer
export SDK_iSimulator=${DEV_iSimulator}/SDKs/iPhoneSimulator4.3.sdk
export COMPILER_iSimulator=${DEV_iSimulator}/usr/bin
export CC=${COMPILER_iSimulator}/gcc
export CXX=${COMPILER_iSimulator}/g++
export LDFLAGS="-arch i386 -pipe -Os -gdwarf-2 -no-cpp-precomp -mthumb -isysroot ${SDK_iSimulator}"
export CFLAGS=${LDFLAGS}
export CXXFLAGS=${LDFLAGS}
export CPP="/usr/bin/cpp ${CPPFLAGS}"
export LD=${COMPILER_iSimulator}/ld
export AR=${COMPILER_iSimulator}/ar
export AS=${COMPILER_iSimulator}/as
export NM=${COMPILER_iSimulator}/nm
export RANLIB=${COMPILER_iSimulator}/ranlib
../dist/configure --prefix=$TMP/db-5.1.19/build_i386 --host=i386-apple-darwin10 --enable-cxx
# not needed for sim --with-mutex=Darwin/_spin_lock_try
make
make install
make clean
make realclean
export DEV_iOS=/Developer/Platforms/iPhoneOS.platform/Developer
export SDK_iOS=${DEV_iOS}/SDKs/iPhoneOS4.3.sdk
export COMPILER_iOS=${DEV_iOS}/usr/bin
export CC=${COMPILER_iOS}/gcc
export CXX=${COMPILER_iOS}/g++
export LDFLAGS="-arch armv6 -pipe -Os -gdwarf-2 -no-cpp-precomp -mthumb -isysroot ${SDK_iOS}"
export CFLAGS=${LDFLAGS}
export CXXFLAGS=${LDFLAGS}
export CPP="/usr/bin/cpp ${CPPFLAGS}"
export LD=${COMPILER_iOS}/ld
export AR=${COMPILER_iOS}/ar
export AS=${COMPILER_iOS}/as
export NM=${COMPILER_iOS}/nm
export RANLIB=${COMPILER_iOS}/ranlib
../dist/configure --prefix=$TMP/db-5.1.19/build_armv6 --host=arm-apple-darwin10 --enable-cxx --disable-mutexsupport
# needed for armv6 but rejected by App Store --with-mutex=Darwin/_spin_lock_try
make
make install
make clean
make realclean
export DEV_iOS=/Developer/Platforms/iPhoneOS.platform/Developer
export SDK_iOS=${DEV_iOS}/SDKs/iPhoneOS4.3.sdk
export COMPILER_iOS=${DEV_iOS}/usr/bin
export CC=${COMPILER_iOS}/gcc
export CXX=${COMPILER_iOS}/g++
export LDFLAGS="-arch armv7 -pipe -Os -gdwarf-2 -no-cpp-precomp -mthumb -isysroot ${SDK_iOS}"
export CFLAGS=${LDFLAGS}
export CXXFLAGS=${LDFLAGS}
export CPP="/usr/bin/cpp ${CPPFLAGS}"
export LD=${COMPILER_iOS}/ld
export AR=${COMPILER_iOS}/ar
export AS=${COMPILER_iOS}/as
export NM=${COMPILER_iOS}/nm
export RANLIB=${COMPILER_iOS}/ranlib
../dist/configure --prefix=$TMP/db-5.1.19/build_armv7 --host=arm-apple-darwin10 --enable-cxx
# not needed for amrv7 --with-mutex=Darwin/_spin_lock_try
make
make install
mkdir $PROJ/db
cd $PROJ/db/
mkdir lib
lipo -create $TMP/db-5.1.19/build_i386/lib/libdb.a $TMP/db-5.1.19/build_armv6/lib/libdb.a $TMP/db-5.1.19/build_armv7/lib/libdb.a -output $PROJ/db/lib/libdb.a
lipo -create $TMP/db-5.1.19/build_i386/lib/libdb_cxx.a $TMP/db-5.1.19/build_armv6/lib/libdb_cxx.a $TMP/db-5.1.19/build_armv7/lib/libdb_cxx.a -output $PROJ/db/lib/libdb_cxx.a
cp -R $TMP/db-5.1.19/build_i386/include $PROJ/db/include