This repository has been archived by the owner on Dec 1, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 153
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
5 changed files
with
226 additions
and
4 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,115 @@ | ||
# options | ||
develop= | ||
release= | ||
RELEASE_DIR="spidermonkey-android" | ||
|
||
usage(){ | ||
cat << EOF | ||
usage: $0 [options] | ||
Build SpiderMonkey using Android NDK | ||
OPTIONS: | ||
-d Build for development | ||
-r Build for release. specify RELEASE_DIR. | ||
-h this help | ||
EOF | ||
} | ||
|
||
while getopts "drh" OPTION; do | ||
case "$OPTION" in | ||
d) | ||
develop=1 | ||
;; | ||
r) | ||
release=1 | ||
;; | ||
h) | ||
usage | ||
exit 0 | ||
;; | ||
esac | ||
done | ||
|
||
set -x | ||
|
||
host_os=`uname -s | tr "[:upper:]" "[:lower:]"` | ||
host_arch=`uname -m` | ||
|
||
build_with_arch() | ||
{ | ||
|
||
NDK_ROOT=$HOME/bin/android-ndk | ||
|
||
rm -rf dist | ||
rm -f ./config.cache | ||
|
||
../configure --with-android-ndk=$NDK_ROOT \ | ||
--with-android-sdk=$HOME/bin/android-sdk \ | ||
--with-android-toolchain=$NDK_ROOT/toolchains/${TOOLS_ARCH}-${GCC_VERSION}/prebuilt/${host_os}-${host_arch} \ | ||
--with-android-version=9 \ | ||
--enable-application=mobile/android \ | ||
--with-android-gnu-compiler-version=${GCC_VERSION} \ | ||
--with-arch=${CPU_ARCH} \ | ||
--enable-android-libstdcxx \ | ||
--target=${TARGET_NAME} \ | ||
--disable-shared-js \ | ||
--disable-tests \ | ||
--enable-strip \ | ||
--enable-install-strip \ | ||
--disable-debug | ||
|
||
# make | ||
make -j15 | ||
|
||
if [[ $develop ]]; then | ||
rm ../../../include | ||
rm ../../../lib | ||
|
||
ln -s -f "$PWD"/dist/include ../../.. | ||
ln -s -f "$PWD"/dist/lib ../../.. | ||
fi | ||
|
||
if [[ $release ]]; then | ||
# copy specific files from dist | ||
rm -r "$RELEASE_DIR/include" | ||
rm -r "$RELEASE_DIR/lib/$RELEASE_ARCH_DIR" | ||
mkdir -p "$RELEASE_DIR/include" | ||
cp -RL dist/include/* "$RELEASE_DIR/include/" | ||
mkdir -p "$RELEASE_DIR/lib/$RELEASE_ARCH_DIR" | ||
cp -L dist/lib/libjs_static.a "$RELEASE_DIR/lib/$RELEASE_ARCH_DIR/libjs_static.a" | ||
|
||
# strip unneeded symbols | ||
$HOME/bin/android-ndk/toolchains/${TOOLS_ARCH}-${GCC_VERSION}/prebuilt/${host_os}-${host_arch}/bin/${TOOLNAME_PREFIX}-strip \ | ||
--strip-unneeded "$RELEASE_DIR/lib/$RELEASE_ARCH_DIR/libjs_static.a" | ||
fi | ||
|
||
} | ||
|
||
# Build with armv6 | ||
TOOLS_ARCH=arm-linux-androideabi | ||
TARGET_NAME=arm-linux-androideabi | ||
CPU_ARCH=armv6 | ||
RELEASE_ARCH_DIR=armeabi | ||
GCC_VERSION=4.6 | ||
TOOLNAME_PREFIX=arm-linux-androideabi | ||
build_with_arch | ||
|
||
# Build with armv7 | ||
TOOLS_ARCH=arm-linux-androideabi | ||
TARGET_NAME=arm-linux-androideabi | ||
CPU_ARCH=armv7-a | ||
RELEASE_ARCH_DIR=armeabi-v7a | ||
GCC_VERSION=4.6 | ||
TOOLNAME_PREFIX=arm-linux-androideabi | ||
build_with_arch | ||
|
||
# Build with x86 | ||
TOOLS_ARCH=x86 | ||
TARGET_NAME=i686-linux-android | ||
CPU_ARCH=i686 | ||
RELEASE_ARCH_DIR=x86 | ||
GCC_VERSION=4.6 | ||
TOOLNAME_PREFIX=i686-linux-android | ||
build_with_arch |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
#!/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.1 | ||
|
||
LIPO="xcrun -sdk iphoneos lipo" | ||
STRIP="xcrun -sdk iphoneos strip" | ||
|
||
cpus=$(sysctl hw.ncpu | awk '{print $2}') | ||
|
||
# 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.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 --enable-debug | ||
../configure --with-ios-target=iPhoneSimulator --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 --disable-methodjit --disable-monoic --disable-polyic \ | ||
--enable-optimize=-O3 --enable-strip --enable-install-strip \ | ||
--enable-debug | ||
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 | ||
|
||
|
||
# | ||
# create ios version (armv7) | ||
# | ||
../configure --with-ios-target=iPhoneOS --with-ios-version=$IOS_SDK --with-ios-min-version=$MIN_IOS_VERSION --with-ios-arch=armv7 \ | ||
--disable-shared-js --disable-tests --disable-ion --disable-jm --disable-tm --enable-llvm-hacks --disable-methodjit --disable-monoic --disable-polyic \ | ||
--enable-optimize=-O3 --with-thumb=yes --enable-strip --enable-install-strip | ||
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 --disable-methodjit --with-thumb=yes --enable-strip --enable-install-strip --disable-monoic --disable-polyic --disable-ion --enable-optimize=-O1 | ||
../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 --disable-methodjit --disable-monoic --disable-polyic \ | ||
--enable-optimize=-O3 --with-thumb=yes --enable-strip --enable-install-strip | ||
make -j$cpus | ||
if (( $? )) ; then | ||
echo "error when compiling iOS version of the library" | ||
exit | ||
fi | ||
mv libjs_static.a libjs_static.armv7s.a | ||
|
||
|
||
# | ||
# lipo create | ||
# | ||
if [ -e libjs_static.i386.a ] && [ -e libjs_static.armv7.a ] && [ -e libjs_static.armv7s.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 | ||
|
||
# | ||
# done | ||
# | ||
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" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
#!/bin/sh | ||
|
||
cpus=$(sysctl hw.ncpu | awk '{print $2}') | ||
|
||
# configure | ||
../configure --disable-tests --disable-shared-js \ | ||
--enable-strip --enable-strip-install \ | ||
--disable-root-analysis --disable-exact-rooting --enable-gcincremental --enable-optimize=-O3 \ | ||
--enable-llvm-hacks \ | ||
--enable-debug | ||
# make | ||
make -j$cpus | ||
|
||
# strip | ||
strip -S libjs_static.a | ||
|
||
# info | ||
lipo -info libjs_static.a | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#!/bin/sh | ||
|
||
# configure | ||
../configure --disable-tests \ | ||
--disable-debug | ||
|
||
# make | ||
make -j4 |