-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·60 lines (48 loc) · 2.42 KB
/
Copy pathbuild.sh
File metadata and controls
executable file
·60 lines (48 loc) · 2.42 KB
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
#!/bin/bash
#
# Based on https://github.com/sinofool/build-libcurl-ios
#
# curl
curl -OL http://curl.haxx.se/download/curl-7.57.0.tar.gz && \
tar -xzf curl-7.57.0.tar.gz
# jansson
curl -O http://www.digip.org/jansson/releases/jansson-2.11.tar.gz && \
tar -xzf jansson-2.11.tar.gz
TMP_DIR=$(pwd)/usr
function build_for_arch() {
ARCH=$1
HOST=$2
SYSROOT=$3
PREFIX=$4
IPHONEOS_DEPLOYMENT_TARGET="9.0"
export PATH="${DEVROOT}/usr/bin/:${PATH}"
export CFLAGS="-DCURL_BUILD_IOS -arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SYSROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -fembed-bitcode"
export LDFLAGS="-arch ${ARCH} -isysroot ${SYSROOT}"
pushd `pwd`
cd curl-7.57.0
./configure --disable-shared --enable-static --host="${HOST}" --prefix=${PREFIX} && make -j8 && make install && make clean
popd
export CFLAGS="-arch ${ARCH} -pipe -Os -gdwarf-2 -isysroot ${SYSROOT} -miphoneos-version-min=${IPHONEOS_DEPLOYMENT_TARGET} -fembed-bitcode"
export LDFLAGS="-arch ${ARCH} -isysroot ${SYSROOT}"
pushd `pwd`
cd jansson-2.11
./configure --host="${HOST}" --prefix=${PREFIX} && make -j8 && make install && make clean
popd
}
build_for_arch x86_64 x86_64-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk ${TMP_DIR}/x86_64 || exit 2
build_for_arch arm64 arm-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk ${TMP_DIR}/arm64 || exit 3
build_for_arch armv7s armv7s-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk ${TMP_DIR}/armv7s || exit 4
build_for_arch armv7 armv7-apple-darwin /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk ${TMP_DIR}/armv7 || exit 5
mkdir -p ${TMP_DIR}/lib
${DEVROOT}/usr/bin/lipo \
-arch x86_64 ${TMP_DIR}/x86_64/lib/libcurl.a \
-arch armv7 ${TMP_DIR}/armv7/lib/libcurl.a \
-arch armv7s ${TMP_DIR}/armv7s/lib/libcurl.a \
-arch arm64 ${TMP_DIR}/arm64/lib/libcurl.a \
-output ${TMP_DIR}/lib/libcurl.a -create
${DEVROOT}/usr/bin/lipo \
-arch x86_64 ${TMP_DIR}/x86_64/lib/libjansson.a \
-arch armv7 ${TMP_DIR}/armv7/lib/libjansson.a \
-arch armv7s ${TMP_DIR}/armv7s/lib/libjansson.a \
-arch arm64 ${TMP_DIR}/arm64/lib/libjansson.a \
-output ${TMP_DIR}/lib/libjansson.a -create