X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/0fa0e7f068a29084d0c7cb7b9b3fea68f52eb285..c15969fd0a6280c60d2f35876b5343004fed2b11:/simulator.sh diff --git a/simulator.sh b/simulator.sh index 634d38b..0956b82 100755 --- a/simulator.sh +++ b/simulator.sh @@ -1,16 +1,37 @@ #!/usr/bin/env bash +# Cycript - Optimizing JavaScript Compiler/Runtime +# Copyright (C) 2009-2013 Jay Freeman (saurik) + +# GNU General Public License, Version 3 {{{ +# +# Cycript is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published +# by the Free Software Foundation, either version 3 of the License, +# or (at your option) any later version. +# +# Cycript is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with Cycript. If not, see . +# }}} + set -e rm -rf sysroot.sim mkdir -p sysroot.sim +xsp=$(xcode-select --print-path) plt=iPhoneSimulator -dev=/Developer/Platforms/${plt}.platform/Developer -sdk=${dev}/SDKs/${plt}5.0.sdk +dev=${xsp}/Platforms/${plt}.platform/Developer +sdk=${dev}/SDKs/${plt}6.1.sdk +mac=${xsp}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.7.sdk mkdir -p sysroot.sim/usr/include -cp -a /usr/include/ffi sysroot.sim/usr/include +cp -a "${mac}"/usr/include/ffi sysroot.sim/usr/include mkdir -p sysroot.sim/usr/lib cp -a /usr/lib/libffi.dylib sysroot.sim/usr/lib @@ -22,40 +43,45 @@ mkdir -p sysroot.sim/Library/Frameworks/JavaScriptCore.framework ln -s "${sdk}"/System/Library/PrivateFrameworks/JavaScriptCore.framework/JavaScriptCore sysroot.sim/Library/Frameworks/JavaScriptCore.framework ln -s /System/Library/Frameworks/JavaScriptCore.framework/Headers sysroot.sim/Library/Frameworks/JavaScriptCore.framework -export CC=${dev}/usr/bin/gcc -export CXX=${dev}/usr/bin/g++ -export OBJCXX=${dev}/usr/bin/g++ - -flags_i386=() -flags_i386+=(-isysroot "${sdk}") +export CC=/usr/bin/clang +export CXX=/usr/bin/clang++ +export OBJCXX=/usr/bin/clang++ -flags_i386+=(-Fsysroot.sim/Library/Frameworks) -flags_i386+=(-Isysroot.sim/usr/include) -flags_i386+=(-Lsysroot.sim/usr/lib) +flags=(-arch i386) +flags+=(-isysroot "${sdk}") +flags+=(-Fsysroot.sim/Library/Frameworks) -flags_i386+=(-F"${sdk}"/System/Library/PrivateFrameworks) -flags_i386+=(-framework WebCore) - -flags=() -for flag in "${flags_i386[@]}"; do - flags+=(-Xarch_i386 "${flag}") -done +cflags=("${flags[@]}") +cflags+=(-Isysroot.sim/usr/include) +cflags+=(-fobjc-abi-version=2) +cflags+=(-Wno-overloaded-virtual) +cflags+=(-Wno-unneeded-internal-declaration) -flags+=(-fobjc-abi-version=2) +lflags=("${flags[@]}") +lflags+=(-Lsysroot.sim/usr/lib) +lflags+=(-F"${sdk}"/System/Library/PrivateFrameworks) +lflags+=(-framework WebCore) -cflags=${flags[*]} +cflags=${cflags[*]} export CFLAGS=${cflags} export CXXFLAGS=${cflags} export OBJCXXFLAGS=${cflags} -export OBJCXXFLAGS="${OBJCXXFLAGS} -Xarch_i386 -fobjc-legacy-dispatch" +export OBJCXXFLAGS="${OBJCXXFLAGS} -fobjc-legacy-dispatch" -lflags=() +lflags=${lflags[*]} +export LDFLAGS=${lflags} + +tflags=() for flag in "${flags[@]}"; do - lflags+=("-Xcompiler ${flag}") + tflags+=("-Xcompiler ${flag}") done -lflags=${lflags[*]} -export LTFLAGS=${lflags} +tflags=${tflags[*]} +export LTFLAGS=${tflags} + +export DYLD_ROOT_PATH=${sdk} +export DYLD_FALLBACK_LIBRARY_PATH=/usr/lib +export DYLD_FALLBACK_FRAMEWORK_PATH=/System/Library/Frameworks ./configure "$@"