diff options
author | Sven Gothel <[email protected]> | 2019-12-10 06:32:34 +0100 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2019-12-10 06:32:34 +0100 |
commit | 74e5bbe097a07d1275a2d6452d1e2336a8d5c44a (patch) | |
tree | 234817e7d3900956abf2355cb7846e53d25a4f63 /make/lib | |
parent | 5736716ed0598c97273583717ffb9d22a60ca7a4 (diff) |
Bug 1417 - Android: Support building using current SDK and NDK v20 as of 2019-12-10 (GlueGen w/ android-aarch64 patched)
Default Platform: Android 7.0 Nougat, API level 24 supports Java 1.8
Reworked gluegen/make/scripts/setenv-android-tools.sh,
following canonical environment variables and sets all
required variables for cross-compilation.
See file's comments!
ant files:
- android.version -> android.api.level (default 24)
- android.jar defaults to ${gluegen.root}/make/lib/android-sdk/24/android.jar (provided)
Diffstat (limited to 'make/lib')
-rw-r--r-- | make/lib/gluegen-cpptasks-android-aarch64.xml | 100 |
1 files changed, 54 insertions, 46 deletions
diff --git a/make/lib/gluegen-cpptasks-android-aarch64.xml b/make/lib/gluegen-cpptasks-android-aarch64.xml index 1daa201..4b6401b 100644 --- a/make/lib/gluegen-cpptasks-android-aarch64.xml +++ b/make/lib/gluegen-cpptasks-android-aarch64.xml @@ -23,7 +23,7 @@ <property name="isAndroidARM64" value="true" /> <property name="jvmDataModel.arg" value="-Djnlp.no.jvm.data.model.set=true" /> <property name="isCrosscompilation" value="true" /> - <property name="android.abi" value="arm64-v8a" /> + <property name="android.abi" value="${env.ANDROID_ABI}" /> <!-- arm64-v8a --> <property name="isAbiEabiGnuArmel" value="true" /> <echo message="gluegen.cpptasks.detect.os.custom: GLUEGEN_CPPTASKS_FILE 'gluegen-cpptasks-android-aarch64' done"/> </target> @@ -32,24 +32,27 @@ <target name="gluegen.cpptasks.configure.compiler" depends="setup.java.home.dir,declare.linux.android"> <echo message="Custom forced compiler Android NDK, linker.cfg.android" /> - <compiler id="compiler.cfg.android" name="gcc"> - <compilerarg value="--sysroot=${TARGET_PLATFORM_SYSROOT}" /> - <!-- The default search dirs for 'gcc from $NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin will not find - subprograms properly (see gcc -print-search-dirs). Not sure if this is a bug in the NDK - or not. Need to explicitly indicate where subprograms are with -B. - NOTE: This is not necessary if using '$TARGET_TRIPLE-gcc' from $NDK_TOOLCHAIN_ROOT/bin. --> - <compilerarg value="-B${env.NDK_TOOLCHAIN_ROOT}/libexec/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}" /> + <compiler id="compiler.cfg.android" name="clang"> + <compilerarg value="--sysroot=${env.ANDROID_TOOLCHAIN_SYSROOT}" /> + + <!-- compilerarg value="-v" / --> <compilerarg value="-fpic" /> <!-- compilerarg value="-fPIE" / --> <!-- not for shared libs, won't produce symbols --> <!-- compilerarg value="-pie" / --> <!-- not for shared libs, won't produce symbols --> + + <!-- from sdk cmake start --> + <compilerarg value="-fdata-sections" /> <compilerarg value="-ffunction-sections" /> <compilerarg value="-funwind-tables" /> - <compilerarg value="-fstack-protector" /> + <compilerarg value="-fstack-protector-strong" /> <!-- compilerarg value="-no-canonical-prefixes" / --> <!-- will disallow creating shared library --> - <compilerarg value="-Wa,--noexecstack" /> + <!-- from sdk cmake end --> + <compilerarg value="-Wa,--noexecstack" /> + <compilerarg value="-target" /> + <compilerarg value="${env.ANDROID_LLVM_TRIPLE}" /> <!-- aarch64-none-linux-android --> <!-- compilerarg value="-mabi=lp64" /> <compilerarg value="-mlittle-endian" /> <compilerarg value="-march=armv8-a" / --> @@ -60,15 +63,15 @@ <!-- compilerarg value="-g" unless="c.compiler.use-debug" / --> <compilerarg value="-fomit-frame-pointer" unless="c.compiler.use-debug"/> <compilerarg value="-fstrict-aliasing" unless="c.compiler.use-debug"/> - <compilerarg value="-funswitch-loops" unless="c.compiler.use-debug"/> - <compilerarg value="-finline-limit=300" unless="c.compiler.use-debug"/> + <!-- compilerarg value="-funswitch-loops" unless="c.compiler.use-debug"/ not supported --> + <!-- compilerarg value="-finline-limit=300" unless="c.compiler.use-debug"/ not supported --> <compilerarg value="-O0" if="c.compiler.use-debug" /> <compilerarg value="-g" if="c.compiler.use-debug" /> <compilerarg value="-fno-omit-frame-pointer" if="c.compiler.use-debug" /> <compilerarg value="-fno-strict-aliasing" if="c.compiler.use-debug" /> - <includepath path="${env.NDK_TOOLCHAIN_ROOT}/lib/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}/include" /> <!-- for stdarg.h --> + <!-- includepath path="${env.ANDROID_TOOLCHAIN_SYSROOT_INC}" / --> <defineset> <define name="__unix__" /> <!-- define name="__ARM_ARCH_5__" /> @@ -85,39 +88,44 @@ </defineset> </compiler> - <linker id="linker.cfg.android" name="gcc"> - <linkerarg value="--sysroot=${TARGET_PLATFORM_SYSROOT}" /> - - <linkerarg value="-fpic" /> - <!-- linkerarg value="-fPIE" / --> <!-- not for shared libs, won't produce symbols --> - <!-- linkerarg value="-pie" / --> <!-- not for shared libs, won't produce symbols --> - <!-- linkerarg value="-no-canonical-prefixes" / --> <!-- will disallow creating shared library --> - - <linkerarg value="-fno-use-linker-plugin" /> - - <!-- linkerarg value="-mabi=lp64" /> - <linkerarg value="-mlittle-endian" /> - <linkerarg value="-march=armv8-a" / --> - <!-- linkerarg value="-mfloat-abi=softfp" / --> - - <linkerarg value="-nostdlib" /> - <linkerarg value="-Bdynamic" /> - <linkerarg value="-Wl,-dynamic-linker,/system/bin/linker" /> - <linkerarg value="-Wl,-z,nocopyreloc" /> - - <linkerarg value="--demangle" /> - <linkerarg value="--gc-sections" /> - <linkerarg value="--no-undefined" /> - <linkerarg value="-static-libgcc" if="isGCC"/> - <linkerarg value="-static-libstdc++" if="isGCC"/> - <!-- The gcc from $NDK_TOOLCHAIN_ROOT/$TARGET_TRIPLE/bin needs to be told - where to find libgcc as the default location (gcc -print-search-dirs) - is not correct. Not sure if this is a bug in the NDK or not. We also - enforce that libgcc is linked after source files but before other shared - libraries. --> - <libset dir="${env.NDK_TOOLCHAIN_ROOT}/lib/gcc/${env.TARGET_TRIPLE}/${env.GCC_VERSION}" libs="gcc" /> - <!-- libset libs="c,m,dl,log" / --> - <libset libs="c,m,dl" /> + <linker id="linker.cfg.android" name="clang"> + <linkerarg value="--sysroot=${env.ANDROID_TOOLCHAIN_SYSROOT}" /> + <!-- linkerarg value="-Wl,-L,${env.ANDROID_TOOLCHAIN_SYSROOT_LIB_0}" / --> + <linkerarg value="-Wl,-L,${env.ANDROID_TOOLCHAIN_SYSROOT_LIB_1}" /> + + <!-- linkerarg value="-v" / --> + + <linkerarg value="-fpic" /> + <!-- linkerarg value="-fPIE" / --> <!-- not for shared libs, won't produce symbols --> + <!-- linkerarg value="-pie" / --> <!-- not for shared libs, won't produce symbols --> + <!-- linkerarg value="-no-canonical-prefixes" / --> <!-- will disallow creating shared library --> + + <!-- from sdk cmake start --> + <linkerarg value="-Wl,--build-id" /> + <linkerarg value="-Wl,--warn-shared-textrel" /> + <!-- linkerarg value="-Wl,- -fatal-warnings" / --> + <!-- from sdk cmake end --> + + <linkerarg value="-fno-use-linker-plugin" /> + + <!-- linkerarg value="-mabi=lp64" /> + <linkerarg value="-mlittle-endian" /> + <linkerarg value="-march=armv8-a" / --> + <!-- linkerarg value="-mfloat-abi=softfp" / --> + + <linkerarg value="-nostdlib" /> + <linkerarg value="-Bdynamic" /> + <linkerarg value="-Wl,-dynamic-linker,/system/bin/linker" /> + <linkerarg value="-Wl,-z,nocopyreloc" /> + + <linkerarg value="--demangle" /> + <linkerarg value="--gc-sections" /> + <linkerarg value="--no-undefined" /> + <linkerarg value="-static-libgcc" if="isGCC"/> + <linkerarg value="-static-libstdc++" if="isGCC"/> + + <!-- libset libs="c,m,dl,log" / --> + <libset libs="c,m,dl" /> </linker> </target> |