X-Git-Url: https://git.saurik.com/cycript.git/blobdiff_plain/d10cbac79646e6eaf138b4c60c77fef463bb9a13..83646644cade2e27f9df70ca0d5e730c7c84b0ab:/xcode.sh diff --git a/xcode.sh b/xcode.sh index 67d2a74..d901f48 100755 --- a/xcode.sh +++ b/xcode.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Cycript - Optimizing JavaScript Compiler/Runtime # Copyright (C) 2009-2013 Jay Freeman (saurik) @@ -52,18 +52,24 @@ function configure() { local flg=$3 shift 3 - cc=$(xcrun --sdk "${sdk}" -f gcc) - cxx=$(xcrun --sdk "${sdk}" -f g++) + cc=$(xcrun --sdk "${sdk}" -f clang) + cxx=$(xcrun --sdk "${sdk}" -f clang++) flg+=" -isysroot $(path "${sdk}")" rm -rf build."${dir}" mkdir build."${dir}" cd build."${dir}" - CPP="${cc} -E" CC="${cc} ${flg}" CXXCPP="${cxx} -E" CXX="${cxx} ${flg}" OBJCXX="${cxx} ${flg}" ../configure "${flags[@]}" "$@" + + CC="${cc} ${flg}" CXX="${cxx} ${flg}" OBJCXX="${cxx} ${flg}" \ + ../configure --enable-maintainer-mode "${flags[@]}" --prefix="/usr" "$@" + cd .. } -configure mac "${mac}" "-arch i386 -arch x86_64 -mmacosx-version-min=10.6" CPPFLAGS="-I../readline" LDFLAGS="-L../readline" +for arch in i386 x86_64; do + configure "mac-${arch}" "${mac}" "-arch ${arch} -mmacosx-version-min=10.6" \ + CPPFLAGS="-I../readline" LDFLAGS="-L../readline" +done function build() { local dir=$1 @@ -71,11 +77,37 @@ function build() { local flg=$3 shift 3 - configure "${dir}" "${sdk}" "${flg}" "$@" --enable-static --with-pic #CPPFLAGS="-idirafter ${mac}/usr/include" + configure "${dir}" "${sdk}" "${flg}" "$@" --enable-static --with-pic } -sim="-mios-simulator-version-min=2.0" -sim="" # gcc does not support this - -build sim iphonesimulator "-arch i386 ${sim}" OBJCXXFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch" CPPFLAGS="-I../libffi.i386/include" LDFLAGS="-L.." --disable-console -build ios iphoneos5.1 "-arch armv6 -miphoneos-version-min=2.0" --host=arm-apple-darwin10 CPPFLAGS="-I../libffi.armv6/include -I../sysroot.ios/usr/include -I../sysroot.ios/usr/include/apr-1" LTLIBAPR="../sysroot.ios/usr/lib/libapr-1.dylib" LDFLAGS="-L.. -L../sysroot.ios/usr/lib" +for arch in i386 x86_64; do + build "sim-${arch}" iphonesimulator "-arch ${arch} -mios-simulator-version-min=4.0" \ + OBJCXXFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch" \ + CPPFLAGS="-I../libffi.${arch}/include" \ + LDFLAGS="-L.." \ + --disable-console +done + +for arch in armv6 armv7 armv7s arm64; do + cpf="-I../libffi.${arch}/include" + ldf="-L.." + + flg=() + if [[ ${arch} != armv6 ]]; then + flg+=(--disable-console) + else + flg+=(LTLIBAPR="../sysroot.ios/usr/lib/libapr-1.dylib") + flg+=(LTLIBGCC="-lgcc_s.1") + cpf+=" -I../sysroot.ios/usr/include -I../sysroot.ios/usr/include/apr-1" + ldf+=" -L../sysroot.ios/usr/lib" + fi + + if [[ ${arch} == arm64 ]]; then + min=7.0 + else + min=2.0 + fi + + build "ios-${arch}" iphoneos "-arch ${arch} -miphoneos-version-min=${min}" --host=arm-apple-darwin10 \ + CPPFLAGS="${cpf}" LDFLAGS="${ldf}" "${flg[@]}" --host=arm-apple-darwin10 +done