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