]> git.saurik.com Git - cycript.git/blame_incremental - simulator.sh
I should include built config.h.in for other users.
[cycript.git] / simulator.sh
... / ...
CommitLineData
1#!/usr/bin/env bash
2
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
22set -e
23
24rm -rf sysroot.sim
25mkdir -p sysroot.sim
26
27xsp=$(xcode-select --print-path)
28plt=iPhoneSimulator
29dev=${xsp}/Platforms/${plt}.platform/Developer
30sdk=${dev}/SDKs/${plt}6.1.sdk
31mac=${xsp}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk
32
33mkdir -p sysroot.sim/usr/include
34cp -a "${mac}"/usr/include/ffi sysroot.sim/usr/include
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
46export CC=/usr/bin/clang
47export CXX=/usr/bin/clang++
48export OBJCXX=/usr/bin/clang++
49
50flags=(-arch i386)
51flags+=(-isysroot "${sdk}")
52flags+=(-Fsysroot.sim/Library/Frameworks)
53
54cflags=("${flags[@]}")
55cflags+=(-Isysroot.sim/usr/include)
56cflags+=(-fobjc-abi-version=2)
57cflags+=(-Wno-overloaded-virtual)
58cflags+=(-Wno-unneeded-internal-declaration)
59
60lflags=("${flags[@]}")
61lflags+=(-Lsysroot.sim/usr/lib)
62lflags+=(-F"${sdk}"/System/Library/PrivateFrameworks)
63lflags+=(-framework WebCore)
64
65cflags=${cflags[*]}
66export CFLAGS=${cflags}
67export CXXFLAGS=${cflags}
68export OBJCXXFLAGS=${cflags}
69
70export OBJCXXFLAGS="${OBJCXXFLAGS} -fobjc-legacy-dispatch"
71
72lflags=${lflags[*]}
73export LDFLAGS=${lflags}
74
75tflags=()
76for flag in "${flags[@]}"; do
77 tflags+=("-Xcompiler ${flag}")
78done
79
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
86
87./configure "$@"