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