From c33432a46298104a3f79166ba49c0c6668d96861 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=A6=8C=20=EA=A6=AB=EA=A6=B6=20=EA=A6=8F=EA=A7=80?= =?UTF-8?q?=EA=A6=A6=EA=A6=BF=20=EA=A6=A7=20=EA=A6=AE=20=EA=A6=91=20?= =?UTF-8?q?=EA=A6=A9=20=EA=A6=AD=EA=A7=80?= Date: Thu, 9 Apr 2020 19:30:19 +0800 Subject: Update build instruction for NDK > r18 --- README.md | 48 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 40 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 4dfa5f2..d60f960 100644 --- a/README.md +++ b/README.md @@ -14,38 +14,70 @@ $ autoreconf --install ## Optionally setting environment values ```sh -$ export CFLAGS="${CFLAGS} -g -DDEBUG -DANDROID -fPIC" # PIC might be needed later on android_armv7 -$ export LDFLAGS="${LDFLAGS} -llog" # Android liblog +$ export CPPFLAGS="${CPPFLAGS} -DDEBUG -DANDROID" +$ export CFLAGS="${CFLAGS} -g" +$ export NDK=/opt/android-ndk-r21 +$ export TOOLCHAIN=$NDK/toolchains/llvm/prebuilt/linux-x86_64 ``` -## Configuring for various target hosts +and then ```sh -$ ./configure +$ export TARGET=aarch64-linux-android ``` or ```sh -$ CC=/usr/local/aarch64-linux-android/bin/aarch64-linux-android-clang RANLIB=/usr/local/aarch64-linux-android/bin/aarch64-linux-android-ranlib ./configure --host=aarch64-linux-android --prefix=/usr/local/aarch64-linux-android/sysroot/usr +$ export TARGET=armv7a-linux-androideabi ``` or ```sh -$ CC=/usr/local/arm-linux-androideabi/bin/arm-linux-androideabi-clang RANLIB=/usr/local/arm-linux-androideabi/bin/arm-linux-androideabi-ranlib ./configure --host=arm-linux-androideabi --prefix=/usr/local/arm-linux-androideabi/sysroot/usr +$ export TARGET=i686-linux-android ``` or ```sh -$ CC=/usr/local/i686-linux-androideabi/bin/i686-linux-androideabi-clang RANLIB=/usr/local/i686-linux-androideabi/bin/i686-linux-androideabi-ranlib ./configure --host=i686-linux-androideabi --prefix=/usr/local/i686-linux-androideabi/sysroot/usr +$ export TARGET=x86_64-linux-android +``` + +and then + +```sh +$ export API=21 +$ export CC=$TOOLCHAIN/bin/$TARGET$API-clang +``` + +and only for Android 32-bit ARM, reset TARGET + +```sh +$ export TARGET=arm-linux-androideabi +``` + +and then + +```sh +$ export AR=$TOOLCHAIN/bin/$TARGET-ar +$ export AS=$TOOLCHAIN/bin/$TARGET-as +$ export LD=$TOOLCHAIN/bin/$TARGET-ld +$ export RANLIB=$TOOLCHAIN/bin/$TARGET-ranlib +$ export STRIP=$TOOLCHAIN/bin/$TARGET-strip +$ export PREFIX=$TOOLCHAIN/sysroot/usr +``` + +## Configuring for various target hosts + +```sh +$ ./configure ``` or ```sh -$ CC=/usr/local/x86_64-linux-androideabi/bin/x86_64-linux-androideabi-clang RANLIB=/usr/local/x86_64-linux-androideabi/bin/x86_64-linux-androideabi-ranlib ./configure --host=x86_64-linux-androideabi --prefix=/usr/local/x86_64-linux-androideabi/sysroot/usr +$ ./configure --host=$TARGET --prefix=$PREFIX --libdir=$PREFIX/lib/$TARGET/$API --disable-static ``` or so on. -- cgit v1.2.3