SFML/tools/android/compile_libs.sh
2024-06-11 13:56:14 +02:00

60 lines
1.8 KiB
Bash

#!/usr/bin/env bash
DESTDIR=$PWD/tmp
LOCALDIR=$PWD
OPATH=$PATH
export PATH=$2
export CC=$3
export CXX=$4
export CFLAGS=$5
export CPPFLAGS=$6
export LDFLAGS=$7
if [ "$1" = "arm" ]
then
ARCH=arm-linux
ANDROID_ABI=armeabi
elif [ "$1" = "arm-v7a" ]
then
ARCH=arm-linux
ANDROID_ABI=armeabi-v7a
elif [ "$1" = "x86" ]
then
ARCH=i686-linux
ANDROID_ABI=x86
elif [ "$1" = "mips" ]
then
ARCH=mips-linux
ANDROID_ABI=mips
fi
HOST="--host=$ARCH"
PREFIX="--prefix=$DESTDIR/$1/usr need_version=no"
# Compile OGG
cd $LOCALDIR/build/libogg-* && sed -i 's/-version-info/-avoid-version/g' src/Makefile.in src/Makefile.am && ./configure $HOST $PREFIX --enable-shared=no && make && make install
rm $DESTDIR/$1/usr/lib/libogg*.so*
# Compile FLAC
cd $LOCALDIR/build/flac-* && sed -i 's/-version-info/-avoid-version/g' src/libFLAC/Makefile.in src/libFLAC/Makefile.am && ./configure $HOST $PREFIX --enable-shared=no && make && make install
rm $DESTDIR/$1/usr/lib/libFLAC*.so*
# Compile VORBIS
cd $LOCALDIR/build/libvorbis-* && sed -i 's/-version-info/-avoid-version/g' lib/Makefile.in lib/Makefile.am && ./configure $HOST $PREFIX --enable-shared=no && make && make install
rm $DESTDIR/$1/usr/lib/libvorbis*.so*
# Compile OPUS and OPUSFILE
cd $LOCALDIR/build/opus-* && sed -i 's/-version-info/-avoid-version/g' Makefile.in Makefile.am && ./configure $HOST $PREFIX --enable-shared=no && make && make install
cd $LOCALDIR/build/opusfile-* && sed -i 's/-version-info/-avoid-version/g' Makefile.in Makefile.am && ./configure $HOST $PREFIX --enable-shared=no && make && make install
rm $DESTDIR/$1/usr/lib/libopus*.so*
# Compile freetype
cd $LOCALDIR/build/freetype-* && sed -i 's/-version-info/-avoid-version/g' builds/unix/unix-cc.in && ./configure $HOST $PREFIX && make && make install
export PATH=$OPATH