-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild_gmpfrxx.sh
executable file
·91 lines (64 loc) · 2.02 KB
/
build_gmpfrxx.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
#!/bin/bash
# set -x
# For building
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 ${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`
mv libgmpfrxx.a "${CURRENT}/${ARCH}/libgmpfrxx.a"
}
downloadgmpfrxx()
{
if [ ! -d "gmpfrxx" ]; then
echo "Downloading gmpfrxx"
git clone https://github.com/FrederickGeek8/gmpfrxx
fi
}
downloadgmpfrxx
cd gmpfrxx
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}/armv7/libgmpfrxx.a" \
"${CURRENT}/arm64/libgmpfrxx.a" \
"${CURRENT}/i386/libgmpfrxx.a" \
"${CURRENT}/x64_86/libgmpfrxx.a" \
-create -output libgmpfrxx.a
echo "lib done"
echo "${CURRENT}/libgmpfrxx.a"
echo "${CURRENT}/include"