Created
December 28, 2013 07:32
-
-
Save guanqun/8157011 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
From 1b2359182660a7e5907311510cdd1e0eee45b3fe Mon Sep 17 00:00:00 2001 | |
From: Rolando Abarca <m@rolando.cl> | |
Date: Thu, 25 Oct 2012 14:19:51 -0700 | |
Subject: [PATCH] squashed commits | |
--- | |
.gitignore | 2 + | |
js/src/aclocal.m4 | 1 + | |
js/src/build-ios/build_ios_static_fat.sh | 55 ++++++++++++++++++ | |
js/src/build/autoconf/ios.m4 | 95 ++++++++++++++++++++++++++++++++ | |
js/src/configure.in | 7 +++ | |
js/src/vm/NumericConversions.h | 2 +- | |
6 files changed, 161 insertions(+), 1 deletion(-) | |
create mode 100755 js/src/build-ios/build_ios_static_fat.sh | |
create mode 100644 js/src/build/autoconf/ios.m4 | |
diff --git a/.gitignore b/.gitignore | |
index b3fefef..3a36a4c 100644 | |
--- a/.gitignore | |
+++ b/.gitignore | |
@@ -37,6 +37,8 @@ js/src/autom4te.cache | |
# SpiderMonkey test result logs | |
js/src/tests/results-*.html | |
js/src/tests/results-*.txt | |
+# SpiderMonkey iOS byproducts | |
+js/src/build-ios/ | |
# Java HTML5 parser classes | |
parser/html/java/htmlparser/ | |
diff --git a/js/src/aclocal.m4 b/js/src/aclocal.m4 | |
index 7d6b28d..2f617bb 100644 | |
--- a/js/src/aclocal.m4 | |
+++ b/js/src/aclocal.m4 | |
@@ -23,6 +23,7 @@ builtin(include, build/autoconf/compiler-opts.m4)dnl | |
builtin(include, build/autoconf/expandlibs.m4)dnl | |
builtin(include, build/autoconf/arch.m4)dnl | |
builtin(include, build/autoconf/android.m4)dnl | |
+builtin(include, build/autoconf/ios.m4)dnl | |
builtin(include, build/autoconf/zlib.m4)dnl | |
builtin(include, build/autoconf/linux.m4)dnl | |
diff --git a/js/src/build-ios/build_ios_static_fat.sh b/js/src/build-ios/build_ios_static_fat.sh | |
new file mode 100755 | |
index 0000000..14fa0c9 | |
--- /dev/null | |
+++ b/js/src/build-ios/build_ios_static_fat.sh | |
@@ -0,0 +1,55 @@ | |
+#!/bin/sh | |
+ | |
+## this script is supposed to be run one directory below the original configure script | |
+## usually in build-ios | |
+ | |
+MIN_IOS_VERSION=4.3 | |
+IOS_SDK=6.0 | |
+ | |
+LIPO="xcrun -sdk iphoneos lipo" | |
+STRIP="xcrun -sdk iphoneos strip" | |
+ | |
+cpus=$(sysctl hw.ncpu | awk '{print $2}') | |
+ | |
+# create ios version (armv7) | |
+../configure --with-ios-target=iPhoneOS --with-ios-version=$IOS_SDK --with-ios-min-version=$MIN_IOS_VERSION --disable-shared-js --disable-tests --disable-ion --disable-jm --disable-tm --enable-llvm-hacks | |
+make -j$cpus | |
+if (( $? )) ; then | |
+ echo "error when compiling iOS version of the library" | |
+ exit | |
+fi | |
+mv libjs_static.a libjs_static.armv7.a | |
+ | |
+# create ios version (armv7s) | |
+../configure --with-ios-target=iPhoneOS --with-ios-version=$IOS_SDK --with-ios-min-version=$MIN_IOS_VERSION --with-ios-arch=armv7s --disable-shared-js --disable-tests --disable-ion --disable-jm --disable-tm --enable-llvm-hacks | |
+make -j$cpus | |
+if (( $? )) ; then | |
+ echo "error when compiling iOS version of the library" | |
+ exit | |
+fi | |
+mv libjs_static.a libjs_static.armv7s.a | |
+ | |
+# remove everything but the static library and this script | |
+ls | grep -v libjs_static.armv7.a | grep -v libjs_static.armv7s.a | grep -v build_ios_static_fat.sh | xargs rm -rf | |
+ | |
+# create i386 version (simulator) | |
+../configure --with-ios-target=iPhoneSimulator --with-ios-version=$IOS_SDK --with-ios-min-version=$MIN_IOS_VERSION --disable-shared-js --disable-tests --disable-ion --enable-llvm-hacks | |
+make -j$cpus | |
+if (( $? )) ; then | |
+ echo "error when compiling i386 (iOS Simulator) version of the library" | |
+ exit | |
+fi | |
+mv libjs_static.a libjs_static.i386.a | |
+ | |
+if [ -e libjs_static.i386.a ] && [ -e libjs_static.armv7.a ] ; then | |
+ echo "creating fat version of the library" | |
+ $LIPO -create -output libjs_static.a libjs_static.i386.a libjs_static.armv7.a libjs_static.armv7s.a | |
+ # remove debugging info | |
+ $STRIP -S libjs_static.a | |
+ $LIPO -info libjs_static.a | |
+fi | |
+ | |
+echo "*** DONE ***" | |
+echo "If you want to use spidermonkey, copy the 'dist' directory to some accesible place" | |
+echo "e.g. 'cp -pr dist ~/path/to/your/project'" | |
+echo "and then add the proper search paths for headers and libraries in your Xcode project" | |
diff --git a/js/src/build/autoconf/ios.m4 b/js/src/build/autoconf/ios.m4 | |
new file mode 100644 | |
index 0000000..f4cbeb2 | |
--- /dev/null | |
+++ b/js/src/build/autoconf/ios.m4 | |
@@ -0,0 +1,95 @@ | |
+dnl This Source Code Form is subject to the terms of the Mozilla Public | |
+dnl License, v. 2.0. If a copy of the MPL was not distributed with this | |
+dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. | |
+ | |
+dnl ======================================================== | |
+dnl = First test to make it work for iOS | |
+dnl = Xcode >= 4.3.1 required | |
+dnl ======================================================== | |
+ | |
+AC_DEFUN([MOZ_IOS_SDK], | |
+[ | |
+ | |
+MOZ_ARG_WITH_STRING(ios-version, | |
+[ --with-ios-version=VER | |
+ version of the iOS SDK, defaults to 6.0], | |
+ ios_sdk_version=$withval, | |
+ ios_sdk_version=6.0) | |
+ | |
+MOZ_ARG_WITH_STRING(ios-min-version, | |
+[ --with-ios-min-version=VER | |
+ deploy target version, defaults to 4.3], | |
+ ios_deploy_version=$withval, | |
+ ios_deploy_version=4.3) | |
+ | |
+MOZ_ARG_WITH_STRING(ios-arch, | |
+[ --with-ios-arch=ARCH | |
+ iOS architecture, defaults to armv7 for device, x86 for simulator], | |
+ ios_arch=$withval) | |
+ | |
+ | |
+case "$ios_target" in | |
+iPhoneOS|iPhoneSimulator) | |
+ dnl test for Xcode 4.3+ | |
+ if ! test -d "/Applications/Xcode.app/Contents/Developer/Platforms" ; then | |
+ AC_MSG_ERROR([You must install Xcode first from the App Store]) | |
+ fi | |
+ | |
+ if test "$ios_target" == "iPhoneSimulator" ; then | |
+ dnl force ios_arch to i386 for simulator | |
+ CPU_ARCH=i386 | |
+ ios_arch=i386 | |
+ target_name=x86 | |
+ target=i386-darwin | |
+ else | |
+ if test -z "$ios_arch" ; then | |
+ ios_arch=armv7 | |
+ fi | |
+ target_name=arm | |
+ target=arm-darwin | |
+ fi | |
+ target_os=darwin | |
+ | |
+ xcode_base="/Applications/Xcode.app/Contents/Developer/Platforms" | |
+ ios_sdk_root="" | |
+ ios_toolchain="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin" | |
+ | |
+ dnl test to see if the actual sdk exists | |
+ ios_sdk_root="$xcode_base"/$ios_target.platform/Developer/SDKs/$ios_target"$ios_sdk_version".sdk | |
+ if ! test -d "$ios_sdk_root" ; then | |
+ AC_MSG_ERROR([Invalid SDK version]) | |
+ fi | |
+ | |
+ dnl set the compilers | |
+ AS="$ios_toolchain"/as | |
+ CC="$ios_toolchain"/clang | |
+ CXX="$ios_toolchain"/clang++ | |
+ CPP="$ios_toolchain/clang -E" | |
+ LD="$ios_toolchain"/ld | |
+ AR="$ios_toolchain"/ar | |
+ RANLIB="$ios_toolchain"/ranlib | |
+ STRIP="$ios_toolchain"/strip | |
+ LDFLAGS="-isysroot $ios_sdk_root -arch $ios_arch -v" | |
+ | |
+ CFLAGS="-isysroot $ios_sdk_root -arch $ios_arch -miphoneos-version-min=$ios_deploy_version -I$ios_sdk_root/usr/include -pipe -Wno-implicit-int -Wno-return-type" | |
+ CXXFLAGS="$CFLAGS" | |
+ CPPFLAGS="" | |
+ | |
+ dnl prevent cross compile section from using these flags as host flags | |
+ if test -z "$HOST_CPPFLAGS" ; then | |
+ HOST_CPPFLAGS=" " | |
+ fi | |
+ if test -z "$HOST_CFLAGS" ; then | |
+ HOST_CFLAGS=" " | |
+ fi | |
+ if test -z "$HOST_CXXFLAGS" ; then | |
+ HOST_CXXFLAGS=" " | |
+ fi | |
+ if test -z "$HOST_LDFLAGS" ; then | |
+ HOST_LDFLAGS=" " | |
+ fi | |
+ | |
+ AC_DEFINE(IPHONEOS) | |
+ CROSS_COMPILE=1 | |
+esac | |
+]) | |
diff --git a/js/src/configure.in b/js/src/configure.in | |
index e25f569..1909845 100644 | |
--- a/js/src/configure.in | |
+++ b/js/src/configure.in | |
@@ -155,6 +155,11 @@ MOZ_ARG_WITH_STRING(gonk-toolchain-prefix, | |
prefix to gonk toolchain commands], | |
gonk_toolchain_prefix=$withval) | |
+MOZ_ARG_WITH_STRING(ios-target, | |
+[ --with-ios-target=SDK | |
+ what target sdk to use, defaults to iPhoneSimulator], | |
+ ios_target=$withval) | |
+ | |
if test -n "$gonkdir" ; then | |
kernel_name=`uname -s | tr "[[:upper:]]" "[[:lower:]]"` | |
@@ -206,6 +211,8 @@ if test -n "$gonkdir" ; then | |
AC_DEFINE(ANDROID) | |
AC_DEFINE(GONK) | |
CROSS_COMPILE=1 | |
+elif test -n "$ios_target" ; then | |
+ MOZ_IOS_SDK | |
else | |
MOZ_ANDROID_NDK | |
fi | |
diff --git a/js/src/vm/NumericConversions.h b/js/src/vm/NumericConversions.h | |
index 24b7dbf..3c77371 100644 | |
--- a/js/src/vm/NumericConversions.h | |
+++ b/js/src/vm/NumericConversions.h | |
@@ -154,7 +154,7 @@ ToIntWidth(double d) | |
inline int32_t | |
ToInt32(double d) | |
{ | |
-#if defined (__arm__) && defined (__GNUC__) | |
+#if defined (__arm__) && defined (__GNUC__) && !defined(__clang__) | |
int32_t i; | |
uint32_t tmp0; | |
uint32_t tmp1; | |
-- | |
1.8.0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment