]> git.saurik.com Git - cycript.git/blame - simulator.sh
New syntax: let declarations, initialised arguments.
[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
8plt=iPhoneSimulator
9dev=/Developer/Platforms/${plt}.platform/Developer
10sdk=${dev}/SDKs/${plt}5.0.sdk
11
12mkdir -p sysroot.sim/usr/include
13cp -a /usr/include/ffi sysroot.sim/usr/include
14
15mkdir -p sysroot.sim/usr/lib
16cp -a /usr/lib/libffi.dylib sysroot.sim/usr/lib
17cp -a /usr/lib/libapr-1.* sysroot.sim/usr/lib
18
19ln -s /System/Library/Frameworks/WebKit.framework/Versions/A/Headers sysroot.sim/usr/include/WebKit
20
21mkdir -p sysroot.sim/Library/Frameworks/JavaScriptCore.framework
22ln -s "${sdk}"/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore sysroot.sim/Library/Frameworks/JavaScriptCore.framework
23ln -s /System/Library/Frameworks/JavaScriptCore.framework/Headers sysroot.sim/Library/Frameworks/JavaScriptCore.framework
24
25export CC=${dev}/usr/bin/gcc
26export CXX=${dev}/usr/bin/g++
27export OBJCXX=${dev}/usr/bin/g++
28
29flags_i386=()
30flags_i386+=(-isysroot "${sdk}")
31
32flags_i386+=(-Fsysroot.sim/Library/Frameworks)
33flags_i386+=(-Isysroot.sim/usr/include)
34flags_i386+=(-Lsysroot.sim/usr/lib)
35
36flags_i386+=(-F"${sdk}"/System/Library/PrivateFrameworks)
37flags_i386+=(-framework WebCore)
38
39flags=()
40for flag in "${flags_i386[@]}"; do
41 flags+=(-Xarch_i386 "${flag}")
42done
43
44flags+=(-fobjc-abi-version=2)
45
46cflags=${flags[*]}
47export CFLAGS=${cflags}
48export CXXFLAGS=${cflags}
49export OBJCXXFLAGS=${cflags}
50
51export OBJCXXFLAGS="${OBJCXXFLAGS} -Xarch_i386 -fobjc-legacy-dispatch"
52
53lflags=()
54for flag in "${flags[@]}"; do
55 lflags+=("-Xcompiler ${flag}")
56done
57
58lflags=${lflags[*]}
59export LTFLAGS=${lflags}
60
0fa0e7f0 61./configure "$@"