-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathbuild-ios.sh
executable file
·139 lines (125 loc) · 4.34 KB
/
build-ios.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
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
#!/bin/bash
#
# build all of umundo for iOS and iOS simulator
#
# make sure this is not set
unset MACOSX_DEPLOYMENT_TARGET
# be conservative with regard to ios features
export IPHONEOS_DEPLOYMENT_TARGET="8.0"
# exit on error
set -e
ME=`basename $0`
DIR="$( cd "$( dirname "$0" )" && pwd )"
SDK_VER="9.3"
CWD=`pwd`
BUILD_DIR="/tmp/build-umundo-ios"
#rm -rf ${BUILD_DIR}
mkdir -p ${BUILD_DIR} &> /dev/null
#
# Build device with older SDK for old architectures
#
# export IOS_SDK_VERSION=${SDK_VER}
mkdir -p ${BUILD_DIR}/device-${SDK_VER}-debug &> /dev/null
cd ${BUILD_DIR}/device-${SDK_VER}-debug
cmake ${DIR} \
-DCMAKE_TOOLCHAIN_FILE=${DIR}/contrib/cmake/toolchain/iOS.cmake \
-DDIST_PREPARE=ON \
-DCMAKE_BUILD_TYPE=Debug
make VERBOSE=1
mv ${DIR}/package/cross-compiled/ios/ \
${DIR}/package/cross-compiled/ios-device-${SDK_VER}-debug
# mkdir -p ${BUILD_DIR}/device-${SDK_VER}-release &> /dev/null
# cd ${BUILD_DIR}/device-${SDK_VER}-release
# cmake ${DIR}/../../ \
# -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS.cmake \
# -DDIST_PREPARE=ON \
# -DCMAKE_BUILD_TYPE=Release \
# make VERBOSE=1 -j2
# mv ${DIR}/../../package/cross-compiled/ios/ \
# ${DIR}/../../package/cross-compiled/ios-device-${SDK_VER}-release
#
# mkdir -p ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-debug &> /dev/null
# cd ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-debug
# cmake ${DIR}/../../ \
# -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS-Sim.cmake \
# -DDIST_PREPARE=ON \
# -DCMAKE_BUILD_TYPE=Debug \
# make VERBOSE=1 -j2
# mv ${DIR}/../../package/cross-compiled/ios/ \
# ${DIR}/../../package/cross-compiled/ios-simulator-${SDK_VER}-debug
#
# mkdir -p ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-release &> /dev/null
# cd ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-release
# cmake ${DIR}/../../ \
# -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS-Sim.cmake \
# -DDIST_PREPARE=ON \
# -DCMAKE_BUILD_TYPE=Release \
# make VERBOSE=1 -j2
# mv ${DIR}/../../package/cross-compiled/ios/ \
# ${DIR}/../../package/cross-compiled/ios-simulator-${SDK_VER}-release
#
# Build device with current SDK
#
# export IOS_SDK_VERSION=6.1
#
# mkdir -p ${BUILD_DIR}/device-${IOS_SDK_VERSION}-debug &> /dev/null
# cd ${BUILD_DIR}/device-${IOS_SDK_VERSION}-debug
# cmake ${DIR}/../../ \
# -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS.cmake \
# -DDIST_PREPARE=ON \
# -DCMAKE_BUILD_TYPE=Debug \
# make -j2
#
# mkdir -p ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-debug &> /dev/null
# cd ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-debug
# cmake ${DIR}/../../ \
# -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS-Sim.cmake \
# -DDIST_PREPARE=ON \
# -DCMAKE_BUILD_TYPE=Debug \
# make -j2
#
# mkdir -p ${BUILD_DIR}/device-${IOS_SDK_VERSION}-release &> /dev/null
# cd ${BUILD_DIR}/device-${IOS_SDK_VERSION}-release
# cmake ${DIR}/../../ \
# -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS.cmake \
# -DDIST_PREPARE=ON \
# -DCMAKE_BUILD_TYPE=Release \
# make -j2
#
# mkdir -p ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-release &> /dev/null
# cd ${BUILD_DIR}/simulator-${IOS_SDK_VERSION}-release
# cmake ${DIR}/../../ \
# -DCMAKE_TOOLCHAIN_FILE=${DIR}/../cmake/CrossCompile-iOS-Sim.cmake \
# -DDIST_PREPARE=ON \
# -DCMAKE_BUILD_TYPE=Release \
# make -j2
#
# Create universal binary
#
# LIBS=`find ${DIR}/../../package/cross-compiled/ios-* -name *.a`
# set +e
# for LIB in ${LIBS}; do
# LIB_BASE=`basename $LIB .a`
# ARCHS=`xcrun -sdk iphoneos lipo -info $LIB`
# ARCHS=`expr "$ARCHS" : '.*:\(.*\)$'`
# for ARCH in ${ARCHS}; do
# mkdir -p ${DIR}/../../package/cross-compiled/ios/arch/${ARCH} > /dev/null
# xcrun -sdk iphoneos lipo -extract $ARCH $LIB -output ${DIR}/../../package/cross-compiled/ios/arch/${ARCH}/${LIB_BASE}.a \
# || cp $LIB ${DIR}/../../package/cross-compiled/ios/arch/${ARCH}/${LIB_BASE}.a
# UNIQUE_LIBS=`ls ${DIR}/../../package/cross-compiled/ios/arch/${ARCH}`
# done
# done
#
# mkdir -p ${DIR}/../../package/cross-compiled/ios/lib &> /dev/null
#
# for LIB in ${UNIQUE_LIBS}; do
# FILELIST=""
# for ARCH in `ls ${DIR}/../../package/cross-compiled/ios/arch/`; do
# FILELIST="${FILELIST} ${DIR}/../../package/cross-compiled/ios/arch/${ARCH}/${LIB}"
# done
# xcrun -sdk iphoneos lipo -create ${FILELIST} -output ${DIR}/../../package/cross-compiled/ios/lib/${LIB}
# done
#
# rm -rf ${DIR}/../../package/cross-compiled/ios/arch
# rm -rf ${DIR}/../../package/cross-compiled/ios-*/
#