aboutsummaryrefslogtreecommitdiff
path: root/android_regen.sh
diff options
context:
space:
mode:
Diffstat (limited to 'android_regen.sh')
-rwxr-xr-xandroid_regen.sh26
1 files changed, 25 insertions, 1 deletions
diff --git a/android_regen.sh b/android_regen.sh
index 3644d4d85d..26fdd97f5f 100755
--- a/android_regen.sh
+++ b/android_regen.sh
@@ -18,7 +18,31 @@
cd `dirname ${BASH_SOURCE[0]}`
-DIR=`uname | tr 'A-Z' 'a-z'`_x86_64
+ANDROID_BUILD_TOP=$(cd ../../..; pwd)
+
+if [ $(uname) == 'Darwin' ]; then
+ DIR=darwin
+else
+ if [ $(uname -m) == 'aarch64' ]; then
+ DIR=linux_arm64
+ else
+ DIR=linux_x86_64
+ fi
+fi
+
+export CLANG_VERSION=$(cd $ANDROID_BUILD_TOP; build/soong/scripts/get_clang_version.py)
+
+if [ $DIR == "linux_x86_64" ]; then
+ export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/$CLANG_VERSION/bin/clang"
+ export CFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot"
+ export LDFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/sysroot -B$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/lib/gcc/x86_64-linux/4.8.3 -L$ANDROID_BUILD_TOP/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.17-4.8/x86_64-linux/lib64"
+elif [ $DIR == "linux_arm64" ]; then
+ #export CC="$ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/$CLANG_VERSION/bin/clang"
+ export CC=clang
+ export CFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/build-tools/sysroots/aarch64-linux-musl"
+ export LDFLAGS="--sysroot=$ANDROID_BUILD_TOP/prebuilts/build-tools/sysroots/aarch64-linux-musl -rtlib=compiler-rt -fuse-ld=lld --unwindlib=none"
+fi
+
mkdir -p $DIR/pyconfig $DIR/libffi
cd $DIR