3 # Cycript - Optimizing JavaScript Compiler/Runtime
4 # Copyright (C) 2009-2013 Jay Freeman (saurik)
6 # GNU General Public License, Version 3 {{{
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.
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.
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/>.
27 xsp
=$(xcode-select --print-path)
29 dev
=${xsp}/Platforms
/${plt}.platform
/Developer
30 sdk
=${dev}/SDKs
/${plt}6.1.sdk
31 mac
=${xsp}/Platforms
/MacOSX.platform
/Developer
/SDKs
/MacOSX10.7.sdk
33 mkdir -p sysroot.sim
/usr
/include
34 cp -a "${mac}"/usr
/include
/ffi sysroot.sim
/usr
/include
36 mkdir -p sysroot.sim
/usr
/lib
37 cp -a /usr
/lib
/libffi.dylib sysroot.sim
/usr
/lib
38 cp -a /usr
/lib
/libapr
-1.
* sysroot.sim
/usr
/lib
40 ln -s /System
/Library
/Frameworks
/WebKit.framework
/Versions
/A
/Headers sysroot.sim
/usr
/include
/WebKit
42 mkdir -p sysroot.sim
/Library
/Frameworks
/JavaScriptCore.framework
43 ln -s "${sdk}"/System
/Library
/PrivateFrameworks
/JavaScriptCore.framework
/JavaScriptCore sysroot.sim
/Library
/Frameworks
/JavaScriptCore.framework
44 ln -s /System
/Library
/Frameworks
/JavaScriptCore.framework
/Headers sysroot.sim
/Library
/Frameworks
/JavaScriptCore.framework
46 export CC
=/usr
/bin
/clang
47 export CXX
=/usr
/bin
/clang
++
48 export OBJCXX
=/usr
/bin
/clang
++
51 flags
+=(-isysroot "${sdk}")
52 flags
+=(-Fsysroot.sim
/Library
/Frameworks
)
54 cflags
=("${flags[@]}")
55 cflags
+=(-Isysroot.sim
/usr
/include
)
56 cflags
+=(-fobjc-abi-version=2)
57 cflags
+=(-Wno-overloaded-virtual)
58 cflags
+=(-Wno-unneeded-internal-declaration)
60 lflags
=("${flags[@]}")
61 lflags
+=(-Lsysroot.sim
/usr
/lib
)
62 lflags
+=(-F"${sdk}"/System
/Library
/PrivateFrameworks
)
63 lflags
+=(-framework WebCore
)
66 export CFLAGS
=${cflags}
67 export CXXFLAGS
=${cflags}
68 export OBJCXXFLAGS
=${cflags}
70 export OBJCXXFLAGS
="${OBJCXXFLAGS} -fobjc-legacy-dispatch"
73 export LDFLAGS
=${lflags}
76 for flag
in "${flags[@]}"; do
77 tflags
+=("-Xcompiler ${flag}")
81 export LTFLAGS
=${tflags}
83 export DYLD_ROOT_PATH
=${sdk}
84 export DYLD_FALLBACK_LIBRARY_PATH
=/usr
/lib
85 export DYLD_FALLBACK_FRAMEWORK_PATH
=/System
/Library
/Frameworks