1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170
|
#!/bin/bash
set -e
set -o nounset
ANDROID=$HOME/android
NDK=$ANDROID/android-ndk-r8-crystax-1
SDK=$ANDROID/android-sdk-linux
TOOLCHAIN=$ANDROID/toolchain-0ad
build_toolchain=true
build_boost=true
build_curl=true
build_libpng=true
build_libjpeg=true
build_libxml2=true
build_enet=true
build_js185=true
JOBS=${JOBS:="-j4"}
SYSROOT=$TOOLCHAIN/sysroot
export PATH=$TOOLCHAIN/bin:$PATH
CFLAGS="-mandroid -mthumb -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp"
mkdir -p files
pushd files
if [ ! -e boost_1_45_0.tar.bz2 ]; then
wget http://downloads.sourceforge.net/project/boost/boost/1.45.0/boost_1_45_0.tar.bz2
fi
if [ ! -e curl-7.33.0.tar.bz2 ]; then
wget http://curl.haxx.se/download/curl-7.33.0.tar.bz2
fi
if [ ! -e MysticTreeGames-Boost-for-Android-70838fc.tar.gz ]; then
wget https://github.com/MysticTreeGames/Boost-for-Android/tarball/70838fcfba930646cac724a77f5c626e930431f6 -O MysticTreeGames-Boost-for-Android-70838fc.tar.gz
fi
if [ ! -e enet-1.3.3.tar.gz ]; then
wget http://enet.bespin.org/download/enet-1.3.3.tar.gz
fi
if [ ! -e js185-1.0.0.tar.gz ]; then
cp ../../../libraries/source/spidermonkey/js185-1.0.0.tar.gz .
fi
if [ ! -e libjpeg-turbo-1.3.0.tar.gz ]; then
wget http://downloads.sourceforge.net/project/libjpeg-turbo/1.3.0/libjpeg-turbo-1.3.0.tar.gz
fi
if [ ! -e libpng-1.5.8.tar.xz ]; then
wget http://prdownloads.sourceforge.net/libpng/libpng-1.5.8.tar.xz
fi
if [ ! -e libxml2-2.7.8.tar.gz ]; then
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz
fi
popd
if [ "$build_toolchain" = "true" ]; then
rm -r $TOOLCHAIN || true
$NDK/build/tools/make-standalone-toolchain.sh --platform=android-14 --toolchain=arm-linux-androideabi-4.6 --install-dir=$TOOLCHAIN --system=linux-x86_64
mkdir -p $SYSROOT/usr/local
# Set up some symlinks to make the SpiderMonkey build system happy
ln -sfT ../platforms $NDK/build/platforms
for f in $TOOLCHAIN/bin/arm-linux-androideabi-*; do
ln -sf $f ${f/arm-linux-androideabi-/arm-eabi-}
done
# Set up some symlinks for the typical autoconf-based build systems
for f in $TOOLCHAIN/bin/arm-linux-androideabi-*; do
ln -sf $f ${f/arm-linux-androideabi-/arm-linux-eabi-}
done
fi
mkdir -p temp
if [ "$build_boost" = "true" ]; then
rm -rf temp/MysticTreeGames-Boost-for-Android-70838fc
tar xvf files/MysticTreeGames-Boost-for-Android-70838fc.tar.gz -C temp/
cp files/boost_1_45_0.tar.bz2 temp/MysticTreeGames-Boost-for-Android-70838fc/
patch temp/MysticTreeGames-Boost-for-Android-70838fc/build-android.sh < boost-android-build.patch
pushd temp/MysticTreeGames-Boost-for-Android-70838fc
./build-android.sh $TOOLCHAIN
cp -rv build/{include,lib} $SYSROOT/usr/local/
popd
fi
if [ "$build_curl" = "true" ]; then
rm -rf temp/curl-7.33.0
tar xvf files/curl-7.33.0.tar.bz2 -C temp/
pushd temp/curl-7.33.0
./configure --host=arm-linux-androideabi --with-sysroot=$SYSROOT --prefix=$SYSROOT/usr/local CFLAGS="$CFLAGS" LDFLAGS="-lm" --disable-shared
make -j3
make install
popd
fi
if [ "$build_libpng" = "true" ]; then
rm -rf temp/libpng-1.5.8
tar xvf files/libpng-1.5.8.tar.xz -C temp/
pushd temp/libpng-1.5.8
./configure --host=arm-linux-eabi --with-sysroot=$SYSROOT --prefix=$SYSROOT/usr/local CFLAGS="$CFLAGS"
make $JOBS
make install
popd
fi
if [ "$build_libjpeg" = "true" ]; then
rm -rf temp/libjpeg-turbo-1.3.0
tar xvf files/libjpeg-turbo-1.3.0.tar.gz -C temp/
pushd temp/libjpeg-turbo-1.3.0
./configure --host=arm-linux-eabi --with-sysroot=$SYSROOT --prefix=$SYSROOT/usr/local CFLAGS="$CFLAGS" LDFLAGS="-lm"
make $JOBS
make install
popd
fi
if [ "$build_libxml2" = "true" ]; then
rm -rf temp/libxml2-2.7.8
tar xvf files/libxml2-2.7.8.tar.gz -C temp/
patch temp/libxml2-2.7.8/Makefile.in < libxml2-android-build.patch
pushd temp/libxml2-2.7.8
./configure --host=arm-linux-eabi --with-sysroot=$SYSROOT --prefix=$SYSROOT/usr/local CFLAGS="$CFLAGS"
make $JOBS
make install
popd
fi
if [ "$build_enet" = "true" ]; then
rm -rf temp/enet-1.3.3
tar xvf files/enet-1.3.3.tar.gz -C temp/
pushd temp/enet-1.3.3
./configure --host=arm-linux-eabi --with-sysroot=$SYSROOT --prefix=$SYSROOT/usr/local CFLAGS="$CFLAGS"
make $JOBS
make install
popd
fi
if [ "$build_js185" = "true" ]; then
rm -rf temp/js-1.8.5
tar xvf files/js185-1.0.0.tar.gz -C temp/
patch temp/js-1.8.5/js/src/assembler/wtf/Platform.h < js185-android-build.patch
pushd temp/js-1.8.5/js/src
CXXFLAGS="-I $TOOLCHAIN/arm-linux-androideabi/include/c++/4.4.3/arm-linux-androideabi" \
HOST_CXXFLAGS="-DFORCE_LITTLE_ENDIAN" \
./configure \
--prefix=$SYSROOT/usr/local \
--target=arm-android-eabi \
--with-android-ndk=$NDK \
--with-android-sdk=$SDK \
--with-android-toolchain=$TOOLCHAIN \
--with-android-version=9 \
--disable-tests \
--disable-shared-js \
--with-arm-kuser \
CFLAGS="$CFLAGS"
make $JOBS JS_DISABLE_SHELL=1
make install JS_DISABLE_SHELL=1
popd
fi
|