-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapple-configure.sh
executable file
·124 lines (100 loc) · 3.36 KB
/
apple-configure.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
#!/usr/bin/env bash
# Cycript - The Truly Universal Scripting Language
# Copyright (C) 2009-2016 Jay Freeman (saurik)
# GNU Affero General Public License, Version 3 {{{
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# }}}
set -e
cd "${0%%/*}"
flags=("$@")
ccf=(-g0 -O3)
function path() {
xcodebuild -sdk "$1" -version Path
}
xcs=$(xcode-select --print-path)
mac=$(path macosx)
xct="${xcs}/Toolchains/XcodeDefault.xctoolchain/usr/lib"
system=1
function configure() {
local dir=$1
local sdk=$2
local arc=$3
local min=$4
local ffi=$5
local cpf=$6
local ldf=$7
local obc=$8
shift 8
set -- "$@" --enable-static --with-pic
cc=$(xcrun --sdk "${sdk}" -f clang)
cxx=$(xcrun --sdk "${sdk}" -f clang++)
flg="-arch ${arc} ${min}"
flg+=" -isysroot $(path "${sdk}")"
rm -rf build."${dir}"
mkdir build."${dir}"
cd build."${dir}"
if "${ffi}"; then
cpf+=" -I../libffi.${arch}/include"
ldf+=" -L../libffi.${arch}/.libs"
fi
cpf+=" -I../libuv/include"
ldf+=" -L../libuv.${arch}/.libs"
../configure --enable-maintainer-mode "${flags[@]}" --prefix="/usr" "$@" \
--with-libclang="-rpath ${xct} ${xct}/libclang.dylib" \
CC="${cc} ${flg}" CXX="${cxx} ${flg}" OBJCXX="${cxx} ${flg}" \
CFLAGS="${ccf[*]}" CXXFLAGS="${ccf[*]}" OBJCXXFLAGS="${ccf[*]} ${obc}" \
CPPFLAGS="${cpf}" LDFLAGS="${ldf}" CY_SYSTEM="$((1<<system++))"
cd ..
}
for arch in i386 x86_64; do
configure "osx-${arch}" "${mac}" "${arch}" "-mmacosx-version-min=10.6" \
false "-I../readline.osx" "-L../readline.osx" "" \
--with-python=/usr/bin/python-config
done
for arch in i386 x86_64; do
configure "sim-${arch}" iphonesimulator "${arch}" "-mios-simulator-version-min=4.0" \
true "" "" "-fobjc-abi-version=2 -fobjc-legacy-dispatch" \
--disable-console
done
for arch in armv6 armv7 armv7s arm64; do
cpf=""
ldf=""
flg=()
if [[ ${arch} == arm64 ]]; then
cpf+=" -I../extra.${arch}"
cpf+=" -I../readline.${arch}"
ldf+=" -L../readline.${arch}"
elif [[ ${arch} != armv6 ]]; then
flg+=(--disable-console)
else
flg+=(LTLIBGCC="-lgcc_s.1")
cpf+=" -include ${PWD}/xcode.h"
cpf+=" -mllvm -arm-reserve-r9"
cpf+=" -I../sysroot.ios/usr/include"
ldf+=" -L../sysroot.ios/usr/lib"
fi
ldf+=" -Wl,-dead_strip"
ldf+=" -Wl,-no_dead_strip_inits_and_terms"
if [[ ${arch} == arm64 ]]; then
min=7.0
else
min=2.0
ldf+=" -Wl,-segalign,4000"
#cpf+=" -mthumb"
fi
configure "ios-${arch}" iphoneos "${arch}" "-miphoneos-version-min=${min}" \
true "${cpf[*]}" "${ldf[*]}" "" \
--host=arm-apple-darwin10 LFLAGS="--ecs --meta-ecs" "${flg[@]}"
done