summaryrefslogtreecommitdiff
path: root/android-configure
blob: cbf137f47174c71f5b2828240869f179439fd81b (plain)
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
39
40
41
42
43
44
45
46
47
48
49
#!/bin/bash

if [ -z "$2" ]; then
    ARCH=arm
else
    ARCH="$2"
fi

CC_VER="4.9"
case $ARCH in
    arm)
        DEST_CPU="$ARCH"
        SUFFIX="$ARCH-linux-androideabi"
        TOOLCHAIN_NAME="$SUFFIX"
        ;;
    x86)
        DEST_CPU="ia32"
        SUFFIX="i686-linux-android"
        TOOLCHAIN_NAME="$ARCH"
        ;;
    x86_64)
        DEST_CPU="ia32"
        SUFFIX="$ARCH-linux-android"
        TOOLCHAIN_NAME="$ARCH"
        ;;
    *)
        echo "Unsupported architecture provided: $ARCH"
        exit 1
        ;;
esac

export TOOLCHAIN=$PWD/android-toolchain
mkdir -p $TOOLCHAIN
$1/build/tools/make-standalone-toolchain.sh \
    --toolchain=$TOOLCHAIN_NAME-$CC_VER \
    --arch=$ARCH \
    --install-dir=$TOOLCHAIN \
    --platform=android-21
export PATH=$TOOLCHAIN/bin:$PATH
export AR=$TOOLCHAIN/bin/$SUFFIX-ar
export CC=$TOOLCHAIN/bin/$SUFFIX-gcc
export CXX=$TOOLCHAIN/bin/$SUFFIX-g++
export LINK=$TOOLCHAIN/bin/$SUFFIX-g++

./configure \
    --dest-cpu=$DEST_CPU \
    --dest-os=android \
    --without-snapshot \
    --openssl-no-asm