]> git.saurik.com Git - cycript.git/blob - simulator.sh
Isolate linkage of libreadline and libtermcap.
[cycript.git] / simulator.sh
1 #!/usr/bin/env bash
2
3 set -e
4
5 rm -rf sysroot.sim
6 mkdir -p sysroot.sim
7
8 xsp=$(xcode-select --print-path)
9 plt=iPhoneSimulator
10 dev=${xsp}/Platforms/${plt}.platform/Developer
11 sdk=${dev}/SDKs/${plt}6.1.sdk
12 mac=${xsp}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
13
14 mkdir -p sysroot.sim/usr/include
15 cp -a "${mac}"/usr/include/ffi sysroot.sim/usr/include
16
17 mkdir -p sysroot.sim/usr/lib
18 cp -a /usr/lib/libffi.dylib sysroot.sim/usr/lib
19 cp -a /usr/lib/libapr-1.* sysroot.sim/usr/lib
20
21 ln -s /System/Library/Frameworks/WebKit.framework/Versions/A/Headers sysroot.sim/usr/include/WebKit
22
23 mkdir -p sysroot.sim/Library/Frameworks/JavaScriptCore.framework
24 ln -s "${sdk}"/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore sysroot.sim/Library/Frameworks/JavaScriptCore.framework
25 ln -s /System/Library/Frameworks/JavaScriptCore.framework/Headers sysroot.sim/Library/Frameworks/JavaScriptCore.framework
26
27 export CC=/usr/bin/clang
28 export CXX=/usr/bin/clang++
29 export OBJCXX=/usr/bin/clang++
30
31 flags=(-arch i386)
32 flags+=(-isysroot "${sdk}")
33 flags+=(-Fsysroot.sim/Library/Frameworks)
34
35 cflags=("${flags[@]}")
36 cflags+=(-Isysroot.sim/usr/include)
37 cflags+=(-fobjc-abi-version=2)
38 cflags+=(-Wno-overloaded-virtual)
39 cflags+=(-Wno-unneeded-internal-declaration)
40
41 lflags=("${flags[@]}")
42 lflags+=(-Lsysroot.sim/usr/lib)
43 lflags+=(-F"${sdk}"/System/Library/PrivateFrameworks)
44 lflags+=(-framework WebCore)
45
46 cflags=${cflags[*]}
47 export CFLAGS=${cflags}
48 export CXXFLAGS=${cflags}
49 export OBJCXXFLAGS=${cflags}
50
51 export OBJCXXFLAGS="${OBJCXXFLAGS} -fobjc-legacy-dispatch"
52
53 lflags=${lflags[*]}
54 export LDFLAGS=${lflags}
55
56 tflags=()
57 for flag in "${flags[@]}"; do
58 tflags+=("-Xcompiler ${flag}")
59 done
60
61 tflags=${tflags[*]}
62 export LTFLAGS=${tflags}
63
64 export DYLD_ROOT_PATH=${sdk}
65 export DYLD_FALLBACK_LIBRARY_PATH=/usr/lib
66 export DYLD_FALLBACK_FRAMEWORK_PATH=/System/Library/Frameworks
67
68 ./configure "$@"