-
Notifications
You must be signed in to change notification settings - Fork 15
/
makeios
executable file
·149 lines (118 loc) · 4.5 KB
/
makeios
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
#!/bin/bash
set -e
# binn
if [[ ! -d ../binn ]] ; then
git clone --depth=1 https://github.com/liteserver/binn ../binn
fi
if [[ ! -f ../binn/ios/libbinn.a ]] ; then
cd ../binn
./makeios
cd -
fi
# libuv
if [[ ! -d ../libuv ]] ; then
git clone --depth=1 https://github.com/libuv/libuv ../libuv
fi
if [[ ! -f ../libuv/ios/libuv.a ]] ; then
cd ../libuv
wget https://gist.githubusercontent.com/kroggen/aed5776b74b6353c715d27b19051ada8/raw/04092577bb8f95f9c4075f871d3a3a27300c2887/makeios
./autogen.sh
./makeios
cd -
fi
# secp256k1-vrf
if [[ ! -d ../secp256k1-vrf ]] ; then
git clone --depth=1 https://github.com/aergoio/secp256k1-vrf ../secp256k1-vrf
fi
if [[ ! -f ../secp256k1-vrf/ios/libsecp256k1-vrf.a ]] ; then
cd ../secp256k1-vrf
./makeios
cd -
fi
# aergolite
PLATFORMPATH="/Applications/Xcode.app/Contents/Developer/Platforms"
TOOLSPATH="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin"
export IPHONEOS_DEPLOYMENT_TARGET="8.0"
pwd=`pwd`
findLatestSDKVersion()
{
sdks=`ls $PLATFORMPATH/$1.platform/Developer/SDKs`
arr=()
for sdk in $sdks
do
echo $sdk
arr[${#arr[@]}]=$sdk
done
# Last item will be the current SDK, since it is alpha ordered
count=${#arr[@]}
if [ $count -gt 0 ]; then
sdk=${arr[$count-1]:${#1}}
num=`expr ${#sdk}-4`
SDKVERSION=${sdk:0:$num}
else
SDKVERSION="8.0"
fi
}
buildit()
{
target=$1
platform=$2
echo ""
echo "-------------------------------------------------------------------------------"
echo " Compiling for $platform on $target"
echo "-------------------------------------------------------------------------------"
export PLATFORM=$platform
export CC="$(xcrun -sdk iphoneos -find clang)"
export STRIP="$(xcrun -sdk iphoneos -find strip)"
export LD="$(xcrun -sdk iphoneos -find ld)"
export CPP="$CC -E"
export CFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKMINVERSION -I../binn/src -I../libuv/include -I../secp256k1-vrf/include"
export AR=$(xcrun -sdk iphoneos -find ar)
export RANLIB=$(xcrun -sdk iphoneos -find ranlib)
export CPPFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -miphoneos-version-min=$SDKMINVERSION"
export LDFLAGS="-arch ${target} -isysroot $PLATFORMPATH/$platform.platform/Developer/SDKs/$platform$SDKVERSION.sdk -L." # -L../binn/output/$target/lib -L../libuv/output/$target/lib
#export LIBFLAGS="-DSQLITE_ENABLE_LOCKING_STYLE=0" -- to remove warning on getuuid()
#export prefix="$pwd/output/$target"
make clean
make ios
#make install
mkdir -p $pwd/ios/$target
mv libaergolite.a $pwd/ios/$target
mv libaergolite.dylib $pwd/ios/$target
}
cp ../binn/ios/libbinn.a .
cp ../binn/ios/libbinn.dylib .
cp ../libuv/ios/libuv.a .
cp ../libuv/ios/libuv.1.dylib libuv.dylib
cp ../secp256k1-vrf/ios/libsecp256k1-vrf.a .
cp ../secp256k1-vrf/ios/libsecp256k1-vrf.dylib .
install_name_tool -id @rpath/libuv.dylib libuv.dylib
install_name_tool -id @rpath/libbinn.dylib libbinn.dylib
install_name_tool -id @rpath/libsecp256k1-vrf.dylib libsecp256k1-vrf.dylib
findLatestSDKVersion iPhoneOS
SDKMINVERSION="8.0"
buildit armv7 iPhoneOS
buildit armv7s iPhoneOS
buildit arm64 iPhoneOS
buildit i386 iPhoneSimulator
buildit x86_64 iPhoneSimulator
LIPO=$(xcrun -sdk iphoneos -find lipo)
$LIPO -create $pwd/ios/armv7/libaergolite.a $pwd/ios/armv7s/libaergolite.a $pwd/ios/arm64/libaergolite.a $pwd/ios/x86_64/libaergolite.a $pwd/ios/i386/libaergolite.a -output libaergolite.a
$LIPO -create $pwd/ios/armv7/libaergolite.dylib $pwd/ios/armv7s/libaergolite.dylib $pwd/ios/arm64/libaergolite.dylib $pwd/ios/x86_64/libaergolite.dylib $pwd/ios/i386/libaergolite.dylib -output libaergolite.dylib
#install_name_tool -id @rpath/libuv.dylib libuv.dylib
#install_name_tool -id @rpath/libbinn.dylib libbinn.dylib
#install_name_tool -id @rpath/libaergolite.dylib libaergolite.dylib
#install_name_tool -change libuv.dylib @rpath/libuv.dylib libaergolite.dylib
#install_name_tool -change libbinn.dylib @rpath/libbinn.dylib libaergolite.dylib
install_name_tool -id @rpath/libaergolite.dylib libaergolite.dylib
mv libbinn.a $pwd/ios/
mv libbinn.dylib $pwd/ios/
mv libuv.a $pwd/ios/
mv libuv.1.dylib libuv.dylib $pwd/ios/
mv libsecp256k1-vrf.a $pwd/ios/
mv libsecp256k1-vrf.dylib $pwd/ios/
mv libaergolite.a $pwd/ios/
mv libaergolite.dylib $pwd/ios/
make clean
echo ""
echo "done. the files are in the ios folder"