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
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++
+export CC=/usr/bin/clang
+export CXX=/usr/bin/clang++
+export OBJCXX=/usr/bin/clang++
-flags_i386=()
-flags_i386+=(-isysroot "${sdk}")
+flags=(-arch i386)
+flags+=(-isysroot "${sdk}")
+flags+=(-Fsysroot.sim/Library/Frameworks)
-flags_i386+=(-Fsysroot.sim/Library/Frameworks)
-flags_i386+=(-Isysroot.sim/usr/include)
-flags_i386+=(-Lsysroot.sim/usr/lib)
+cflags=("${flags[@]}")
+cflags+=(-Isysroot.sim/usr/include)
+cflags+=(-fobjc-abi-version=2)
+cflags+=(-Wno-overloaded-virtual)
+cflags+=(-Wno-unneeded-internal-declaration)
-flags_i386+=(-F"${sdk}"/System/Library/PrivateFrameworks)
-flags_i386+=(-framework WebCore)
+lflags=("${flags[@]}")
+lflags+=(-Lsysroot.sim/usr/lib)
+lflags+=(-F"${sdk}"/System/Library/PrivateFrameworks)
+lflags+=(-framework WebCore)
-flags=()
-for flag in "${flags_i386[@]}"; do
- flags+=(-Xarch_i386 "${flag}")
-done
-
-flags+=(-fobjc-abi-version=2)
-
-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 "$@"