-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.sh
executable file
·75 lines (52 loc) · 1.83 KB
/
build.sh
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
#!/bin/bash
# set -x
CURRENT=`pwd`
__pr="--print-path"
__name="xcode-select"
DEVELOPER=`${__name} ${__pr}`
MIN_IOS="9.0"
SDKVERSION=`xcrun -sdk iphoneos --show-sdk-version`
BITCODE="-fembed-bitcode"
if [ "${SDKVERSION}" == "9.0" ]; then
BITCODE=""
fi
OSX_PLATFORM=`xcrun --sdk macosx --show-sdk-platform-path`
OSX_SDK=`xcrun --sdk macosx --show-sdk-path`
IPHONEOS_PLATFORM=`xcrun --sdk iphoneos --show-sdk-platform-path`
IPHONEOS_SDK=`xcrun --sdk iphoneos --show-sdk-path`
IPHONESIMULATOR_PLATFORM=`xcrun --sdk iphonesimulator --show-sdk-platform-path`
IPHONESIMULATOR_SDK=`xcrun --sdk iphonesimulator --show-sdk-path`
CLANG=`xcrun --sdk iphoneos --find clang`
CLANGPP=`xcrun --sdk iphoneos --find clang++`
build()
{
ARCH=$1
SDK=$2
PLATFORM=$3
ARGS=$4
make clean
export PATH="${PLATFORM}/Developer/usr/bin:${DEVELOPER}/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
mkdir "${CURRENT}/lib/${ARCH}"
EXTRAS=""
if [ "${ARCH}" != "x64_86" ]; then
EXTRAS="-miphoneos-version-min=${MIN_IOS} -no-integrated-as -arch ${ARCH} -target ${ARCH}-apple-darwin"
fi
export CFLAGS="-g -Wall ${BITCODE} -isysroot ${SDK} -Wno-error -Wno-implicit-function-declaration ${EXTRAS} "
echo "make in progress for ${ARCH}"
make -j `sysctl -n hw.logicalcpu_max` lib
mv "${CURRENT}/lib/libpaillier.a" "${CURRENT}/lib/${ARCH}/libpaillier.a"
}
CURRENT=`pwd`
build "armv7" "${IPHONEOS_SDK}" "${IPHONEOS_PLATFORM}"
# exit 1
build "arm64" "${IPHONEOS_SDK}" "${IPHONEOS_PLATFORM}"
build "i386" "${IPHONESIMULATOR_SDK}" "${IPHONESIMULATOR_PLATFORM}"
build "x64_86" "${OSX_SDK}" "${OSX_PLATFORM}"
echo "doing lipo"
lipo \
"${CURRENT}/lib/armv7/libpaillier.a" \
"${CURRENT}/lib/arm64/libpaillier.a" \
"${CURRENT}/lib/i386/libpaillier.a" \
"${CURRENT}/lib/x64_86/libpaillier.a" \
-create -output libpaillier.a
echo "lib done"