1 #!/bin/bash 2 3 set -e 4 set -x 5 6 if [ ! -d "$NDK" ]; then 7 echo 'Please set $NDK to the path to NDK' 8 exit 1 9 fi 10 11 cd $(dirname "$0") 12 13 function RunConfigure() { 14 HOST=$1 15 TARGET=$2 16 ARCH=$3 17 18 TOOLCHAIN=${NDK}/toolchains/llvm/prebuilt/linux-x86_64/bin/ 19 20 export AR=${TOOLCHAIN}${HOST}-ar 21 export AS=${TOOLCHAIN}${TARGET}-clang 22 export CC=${TOOLCHAIN}${TARGET}-clang 23 export CXX=${TOOLCHAIN}${TARGET}-clang++ 24 export LD=${TOOLCHAIN}${HOST}-ld 25 export STRIP=${TOOLCHAIN}${HOST}-strip 26 27 # Tell configure what flags Android requires. 28 export CFLAGS="-fPIE -fPIC" 29 export LDFLAGS="-pie" 30 31 ./configure --host=${HOST} 32 } 33 34 # All arches generates the same iperf_config.h (for now). 35 RunConfigure "aarch64-linux-android" "aarch64-linux-android28" "arm64" 36 # RunConfigure "arm-linux-androideabi" "armv7a-linux-androideabi28" "arm" 37 # RunConfigure "i686-linux-android" "i686-linux-android28" "x86" 38 # RunConfigure "x86_64-linux-android" "x86_64-linux-android28" "x86-64" 39