annotate src/libsndfile-1.0.27/Scripts/android-configure.sh @ 83:ae30d91d2ffe

Replace these with versions built using an older toolset (so as to avoid ABI compatibilities when linking on Ubuntu 14.04 for packaging purposes)
author Chris Cannam
date Fri, 07 Feb 2020 11:51:13 +0000
parents 1df64224f5ac
children
rev   line source
Chris@40 1 #!/bin/bash -e
Chris@40 2
Chris@40 3 # Copyright (C) 2013 Erik de Castro Lopo <erikd@mega-nerd.com>
Chris@40 4 #
Chris@40 5 # All rights reserved.
Chris@40 6 #
Chris@40 7 # Redistribution and use in source and binary forms, with or without
Chris@40 8 # modification, are permitted provided that the following conditions are
Chris@40 9 # met:
Chris@40 10 #
Chris@40 11 # * Redistributions of source code must retain the above copyright
Chris@40 12 # notice, this list of conditions and the following disclaimer.
Chris@40 13 # * Neither the author nor the names of any contributors may be used
Chris@40 14 # to endorse or promote products derived from this software without
Chris@40 15 # specific prior written permission.
Chris@40 16 #
Chris@40 17 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
Chris@40 18 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
Chris@40 19 # TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
Chris@40 20 # PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
Chris@40 21 # CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
Chris@40 22 # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
Chris@40 23 # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
Chris@40 24 # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
Chris@40 25 # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
Chris@40 26 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
Chris@40 27 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Chris@40 28
Chris@40 29 # Android NDK version number; eg r8e, r9 etc
Chris@40 30 ANDROID_NDK_VER=r9
Chris@40 31
Chris@40 32 # Android NDK gcc version; eg 4.7, 4.9 etc.
Chris@40 33 ANDROID_GCC_VER=4.8
Chris@40 34
Chris@40 35 # Android API version; eg 9 (Android 2.3), 14 (Android 4.0) etc.
Chris@40 36 ANDROID_API_VER=9
Chris@40 37
Chris@40 38 #-------------------------------------------------------------------------------
Chris@40 39 # No more user config beyond here.
Chris@40 40
Chris@40 41 BUILD_MACHINE=$(uname -s | tr 'A-Z' 'a-z')-$(uname -m)
Chris@40 42
Chris@40 43 function die_with {
Chris@40 44 echo $1
Chris@40 45 exit 1
Chris@40 46 }
Chris@40 47
Chris@40 48 export CROSS_COMPILE=arm-linux-androideabi
Chris@40 49
Chris@40 50 # I put all my dev stuff in here
Chris@40 51 export DEV_PREFIX=$HOME/Android
Chris@40 52 test -d ${DEV_PREFIX} || die_with "Error : DEV_PREFIX '$DEV_PREFIX' does not exist."
Chris@40 53
Chris@40 54 # Don't forget to adjust this to your NDK path
Chris@40 55 export ANDROID_NDK=${DEV_PREFIX}/android-ndk-${ANDROID_NDK_VER}
Chris@40 56 test -d ${ANDROID_NDK} || die_with "Error : ANDROID_NDK '$ANDROID_NDK' does not exist."
Chris@40 57
Chris@40 58 export ANDROID_PREFIX=${ANDROID_NDK}/toolchains/arm-linux-androideabi-${ANDROID_GCC_VER}/prebuilt/${BUILD_MACHINE}
Chris@40 59 test -d ${ANDROID_PREFIX} || die_with "Error : ANDROID_PREFIX '$ANDROID_PREFIX' does not exist."
Chris@40 60
Chris@40 61 export SYSROOT=${ANDROID_NDK}/platforms/android-${ANDROID_API_VER}/arch-arm
Chris@40 62 test -d ${SYSROOT} || die_with "Error : SYSROOT '$SYSROOT' does not exist."
Chris@40 63
Chris@40 64 export CROSS_PREFIX=${ANDROID_PREFIX}/bin/${CROSS_COMPILE}
Chris@40 65 test -f ${CROSS_PREFIX}-gcc || die_with "Error : CROSS_PREFIX compiler '${CROSS_PREFIX}-gcc' does not exist."
Chris@40 66
Chris@40 67
Chris@40 68 # Non-exhaustive lists of compiler + binutils
Chris@40 69 # Depending on what you compile, you might need more binutils than that
Chris@40 70 export CPP=${CROSS_PREFIX}-cpp
Chris@40 71 export AR=${CROSS_PREFIX}-ar
Chris@40 72 export AS=${CROSS_PREFIX}-as
Chris@40 73 export NM=${CROSS_PREFIX}-nm
Chris@40 74 export CC=${CROSS_PREFIX}-gcc
Chris@40 75 export CXX=${CROSS_PREFIX}-g++
Chris@40 76 export LD=${CROSS_PREFIX}-ld
Chris@40 77 export RANLIB=${CROSS_PREFIX}-ranlib
Chris@40 78
Chris@40 79 # Don't mix up .pc files from your host and build target
Chris@40 80 export PKG_CONFIG_PATH=${PREFIX}/lib/pkgconfig
Chris@40 81
Chris@40 82 # Set up the needed FLAGS.
Chris@40 83 export CFLAGS="${CFLAGS} -gstabs --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include"
Chris@40 84 export CXXFLAGS="${CXXFLAGS} -gstabs -fno-exceptions --sysroot=${SYSROOT} -I${SYSROOT}/usr/include -I${ANDROID_PREFIX}/include -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_GCC_VER}/include/ -I${ANDROID_NDK}/sources/cxx-stl/gnu-libstdc++/${ANDROID_GCC_VER}/libs/armeabi/include"
Chris@40 85
Chris@40 86 export CPPFLAGS="${CFLAGS}"
Chris@40 87 export LDFLAGS="${LDFLAGS} -L${SYSROOT}/usr/lib -L${ANDROID_PREFIX}/lib"
Chris@40 88
Chris@40 89 # Create a symlink to the gdbclient.
Chris@40 90 test -h gdbclient || ln -s ${ANDROID_PREFIX}/bin/arm-linux-androideabi-gdb gdbclient
Chris@40 91
Chris@40 92 ./configure --host=${CROSS_COMPILE} --with-sysroot=${SYSROOT} "$@"