Last active
December 3, 2020 17:53
-
-
Save derselbst/88917bf177d25cfc1067a37b442dd5ff to your computer and use it in GitHub Desktop.
Script for cross compiling fluidsynth for Android
This file contains hidden or 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
#!/bin/bash | |
# Android cross-compile environment setup script for Fluidsynth, Glib and dependencies | |
# Author : Tom Moebert | |
# Date : 2018-09-06 | |
# License : CC0 1.0 Universal | |
# If you have questions or need support, contact our mailing list: | |
# https://lists.nongnu.org/mailman/listinfo/fluid-dev | |
set -ex | |
# Create a standalone toolchain first, see https://developer.android.com/ndk/guides/standalone_toolchain | |
${NDK}/build/tools/make_standalone_toolchain.py --arch ${ANDROID_ARCH} --api ${ANDROID_API} --stl=libc++ --install-dir=${NDK_TOOLCHAIN} | |
wget http://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.14.tar.gz | |
tar zxvf libiconv-1.14.tar.gz | |
pushd libiconv-1.14 | |
./configure --host=${TARGET} --prefix=${PREFIX} --disable-rpath | |
make -j4 | |
make install | |
popd | |
wget ftp://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz | |
tar zxvf libffi-3.2.1.tar.gz | |
pushd libffi-3.2.1 | |
# install headers into the conventional ${PREFIX}/include rather than ${PREFIX}/lib/libffi-3.2.1/include. | |
sed -e '/^includesdir/ s/$(libdir).*$/$(includedir)/' -i include/Makefile.in | |
sed -e '/^includedir/ s/=.*$/=@includedir@/' -e 's/^Cflags: -I${includedir}/Cflags:/' -i libffi.pc.in | |
./configure --host=${TARGET} --prefix=${PREFIX} --enable-static | |
make -j4 | |
make install | |
popd | |
wget http://ftp.gnu.org/pub/gnu/gettext/gettext-0.19.8.1.tar.gz | |
tar zxvf gettext-0.19.8.1.tar.gz | |
pushd gettext-0.19.8.1 | |
./configure --host=${TARGET} --prefix=${PREFIX} --disable-rpath --disable-libasprintf --disable-java --disable-native-java --disable-openmp --disable-curses | |
make -j4 | |
make install | |
popd | |
wget http://ftp.gnome.org/pub/gnome/sources/glib/2.53/glib-2.53.7.tar.xz | |
tar xvf glib-2.53.7.tar.xz | |
pushd glib-2.53.7 | |
cat << EOF > android.cache | |
glib_cv_long_long_format=ll | |
glib_cv_stack_grows=no | |
glib_cv_sane_realloc=yes | |
glib_cv_have_strlcpy=no | |
glib_cv_va_val_copy=yes | |
glib_cv_rtldglobal_broken=no | |
glib_cv_uscore=no | |
glib_cv_monotonic_clock=no | |
ac_cv_func_nonposix_getpwuid_r=no | |
ac_cv_func_posix_getpwuid_r=no | |
ac_cv_func_posix_getgrgid_r=no | |
glib_cv_use_pid_surrogate=yes | |
ac_cv_func_printf_unix98=no | |
ac_cv_func_vsnprintf_c99=yes | |
ac_cv_func_realloc_0_nonnull=yes | |
ac_cv_func_realloc_works=yes | |
EOF | |
chmod a-x android.cache | |
NOCONFIGURE=true ./autogen.sh | |
./configure --host=${ANDROID_TARGET} --prefix=${PREFIX} --disable-dependency-tracking --cache-file=android.cache --enable-included-printf --enable-static --with-pcre=no --enable-libmount=no --with-libiconv=gnu | |
make -j4 | |
make install | |
popd | |
OBOE_VERSION=1.1.1 | |
wget https://github.com/google/oboe/archive/${OBOE_VERSION}.tar.gz | |
tar zxvf ${OBOE_VERSION}.tar.gz | |
pushd oboe-${OBOE_VERSION} | |
mkdir build | |
pushd build | |
cmake -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=make \ | |
-DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake \ | |
-DANDROID_NATIVE_API_LEVEL=${ANDROID_API} \ | |
-DANDROID_ABI=${ANDROID_ABI_CMAKE} \ | |
-DANDROID_PLATFORM=android-${ANDROID_API} \ | |
-DBUILD_SHARED_LIBS=0 .. \ | |
-DCMAKE_VERBOSE_MAKEFILE=1 | |
make -j4 | |
# need to manually install oboe as it doesn't provide an install target | |
cp liboboe.a* ${PREFIX}/lib/ | |
cp -ur ../include/oboe ${PREFIX}/include | |
# create a custom pkgconfig file for oboe to allow fluidsynth to find it | |
cat << EOF > ${PKG_CONFIG_PATH}/oboe-1.0.pc | |
prefix=${PREFIX} | |
exec_prefix=\${prefix} | |
libdir=\${prefix}/lib | |
includedir=\${prefix}/include | |
Name: Oboe | |
Description: Oboe library | |
Version: ${OBOE_VERSION} | |
Libs: -L\${libdir} -loboe -landroid -llog -lstdc++ | |
Cflags: -I\${includedir} | |
EOF | |
popd | |
popd | |
wget https://github.com/FluidSynth/fluidsynth/archive/v2.1.1.tar.gz | |
tar zxvf v2.1.1.tar.gz | |
pushd fluidsynth-2.1.1 | |
mkdir build | |
pushd build | |
cmake -G "Unix Makefiles" -DCMAKE_MAKE_PROGRAM=make \ | |
-DCMAKE_TOOLCHAIN_FILE=${NDK}/build/cmake/android.toolchain.cmake \ | |
-DANDROID_NATIVE_API_LEVEL=${ANDROID_API} \ | |
-DANDROID_ABI=${ANDROID_ABI_CMAKE} \ | |
-DANDROID_TOOLCHAIN=clang \ | |
-DANDROID_NDK=${NDK} \ | |
-DCMAKE_INSTALL_PREFIX=${PREFIX} \ | |
-DCMAKE_VERBOSE_MAKEFILE=1 \ | |
-Denable-libsndfile=0 \ | |
-Denable-opensles=1 \ | |
-Denable-oboe=1 \ | |
-Denable-dbus=0 \ | |
-Denable-oss=0 .. | |
make -j4 | |
make install | |
popd | |
popd |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi, here you can find my updated scripts
https://gist.github.com/santoxyz