1
0
forked from 0ad/0ad

android/setup-libs.sh: move to posix shell

Convert various non posix consturcts and change shebang to /bin/sh

Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
Ralph Sennhauser 2024-08-28 19:20:51 +02:00
parent 2634f8762e
commit 3564512a63

View File

@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/sh
set -e
set -o nounset
@ -21,11 +21,11 @@ build_js185=true
JOBS=${JOBS:="-j4"}
SYSROOT=$TOOLCHAIN/sysroot
export PATH=$TOOLCHAIN/bin:$PATH
export PATH="$TOOLCHAIN/bin:$PATH"
CFLAGS="-mandroid -mthumb -mcpu=cortex-a9 -mfpu=neon -mfloat-abi=softfp"
mkdir -p files
pushd files
cd 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
@ -59,7 +59,7 @@ if [ ! -e libxml2-2.7.8.tar.gz ]; then
wget ftp://xmlsoft.org/libxml2/libxml2-2.7.8.tar.gz
fi
popd
cd -
if [ "$build_toolchain" = "true" ]; then
@ -71,12 +71,12 @@ if [ "$build_toolchain" = "true" ]; then
# 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-}"
ln -sf "$f" "$(printf '%s' "$f" | sed "s/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-}"
ln -sf "$f" "$(printf '%s' "$f" | sed "s/arm-linux-androideabi-/arm-linux-eabi-/")"
done
fi
@ -88,68 +88,68 @@ if [ "$build_boost" = "true" ]; then
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
cd temp/MysticTreeGames-Boost-for-Android-70838fc
./build-android.sh "$TOOLCHAIN"
cp -rv build/{include,lib} "$SYSROOT"/usr/local/
popd
cp -rv build/include build/lib "$SYSROOT"/usr/local/
cd -
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
cd 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
cd -
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
cd temp/libpng-1.5.8
./configure --host=arm-linux-eabi --with-sysroot="$SYSROOT" --prefix="$SYSROOT"/usr/local CFLAGS="$CFLAGS"
make "$JOBS"
make install
popd
cd -
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
cd 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
cd -
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
cd temp/libxml2-2.7.8
./configure --host=arm-linux-eabi --with-sysroot="$SYSROOT" --prefix="$SYSROOT"/usr/local CFLAGS="$CFLAGS"
make "$JOBS"
make install
popd
cd -
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
cd temp/enet-1.3.3
./configure --host=arm-linux-eabi --with-sysroot="$SYSROOT" --prefix="$SYSROOT"/usr/local CFLAGS="$CFLAGS"
make "$JOBS"
make install
popd
cd -
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
cd 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 \
@ -165,5 +165,5 @@ if [ "$build_js185" = "true" ]; then
CFLAGS="$CFLAGS"
make "$JOBS" JS_DISABLE_SHELL=1
make install JS_DISABLE_SHELL=1
popd
cd -
fi