]>
Commit | Line | Data |
---|---|---|
1 | #!/usr/bin/env bash | |
2 | ||
3 | set -e | |
4 | ||
5 | rm -rf sysroot.sim | |
6 | mkdir -p sysroot.sim | |
7 | ||
8 | plt=iPhoneSimulator | |
9 | dev=/Developer/Platforms/${plt}.platform/Developer | |
10 | sdk=${dev}/SDKs/${plt}5.0.sdk | |
11 | ||
12 | mkdir -p sysroot.sim/usr/include | |
13 | cp -a /usr/include/ffi sysroot.sim/usr/include | |
14 | ||
15 | mkdir -p sysroot.sim/usr/lib | |
16 | cp -a /usr/lib/libffi.dylib sysroot.sim/usr/lib | |
17 | cp -a /usr/lib/libapr-1.* sysroot.sim/usr/lib | |
18 | ||
19 | ln -s /System/Library/Frameworks/WebKit.framework/Versions/A/Headers sysroot.sim/usr/include/WebKit | |
20 | ||
21 | mkdir -p sysroot.sim/Library/Frameworks/JavaScriptCore.framework | |
22 | ln -s "${sdk}"/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore sysroot.sim/Library/Frameworks/JavaScriptCore.framework | |
23 | ln -s /System/Library/Frameworks/JavaScriptCore.framework/Headers sysroot.sim/Library/Frameworks/JavaScriptCore.framework | |
24 | ||
25 | export CC=${dev}/usr/bin/gcc | |
26 | export CXX=${dev}/usr/bin/g++ | |
27 | export OBJCXX=${dev}/usr/bin/g++ | |
28 | ||
29 | flags_i386=() | |
30 | flags_i386+=(-isysroot "${sdk}") | |
31 | ||
32 | flags_i386+=(-Fsysroot.sim/Library/Frameworks) | |
33 | flags_i386+=(-Isysroot.sim/usr/include) | |
34 | flags_i386+=(-Lsysroot.sim/usr/lib) | |
35 | ||
36 | flags_i386+=(-F"${sdk}"/System/Library/PrivateFrameworks) | |
37 | flags_i386+=(-framework WebCore) | |
38 | ||
39 | flags=() | |
40 | for flag in "${flags_i386[@]}"; do | |
41 | flags+=(-Xarch_i386 "${flag}") | |
42 | done | |
43 | ||
44 | flags+=(-fobjc-abi-version=2) | |
45 | ||
46 | cflags=${flags[*]} | |
47 | export CFLAGS=${cflags} | |
48 | export CXXFLAGS=${cflags} | |
49 | export OBJCXXFLAGS=${cflags} | |
50 | ||
51 | export OBJCXXFLAGS="${OBJCXXFLAGS} -Xarch_i386 -fobjc-legacy-dispatch" | |
52 | ||
53 | lflags=() | |
54 | for flag in "${flags[@]}"; do | |
55 | lflags+=("-Xcompiler ${flag}") | |
56 | done | |
57 | ||
58 | lflags=${lflags[*]} | |
59 | export LTFLAGS=${lflags} | |
60 | ||
61 | ./configure "$@" |