]>
Commit | Line | Data |
---|---|---|
05733577 JF |
1 | #!/usr/bin/env bash |
2 | ||
c15969fd JF |
3 | # Cycript - Optimizing JavaScript Compiler/Runtime |
4 | # Copyright (C) 2009-2013 Jay Freeman (saurik) | |
5 | ||
6 | # GNU General Public License, Version 3 {{{ | |
7 | # | |
8 | # Cycript is free software: you can redistribute it and/or modify | |
9 | # it under the terms of the GNU General Public License as published | |
10 | # by the Free Software Foundation, either version 3 of the License, | |
11 | # or (at your option) any later version. | |
12 | # | |
13 | # Cycript is distributed in the hope that it will be useful, but | |
14 | # WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | # GNU General Public License for more details. | |
17 | # | |
18 | # You should have received a copy of the GNU General Public License | |
19 | # along with Cycript. If not, see <http://www.gnu.org/licenses/>. | |
20 | # }}} | |
21 | ||
05733577 JF |
22 | set -e |
23 | ||
24 | rm -rf sysroot.sim | |
25 | mkdir -p sysroot.sim | |
26 | ||
84152e4b | 27 | xsp=$(xcode-select --print-path) |
05733577 | 28 | plt=iPhoneSimulator |
84152e4b JF |
29 | dev=${xsp}/Platforms/${plt}.platform/Developer |
30 | sdk=${dev}/SDKs/${plt}6.1.sdk | |
31 | mac=${xsp}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk | |
05733577 JF |
32 | |
33 | mkdir -p sysroot.sim/usr/include | |
84152e4b | 34 | cp -a "${mac}"/usr/include/ffi sysroot.sim/usr/include |
05733577 JF |
35 | |
36 | mkdir -p sysroot.sim/usr/lib | |
37 | cp -a /usr/lib/libffi.dylib sysroot.sim/usr/lib | |
38 | cp -a /usr/lib/libapr-1.* sysroot.sim/usr/lib | |
39 | ||
40 | ln -s /System/Library/Frameworks/WebKit.framework/Versions/A/Headers sysroot.sim/usr/include/WebKit | |
41 | ||
42 | mkdir -p sysroot.sim/Library/Frameworks/JavaScriptCore.framework | |
43 | ln -s "${sdk}"/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore sysroot.sim/Library/Frameworks/JavaScriptCore.framework | |
44 | ln -s /System/Library/Frameworks/JavaScriptCore.framework/Headers sysroot.sim/Library/Frameworks/JavaScriptCore.framework | |
45 | ||
84152e4b JF |
46 | export CC=/usr/bin/clang |
47 | export CXX=/usr/bin/clang++ | |
48 | export OBJCXX=/usr/bin/clang++ | |
05733577 | 49 | |
84152e4b JF |
50 | flags=(-arch i386) |
51 | flags+=(-isysroot "${sdk}") | |
52 | flags+=(-Fsysroot.sim/Library/Frameworks) | |
05733577 | 53 | |
84152e4b JF |
54 | cflags=("${flags[@]}") |
55 | cflags+=(-Isysroot.sim/usr/include) | |
56 | cflags+=(-fobjc-abi-version=2) | |
57 | cflags+=(-Wno-overloaded-virtual) | |
58 | cflags+=(-Wno-unneeded-internal-declaration) | |
05733577 | 59 | |
84152e4b JF |
60 | lflags=("${flags[@]}") |
61 | lflags+=(-Lsysroot.sim/usr/lib) | |
62 | lflags+=(-F"${sdk}"/System/Library/PrivateFrameworks) | |
63 | lflags+=(-framework WebCore) | |
05733577 | 64 | |
84152e4b | 65 | cflags=${cflags[*]} |
05733577 JF |
66 | export CFLAGS=${cflags} |
67 | export CXXFLAGS=${cflags} | |
68 | export OBJCXXFLAGS=${cflags} | |
69 | ||
84152e4b | 70 | export OBJCXXFLAGS="${OBJCXXFLAGS} -fobjc-legacy-dispatch" |
05733577 | 71 | |
84152e4b JF |
72 | lflags=${lflags[*]} |
73 | export LDFLAGS=${lflags} | |
74 | ||
75 | tflags=() | |
05733577 | 76 | for flag in "${flags[@]}"; do |
84152e4b | 77 | tflags+=("-Xcompiler ${flag}") |
05733577 JF |
78 | done |
79 | ||
84152e4b JF |
80 | tflags=${tflags[*]} |
81 | export LTFLAGS=${tflags} | |
82 | ||
83 | export DYLD_ROOT_PATH=${sdk} | |
84 | export DYLD_FALLBACK_LIBRARY_PATH=/usr/lib | |
85 | export DYLD_FALLBACK_FRAMEWORK_PATH=/System/Library/Frameworks | |
05733577 | 86 | |
0fa0e7f0 | 87 | ./configure "$@" |