]> git.saurik.com Git - cycript.git/commitdiff
Build i386 and x86_64 architectures separately.
authorJay Freeman (saurik) <saurik@saurik.com>
Tue, 10 Sep 2013 06:28:50 +0000 (23:28 -0700)
committerJay Freeman (saurik) <saurik@saurik.com>
Tue, 10 Sep 2013 06:28:50 +0000 (23:28 -0700)
Makefile.am
Makefile.in
configure
configure.ac
xcode.mk
xcode.sh

index 2c136636af77242e7973a6de01b8c644adfeb79b..40f1d4a3463996fadf1d598552fd6a3508ef7b4a 100644 (file)
@@ -94,11 +94,11 @@ Mach/Inject.$(OBJEXT): Trampoline.t.hpp
 
 CLEANFILES += Trampoline.t.lo
 Trampoline.t.lo: Trampoline.t.cpp Trampoline.hpp Baton.hpp Standard.hpp
-       $(LTCXXCOMPILE) -c -o $@ $< -fno-stack-protector -fno-exceptions -O0
+       $(LTCXXCOMPILE) $(CY_ARCH) -c -o $@ $< -fno-stack-protector -O0
 
 CLEANFILES += libTrampoline.t.la
 libTrampoline.t.la: Trampoline.t.lo
-       $(CXXLINK) -rpath $(libdir) $^
+       $(CXXLINK) $(CY_ARCH) -rpath $(libdir) $^
 
 CLEANFILES += Trampoline.t.hpp
 Trampoline.t.hpp: libTrampoline.t.la trampoline.sh
index 8036ab11a5c2116f820eea31ef96a45fb50e2eb1..2ffd5d5b150e1a0ccf1ddbc51fdf8314bf7b2d33 100644 (file)
@@ -391,6 +391,7 @@ CXXCPP = @CXXCPP@
 CXXDEPMODE = @CXXDEPMODE@
 CXXFLAGS = @CXXFLAGS@
 CYGPATH_W = @CYGPATH_W@
+CY_ARCH = @CY_ARCH@
 CY_ATTACH_GROUP = @CY_ATTACH_GROUP@
 CY_EXECUTE = @CY_EXECUTE@
 CY_FILTERS = @CY_FILTERS@
@@ -1320,9 +1321,9 @@ uninstall-am: uninstall-binPROGRAMS uninstall-libLTLIBRARIES
 
 @CY_CONSOLE_TRUE@@CY_MACH_TRUE@Mach/Inject.$(OBJEXT): Trampoline.t.hpp
 @CY_CONSOLE_TRUE@@CY_MACH_TRUE@Trampoline.t.lo: Trampoline.t.cpp Trampoline.hpp Baton.hpp Standard.hpp
-@CY_CONSOLE_TRUE@@CY_MACH_TRUE@        $(LTCXXCOMPILE) -c -o $@ $< -fno-stack-protector -fno-exceptions -O0
+@CY_CONSOLE_TRUE@@CY_MACH_TRUE@        $(LTCXXCOMPILE) $(CY_ARCH) -c -o $@ $< -fno-stack-protector -O0
 @CY_CONSOLE_TRUE@@CY_MACH_TRUE@libTrampoline.t.la: Trampoline.t.lo
-@CY_CONSOLE_TRUE@@CY_MACH_TRUE@        $(CXXLINK) -rpath $(libdir) $^
+@CY_CONSOLE_TRUE@@CY_MACH_TRUE@        $(CXXLINK) $(CY_ARCH) -rpath $(libdir) $^
 @CY_CONSOLE_TRUE@@CY_MACH_TRUE@Trampoline.t.hpp: libTrampoline.t.la trampoline.sh
 @CY_CONSOLE_TRUE@@CY_MACH_TRUE@        $(srcdir)/trampoline.sh $@ .libs/libTrampoline.t.dylib Trampoline $(SED) $(LIPO) $(NM) $(OTOOL)
 @CY_CONSOLE_TRUE@@CY_MACH_TRUE@        ! grep '## symbol stub for:' $@
index 5e52ff86bd4eff7aeb1efa11ff86cb02cc9d231d..ddf785ad97467557d5bc2bf690392e8cb55ba891 100755 (executable)
--- a/configure
+++ b/configure
@@ -669,6 +669,7 @@ LTJAVASCRIPTCORE
 WEBKIT_LIBS
 WEBKIT_CFLAGS
 CY_EXECUTE
+CY_ARCH
 CY_FILTERS
 GNUTAR
 GPERF
@@ -3158,10 +3159,6 @@ fi
 
 
 
-am_cv_CC_dependencies_compiler_type=none
-am_cv_CXX_dependencies_compiler_type=none
-am_cv_OBJCXX_dependencies_compiler_type=none
-
 ac_ext=c
 ac_cpp='$CPP $CPPFLAGS'
 ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
@@ -18334,6 +18331,90 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
 
 
 
+for cy_arch in ppc ppc64 i386 x86_64 armv6; do
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -arch $cy_arch" >&5
+$as_echo_n "checking for -arch $cy_arch... " >&6; }
+
+    cy_save=$CXXFLAGS
+
+  for element in "-arch $cy_arch"; do
+    haveit=
+    for x in $CXXFLAGS; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CXXFLAGS="${CXXFLAGS}${CXXFLAGS:+ }$element"
+    fi
+  done
+
+
+        cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_cxx_try_link "$LINENO"; then :
+  cy_good=1
+else
+  cy_good=0
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext conftest.$ac_ext
+
+    CXXFLAGS=$cy_save
+    if test "x$cy_good" = x1; then :
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
+$as_echo "yes" >&6; }
+
+  for element in "-arch $cy_arch"; do
+    haveit=
+    for x in $CY_ARCH; do
+
+  acl_save_prefix="$prefix"
+  prefix="$acl_final_prefix"
+  acl_save_exec_prefix="$exec_prefix"
+  exec_prefix="$acl_final_exec_prefix"
+  eval x=\"$x\"
+  exec_prefix="$acl_save_exec_prefix"
+  prefix="$acl_save_prefix"
+
+      if test "X$x" = "X$element"; then
+        haveit=yes
+        break
+      fi
+    done
+    if test -z "$haveit"; then
+      CY_ARCH="${CY_ARCH}${CY_ARCH:+ }$element"
+    fi
+  done
+
+
+else
+  { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
+$as_echo "no" >&6; }
+fi
+
+done
+
+
 
 
 
index 201f626f58a75460a30ea9f3880430ae659472be..0a72e83ebd508d1280f1c41b50498dd7af0d4a02 100644 (file)
@@ -29,11 +29,6 @@ AC_CONFIG_HEADERS([config.h])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign])
 AM_MAINTAINER_MODE([disable])
 
-dnl XXX: do this only on Mac OS X
-am_cv_CC_dependencies_compiler_type=none
-am_cv_CXX_dependencies_compiler_type=none
-am_cv_OBJCXX_dependencies_compiler_type=none
-
 AC_PROG_CC
 AC_PROG_CXX
 AC_PROG_OBJCXX
@@ -150,6 +145,19 @@ AC_DEFUN([CY_LT_LIB], [
     AC_SUBST(]$1[)
 ])
 
+dnl -arch * {{{
+for cy_arch in ppc ppc64 i386 x86_64 armv6; do
+    AC_MSG_CHECKING([for -arch $cy_arch])
+    CY_TRY([CXXFLAGS], ["-arch $cy_arch"], [
+        AC_TRY_LINK([], [], [CY_SUCCESS], [CY_FAILURE])
+    ], [
+        AC_MSG_RESULT([yes])
+        AC_LIB_APPENDTOVAR([CY_ARCH], ["-arch $cy_arch"])
+    ], [AC_MSG_RESULT([no])])
+done
+AC_SUBST([CY_ARCH])
+dnl }}}
+
 dnl --enable-javascript {{{
 AC_DEFUN([CY_CHECK_JAVASCRIPTCORE], [
     CY_LT_LIB([LTJAVASCRIPTCORE], [AC_CHECK_FRAMEWORK([JavaScriptCore], [
index 22716521c8be1cc09bbeb655ee25cb9fdfc6f9ad..a112e9bbe81eb9f401e1a580fee28b445678e71b 100644 (file)
--- a/xcode.mk
+++ b/xcode.mk
@@ -33,44 +33,56 @@ all: cycript $(libs)
 clean:
        rm -rf cycript .libs
 
-build-mac:
-       $(MAKE) -C build.mac
-
-build-ios:
-       $(MAKE) -C build.ios
-
-build-sim:
-       $(MAKE) -C build.sim
-
 # make stubbornly refuses to believe that these @'s are bugs
 # http://osdir.com/ml/help-make-gnu/2012-04/msg00008.html
 
-build.mac/.libs/cycript: build-mac
+define build_mac
+.PHONY: build-mac-$(1)
+build-mac-$(1):
+       $(MAKE) -C build.mac-$(1)
+build.mac-$(1)/.libs/cycript: build-mac-$(1)
        @
-build.mac/.libs/libcycript.dylib: build-mac
+build.mac-$(1)/.libs/libcycript.dylib: build-mac-$(1)
        @
-build.mac/.libs/libcycript-any.dylib: build-mac
+build.mac-$(1)/.libs/libcycript-any.dylib: build-mac-$(1)
        @
+endef
 
-build.ios/.libs/cycript: build-ios
+$(foreach arch,i386 x86_64,$(eval $(call build_mac,$(arch))))
+
+define build_ios
+.PHONY: build-ios-$(1)
+build-ios-$(1):
+       $(MAKE) -C build.ios-$(1)
+build.ios-$(1)/.libs/cycript: build-ios-$(1)
        @
-build.ios/.libs/libcycript.dylib: build-ios
+build.ios-$(1)/.libs/libcycript.dylib: build-ios-$(1)
        @
-build.ios/.libs/libcycript-any.dylib: build-ios
+build.ios-$(1)/.libs/libcycript-any.dylib: build-ios-$(1)
        @
-build.ios/.libs/libcycript.a: build-ios
+build.ios-$(1)/.libs/libcycript.a: build-ios-$(1)
        @
+endef
+
+$(foreach arch,armv6 armv7,$(eval $(call build_ios,$(arch))))
 
-build.sim/.libs/libcycript.dylib: build-sim
+define build_sim
+.PHONY: build-sim-$(1)
+build-sim-$(1):
+       $(MAKE) -C build.sim-$(1)
+build.sim-$(1)/.libs/libcycript.dylib: build-sim-$(1)
        @
-build.sim/.libs/libcycript.a: build-sim
+build.sim-$(1)/.libs/libcycript.a: build-sim-$(1)
        @
+endef
+
+$(foreach arch,i386,$(eval $(call build_sim,$(arch))))
 
-.libs/%: build.mac/.libs/% build.ios/.libs/%
+.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/.libs/%.a build.sim/.libs/%.a
+.libs/%-ios.a: build.ios-armv6/.libs/%.a build.ios-armv7/.libs/%.a build.sim/.libs/%.a
        @mkdir -p .libs
        lipo -create -output $@ $^
 
@@ -78,7 +90,7 @@ build.sim/.libs/libcycript.a: build-sim
        @mkdir -p .libs
        ln -sf libcycript.dylib $@
 
-.libs/libcycript-sim.dylib: build.sim/.libs/libcycript.dylib
+.libs/libcycript-sim.dylib: build.sim-i386/.libs/libcycript.dylib
        @mkdir -p .libs
        cp -af $< $@
 
@@ -86,11 +98,11 @@ build.sim/.libs/libcycript.a: build-sim
        @mkdir -p .libs
        ld -r -arch $$(lipo -detailed_info $< | sed -e '/^Non-fat file: / ! d; s/.*: //') -o $@ -all_load $< libffi.a
 
-.libs/libcycript.o: .libs/libcycript-ios.o .libs/libcycript-sim.o
+.libs/libcycript.o: .libs/libcycript-ios-armv6.o .libs/libcycript-ios-armv7.o .libs/libcycript-sim-i386.o
        lipo -create -output $@ $^
 
 cycript: cycript.in
        cp -af $< $@
        chmod 755 $@
 
-.PHONY: all clean build-mac build-ios build-sim
+.PHONY: all clean
index de4e5ab0012784c63d69c0201845ca031c640106..3144218f8c8a2a5932d65dc615bb7a944e05b78a 100755 (executable)
--- a/xcode.sh
+++ b/xcode.sh
@@ -63,7 +63,9 @@ function configure() {
     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
@@ -74,5 +76,10 @@ function build() {
     configure "${dir}" "${sdk}" "${flg}" "$@" --enable-static --with-pic #CPPFLAGS="-idirafter ${mac}/usr/include"
 }
 
-build sim iphonesimulator "-arch i386 -mios-simulator-version-min=2.0" 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; 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"
+done