]> git.saurik.com Git - cycript.git/blame - simulator.sh
I should include built config.h.in for other users.
[cycript.git] / simulator.sh
CommitLineData
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
22set -e
23
24rm -rf sysroot.sim
25mkdir -p sysroot.sim
26
84152e4b 27xsp=$(xcode-select --print-path)
05733577 28plt=iPhoneSimulator
84152e4b
JF
29dev=${xsp}/Platforms/${plt}.platform/Developer
30sdk=${dev}/SDKs/${plt}6.1.sdk
31mac=${xsp}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
05733577
JF
32
33mkdir -p sysroot.sim/usr/include
84152e4b 34cp -a "${mac}"/usr/include/ffi sysroot.sim/usr/include
05733577
JF
35
36mkdir -p sysroot.sim/usr/lib
37cp -a /usr/lib/libffi.dylib sysroot.sim/usr/lib
38cp -a /usr/lib/libapr-1.* sysroot.sim/usr/lib
39
40ln -s /System/Library/Frameworks/WebKit.framework/Versions/A/Headers sysroot.sim/usr/include/WebKit
41
42mkdir -p sysroot.sim/Library/Frameworks/JavaScriptCore.framework
43ln -s "${sdk}"/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore sysroot.sim/Library/Frameworks/JavaScriptCore.framework
44ln -s /System/Library/Frameworks/JavaScriptCore.framework/Headers sysroot.sim/Library/Frameworks/JavaScriptCore.framework
45
84152e4b
JF
46export CC=/usr/bin/clang
47export CXX=/usr/bin/clang++
48export OBJCXX=/usr/bin/clang++
05733577 49
84152e4b
JF
50flags=(-arch i386)
51flags+=(-isysroot "${sdk}")
52flags+=(-Fsysroot.sim/Library/Frameworks)
05733577 53
84152e4b
JF
54cflags=("${flags[@]}")
55cflags+=(-Isysroot.sim/usr/include)
56cflags+=(-fobjc-abi-version=2)
57cflags+=(-Wno-overloaded-virtual)
58cflags+=(-Wno-unneeded-internal-declaration)
05733577 59
84152e4b
JF
60lflags=("${flags[@]}")
61lflags+=(-Lsysroot.sim/usr/lib)
62lflags+=(-F"${sdk}"/System/Library/PrivateFrameworks)
63lflags+=(-framework WebCore)
05733577 64
84152e4b 65cflags=${cflags[*]}
05733577
JF
66export CFLAGS=${cflags}
67export CXXFLAGS=${cflags}
68export OBJCXXFLAGS=${cflags}
69
84152e4b 70export OBJCXXFLAGS="${OBJCXXFLAGS} -fobjc-legacy-dispatch"
05733577 71
84152e4b
JF
72lflags=${lflags[*]}
73export LDFLAGS=${lflags}
74
75tflags=()
05733577 76for flag in "${flags[@]}"; do
84152e4b 77 tflags+=("-Xcompiler ${flag}")
05733577
JF
78done
79
84152e4b
JF
80tflags=${tflags[*]}
81export LTFLAGS=${tflags}
82
83export DYLD_ROOT_PATH=${sdk}
84export DYLD_FALLBACK_LIBRARY_PATH=/usr/lib
85export DYLD_FALLBACK_FRAMEWORK_PATH=/System/Library/Frameworks
05733577 86
0fa0e7f0 87./configure "$@"