-
Notifications
You must be signed in to change notification settings - Fork 5
/
makeios
executable file
·95 lines (76 loc) · 3.2 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
#!/bin/bash
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../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../secp256k1-vrf/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 libaergo.a $pwd/ios/$target
mv libaergo.dylib $pwd/ios/$target
}
cp ../secp256k1-vrf/ios/libsecp256k1-vrf.a .
cp ../secp256k1-vrf/ios/libsecp256k1-vrf.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/libaergo.a $pwd/ios/armv7s/libaergo.a $pwd/ios/arm64/libaergo.a $pwd/ios/x86_64/libaergo.a $pwd/ios/i386/libaergo.a -output libaergo.a
$LIPO -create $pwd/ios/armv7/libaergo.dylib $pwd/ios/armv7s/libaergo.dylib $pwd/ios/arm64/libaergo.dylib $pwd/ios/x86_64/libaergo.dylib $pwd/ios/i386/libaergo.dylib -output libaergo.dylib
#install_name_tool -id @rpath/libsecp256k1-vrf.dylib libsecp256k1-vrf.dylib
#install_name_tool -id @rpath/libaergo.dylib libaergo.dylib
#install_name_tool -change libsecp256k1-vrf.dylib @rpath/libsecp256k1-vrf.dylib libaergo.dylib
install_name_tool -id @rpath/libaergo.dylib libaergo.dylib
mv libsecp256k1-vrf.a $pwd/ios/
mv libsecp256k1-vrf.dylib $pwd/ios/
mv libaergo.a $pwd/ios/
mv libaergo.dylib $pwd/ios/
make clean
echo ""
echo "done. files in the ios folder"
echo ""