Created
June 21, 2016 17:38
-
-
Save xavier83/f1de11ff0cd98f1b864a54d50a265f40 to your computer and use it in GitHub Desktop.
pulseaudio-android-ndk build.sh
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
#!/bin/bash | |
set -e | |
export ANDROID_NDK_ROOT=$HOME/Android/Sdk/ndk-bundle | |
export ac_cv_func_malloc_0_nonnull=yes | |
export ac_cv_func_realloc_0_nonnull=yes | |
# arm or x86 or x86_64 | |
export ARCH=${1-arm} | |
if [ "$ARCH" = "arm" ] ; then | |
BUILDCHAIN=arm-linux-androideabi | |
elif [ "$ARCH" = "x86" ] ; then | |
BUILDCHAIN=i686-linux-android | |
elif [ "$ARCH" = "x86_64" ] ; then | |
BUILDCHAIN=x86_64-linux-android | |
fi | |
if [ ! -e ndk-$ARCH ] ; then | |
$ANDROID_NDK_ROOT/build/tools/make-standalone-toolchain.sh --arch=$ARCH --install-dir=ndk-$ARCH --platform=android-22 | |
fi | |
export BUILDROOT=$PWD | |
export PATH=${BUILDROOT}/ndk-$ARCH/bin:$PATH | |
export PREFIX=${BUILDROOT}/ndk-$ARCH/sysroot/usr | |
export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig | |
export CC=${BUILDCHAIN}-gcc | |
export CXX=${BUILDCHAIN}-g++ | |
export ACLOCAL_PATH=${PREFIX}/share/aclocal | |
# Fetch external repos | |
if [ ! -e pulseaudio ] || [ ! -e json-c ] || [ ! -e libtool ] ; then | |
git submodule init | |
git submodule update | |
fi | |
if [ ! -e ${PREFIX}/lib/libltdl.a ] ; then | |
pushd libtool | |
env HELP2MAN=/bin/true MAKEINFO=/bin/true ./bootstrap | |
popd | |
mkdir -p libtool-build | |
pushd libtool-build | |
../libtool/configure --host=${BUILDCHAIN} --prefix=${PREFIX} HELP2MAN=/bin/true MAKEINFO=/bin/true | |
make | |
make install ||: | |
popd | |
fi | |
# Now, use updated libtool | |
export LIBTOOLIZE=${PREFIX}/bin/libtoolize | |
if [ ! -e $PKG_CONFIG_PATH/json-c.pc ] ; then | |
pushd json-c | |
./autogen.sh | |
popd | |
mkdir -p json-c-build | |
pushd json-c-build | |
../json-c/configure --host=${BUILDCHAIN} --prefix=${PREFIX} | |
make | |
make install | |
popd | |
fi | |
if [ ! -e libsndfile-1.0.26.tar.gz ] ; then | |
curl -O http://www.mega-nerd.com/libsndfile/files/libsndfile-1.0.26.tar.gz | |
fi | |
if [ ! -e libsndfile-1.0.26 ] ; then | |
tar -zxf libsndfile-1.0.26.tar.gz | |
fi | |
if [ ! -e $PKG_CONFIG_PATH/sndfile.pc ] ; then | |
mkdir -p libsndfile-build | |
pushd libsndfile-build | |
../libsndfile-1.0.26/configure --host=${BUILDCHAIN} --prefix=${PREFIX} --disable-external-libs --disable-alsa --disable-sqlite | |
make ||: | |
make install ||: | |
cp sndfile.pc ${PREFIX}/lib/pkgconfig/ | |
popd | |
fi | |
pushd pulseaudio | |
# disable patching for now.. | |
#if ! git grep -q opensl ; then | |
# git am ../pulseaudio-patches/* | |
#fi | |
env NOCONFIGURE=1 bash -x ./bootstrap.sh | |
#./autogen.sh | |
popd | |
mkdir -p pulseaudio-build | |
pushd pulseaudio-build | |
../pulseaudio/configure --host=${BUILDCHAIN} --prefix=${PREFIX} --disable-rpath --disable-nls --disable-x11 --disable-oss-wrapper --disable-alsa --disable-esound --disable-waveout --disable-glib2 --disable-gtk3 --disable-gconf --disable-avahi --disable-jack --disable-asyncns --disable-tcpwrap --disable-lirc --disable-dbus --disable-bluez4 --disable-bluez5 --disable-udev --disable-openssl --disable-xen --disable-systemd-daemon --disable-systemd-journal --disable-systemd-login --disable-manpages --disable-samplerate --without-speex --without-soxr --with-database=simple --disable-orc --without-caps --without-fftw --disable-tests | |
# --enable-static-bins --enable-static | |
make LDFLAGS="-pie" | |
make install |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment