From e9abea04a58861934edfb19032be2c0dd92f84ec Mon Sep 17 00:00:00 2001 From: "Jay Freeman (saurik)" Date: Tue, 10 Sep 2013 00:51:48 -0700 Subject: [PATCH] Support both armv7s and armv6 at the same time. --- libffi.sh | 1 + xcode.mk | 16 +++++++--------- xcode.sh | 14 +++++++++++--- 3 files changed, 19 insertions(+), 12 deletions(-) diff --git a/libffi.sh b/libffi.sh index 96e93f4..145668c 100755 --- a/libffi.sh +++ b/libffi.sh @@ -45,6 +45,7 @@ function arch() { arch armv6 arm-apple-darwin10 iphoneos5.1 iphoneos arch armv7 arm-apple-darwin10 iphoneos iphoneos +arch armv7s arm-apple-darwin10 iphoneos iphoneos arch i386 i386-apple-darwin10 iphonesimulator ios-simulator libffi=() diff --git a/xcode.mk b/xcode.mk index a112e9b..63b3412 100644 --- a/xcode.mk +++ b/xcode.mk @@ -20,6 +20,8 @@ .DELETE_ON_ERROR: SHELL := /bin/bash +lipo := $(shell xcrun --sdk iphoneos -f lipo) + libs := libs += .libs/cycript libs += .libs/libcycript.dylib @@ -64,7 +66,7 @@ build.ios-$(1)/.libs/libcycript.a: build-ios-$(1) @ endef -$(foreach arch,armv6 armv7,$(eval $(call build_ios,$(arch)))) +$(foreach arch,armv6 armv7 armv7s,$(eval $(call build_ios,$(arch)))) define build_sim .PHONY: build-sim-$(1) @@ -80,11 +82,7 @@ $(foreach arch,i386,$(eval $(call build_sim,$(arch)))) .libs/%: build.mac-i386/.libs/% build.mac-x86_64/.libs/% build.ios-armv6/.libs/% @mkdir -p .libs - lipo -create -output $@ $^ - -.libs/%-ios.a: build.ios-armv6/.libs/%.a build.ios-armv7/.libs/%.a build.sim/.libs/%.a - @mkdir -p .libs - lipo -create -output $@ $^ + $(lipo) -create -output $@ $^ .libs/libcycript-sys.dylib: @mkdir -p .libs @@ -96,10 +94,10 @@ $(foreach arch,i386,$(eval $(call build_sim,$(arch)))) .libs/libcycript-%.o: build.%/.libs/libcycript.a @mkdir -p .libs - ld -r -arch $$(lipo -detailed_info $< | sed -e '/^Non-fat file: / ! d; s/.*: //') -o $@ -all_load $< libffi.a + ld -r -arch $$($(lipo) -detailed_info $< | sed -e '/^Non-fat file: / ! d; s/.*: //') -o $@ -all_load $< libffi.a -.libs/libcycript.o: .libs/libcycript-ios-armv6.o .libs/libcycript-ios-armv7.o .libs/libcycript-sim-i386.o - lipo -create -output $@ $^ +.libs/libcycript.o: .libs/libcycript-ios-armv6.o .libs/libcycript-ios-armv7.o .libs/libcycript-ios-armv7s.o .libs/libcycript-sim-i386.o + $(lipo) -create -output $@ $^ cycript: cycript.in cp -af $< $@ diff --git a/xcode.sh b/xcode.sh index 3144218..c04d8a7 100755 --- a/xcode.sh +++ b/xcode.sh @@ -73,13 +73,21 @@ 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 } for arch in i386; do build "sim-${arch}" iphonesimulator "-arch ${arch} -mios-simulator-version-min=2.0" OBJCXXFLAGS="-fobjc-abi-version=2 -fobjc-legacy-dispatch" CPPFLAGS="-I../libffi.${arch}/include" LDFLAGS="-L.." --disable-console done -for arch in armv6 armv7; do - build "ios-${arch}" iphoneos5.1 "-arch ${arch} -miphoneos-version-min=2.0" --host=arm-apple-darwin10 CPPFLAGS="-I../libffi.${arch}/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 armv6 armv7 armv7s; do + if [[ ${arch} == armv6 ]]; then + sdk=iphoneos5.1 + flg=() + else + sdk=iphoneos + flg=(--disable-console) + fi + + build "ios-${arch}" "${sdk}" "-arch ${arch} -miphoneos-version-min=2.0" --host=arm-apple-darwin10 CPPFLAGS="-I../libffi.${arch}/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" "${flg[@]}" done -- 2.45.2