Commit 756e040f authored by Karel Slaný's avatar Karel Slaný

Merge branch 'android-openssl-build' into 'develop'

Updated android openssl build system

Closes #140

See merge request !145
parents 25860484 94ddc7ee
INCLUDEPATH += \ INCLUDEPATH += \
$$PWD \ $$PWD \
src \ src \
android/openssl/include/ android/openssl/libs/include/
equals(ANDROID_TARGET_ARCH, armeabi-v7a) { equals(ANDROID_TARGET_ARCH, armeabi-v7a) {
LIBS = \ LIBS = \
$${_PRO_FILE_PWD_}/android/openssl/armv7a/lib/libcrypto.a \ $${_PRO_FILE_PWD_}/android/openssl/libs/armeabi-v7a/libcrypto.a \
$${_PRO_FILE_PWD_}/android/openssl/armv7a/lib/libssl.a $${_PRO_FILE_PWD_}/android/openssl/libs/armeabi-v7a/libssl.a
}
equals(ANDROID_TARGET_ARCH, armeabi) {
LIBS = \
$${_PRO_FILE_PWD_}/android/openssl/arm/lib/libcrypto.a \
$${_PRO_FILE_PWD_}/android/openssl/arm/lib/libssl.a
} }
equals(ANDROID_TARGET_ARCH, x86) { equals(ANDROID_TARGET_ARCH, x86) {
LIBS = \ LIBS = \
$${_PRO_FILE_PWD_}/android/openssl/x86/lib/libcrypto.a \ $${_PRO_FILE_PWD_}/android/openssl/libs/x86/libcrypto.a \
$${_PRO_FILE_PWD_}/android/openssl/x86/lib/libssl.a $${_PRO_FILE_PWD_}/android/openssl/libs/x86/libssl.a
} }
DISTFILES += \ DISTFILES += \
$${_PRO_FILE_PWD_}/android/AndroidManifest.xml $${_PRO_FILE_PWD_}/android/AndroidManifest.xml
contains(ANDROID_TARGET_ARCH,armeabi-v7a) { contains(ANDROID_TARGET_ARCH, armeabi-v7a) {
ANDROID_EXTRA_LIBS = \
$${_PRO_FILE_PWD_}/android/openssl/armv7a/lib/libcrypto.so \
$${_PRO_FILE_PWD_}/android/openssl/armv7a/lib/libssl.so
}
contains(ANDROID_TARGET_ARCH,armeabi) {
ANDROID_EXTRA_LIBS = \ ANDROID_EXTRA_LIBS = \
$${_PRO_FILE_PWD_}/android/openssl/arm/lib/libcrypto.so \ $${_PRO_FILE_PWD_}/android/openssl/libs/armeabi-v7a/libcrypto.so \
$${_PRO_FILE_PWD_}/android/openssl/arm/lib/libssl.so $${_PRO_FILE_PWD_}/android/openssl/libs/armeabi-v7a/libssl.so
} }
contains(ANDROID_TARGET_ARCH,x86) { contains(ANDROID_TARGET_ARCH, x86) {
ANDROID_EXTRA_LIBS = \ ANDROID_EXTRA_LIBS = \
$${_PRO_FILE_PWD_}/android/openssl/x86/lib/libcrypto.so \ $${_PRO_FILE_PWD_}/android/openssl/libs/x86/libcrypto.so \
$${_PRO_FILE_PWD_}/android/openssl/x86/lib/libssl.so $${_PRO_FILE_PWD_}/android/openssl/libs/x86/libssl.so
} }
# 1. Requiers Mingw and MSYS for openssl build on windows.
# 2. Install from https://sourceforge.net/projects/mingw/files/
# 3. Run C:\MinGW\msys\1.0\msys.bat
# 4. Unpack opeenssl tar.gz to home dir
# 5. Set compiler and run ./Configure with architecture param:
# (https://developer.android.com/ndk/guides/android_mk.html section TARGET_ARCH_ABI)
# ARM v7
export CC=/x/android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc
export AR=/x/android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar
export ANDROID_DEV=/x/android-ndk-r11c/platforms/android-9/arch-arm/usr
./Configure shared android-armv7
# ARM v6 and older
export CC=/x/android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-gcc
export AR=/x/android-ndk-r11c/toolchains/arm-linux-androideabi-4.9/prebuilt/windows-x86_64/bin/arm-linux-androideabi-ar
export ANDROID_DEV=/x/android-ndk-r11c/platforms/android-9/arch-arm/usr
./Configure shared android
# x86
export CC=/x/android-ndk-r11c/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-gcc
export AR=/x/android-ndk-r11c/toolchains/x86-4.9/prebuilt/windows-x86_64/bin/i686-linux-android-ar
export ANDROID_DEV=/x/android-ndk-r11c/platforms/android-9/arch-x86/usr
./Configure shared android
# 6. Replace the following two lines that appear under "link-shared" and "do_$(SHLIB_TARGET)" make targets in Makefile:
# LIBNAME=$$i LIBVERSION=$(SHLIB_MAJOR).$(SHLIB_MINOR) \
# LIBCOMPATVERSIONS=";$(SHLIB_VERSION_HISTORY)" \
# with
# LIBNAME=$$i \
# Run make:
make build_libs
\ No newline at end of file
#!/bin/bash #!/bin/bash
# #
# http://wiki.openssl.org/index.php/Android # -----------------------------------------------------------------------------
# The script build OpenSSL for android (diferent types of architectures).
#
# Usage: User must set some variables below and run script.
# #
# 1. Set required Openssl version, e.x."openssl-1.0.2x".
OPENSSL_VERSION="openssl-1.0.2q"
# 2. Set full path to android NDK base dir on your build host platform.
# (e.x. BASE_ANDROID_NDK_PATH_LINUX to /home/user/android/android-ndk-r15c) for linux.
# NOTE: It is recommended to use NDK version r13b or r15c. It were tested.
BASE_ANDROID_NDK_PATH_WINDOWS="C:/Users/Martin/AppData/Local/Android/android-ndk-r15c"
BASE_ANDROID_NDK_PATH_LINUX="/home/martin/Android/android-ndk-r15c"
BASE_ANDROID_NDK_PATH_MACOS="/Users/martin/Android/android-ndk-r15c"
# 3. Add required android architectures into brackets.
# Available architectures are: armeabi-v7a arm64-v8a mips mips64 x86_64 x86
ANDROID_ARCHS=(armeabi-v7a x86)
# That is all! Now you can run the script :)
# ----------------------------------------------------------------------------
# Do not change these variables if you dont know what you do!
BASE_ANDROID_TARGET="android-16"
BUILD_HOST_WINDOWS="windows-x86_64"
BUILD_HOST_LINUX="linux-x86_64"
BUILD_HOST_MACOS="darwin-x86_64"
# Detect host build OS type and set path and android build host.
if [[ "$OSTYPE" == "linux-gnu" ]]; then
BUILD_HOST=${BUILD_HOST_LINUX}
BASE_ANDROID_NDK_PATH=${BASE_ANDROID_NDK_PATH_LINUX}
elif [[ "$OSTYPE" == "darwin"* ]]; then
BUILD_HOST=${BUILD_HOST_MACOS}
BASE_ANDROID_NDK_PATH=${BASE_ANDROID_NDK_PATH_MACOS}
elif [[ "$OSTYPE" == "cygwin" ]]; then
BUILD_HOST=${BUILD_HOST_WINDOWS}
BASE_ANDROID_NDK_PATH=${BASE_ANDROID_NDK_PATH_WINDOWS}
elif [[ "$OSTYPE" == "msys" ]]; then
BUILD_HOST=${BUILD_HOST_WINDOWS}
BASE_ANDROID_NDK_PATH=${BASE_ANDROID_NDK_PATH_WINDOWS}
elif [[ "$OSTYPE" == "win32" ]]; then
BUILD_HOST=${BUILD_HOST_WINDOWS}
BASE_ANDROID_NDK_PATH=${BASE_ANDROID_NDK_PATH_WINDOWS}
fi
set -e set -e
rm -rf libs rm -rf libs
mkdir libs mkdir libs
# OPENSSL_VERSION="openssl-1.0.2j" # Download and unzip openssl package.
curl -O "https://www.openssl.org/source/${OPENSSL_VERSION}.tar.gz" curl -O "https://www.openssl.org/source/${OPENSSL_VERSION}.tar.gz"
tar xfz "${OPENSSL_VERSION}.tar.gz" tar xfz "${OPENSSL_VERSION}.tar.gz"
archs=(armeabi-v7a x86) # Build all required android architecture.
for arch in ${ANDROID_ARCHS[@]}; do
for arch in ${archs[@]}; do
xLIB="/lib"
case ${arch} in case ${arch} in
"armeabi-v7a") "armeabi-v7a")
_ANDROID_TARGET_SELECT=arch-arm _ANDROID_TARGET_SELECT=arch-arm
_ANDROID_ARCH=arch-arm _ANDROID_ARCH=arch-arm
_ANDROID_EABI=arm-linux-androideabi-4.9 _ANDROID_EABI=arm-linux-androideabi-4.9
_ANDROID_GCC=arm-linux-androideabi-gcc
_ANDROID_AR=arm-linux-androideabi-ar
configure_platform="android-armv7" ;; configure_platform="android-armv7" ;;
"arm64-v8a") "arm64-v8a")
_ANDROID_TARGET_SELECT=arch-arm64-v8a _ANDROID_TARGET_SELECT=arch-arm64-v8a
_ANDROID_ARCH=arch-arm64 _ANDROID_ARCH=arch-arm64
_ANDROID_EABI=aarch64-linux-android-4.9 _ANDROID_EABI=aarch64-linux-android-4.9
#no xLIB="/lib64" _ANDROID_GCC=aarch64-linux-android-gcc
_ANDROID_AR=aarch64-linux-android-ar
configure_platform="linux-generic64 -DB_ENDIAN" ;; configure_platform="linux-generic64 -DB_ENDIAN" ;;
"mips") "mips")
_ANDROID_TARGET_SELECT=arch-mips _ANDROID_TARGET_SELECT=arch-mips
_ANDROID_ARCH=arch-mips _ANDROID_ARCH=arch-mips
_ANDROID_EABI=mipsel-linux-android-4.9 _ANDROID_EABI=mipsel-linux-android-4.9
_ANDROID_GCC=mipsel-linux-android-gcc
_ANDROID_AR=mipsel-linux-android-ar
configure_platform="android -DB_ENDIAN" ;; configure_platform="android -DB_ENDIAN" ;;
"mips64") "mips64")
_ANDROID_TARGET_SELECT=arch-mips64 _ANDROID_TARGET_SELECT=arch-mips64
_ANDROID_ARCH=arch-mips64 _ANDROID_ARCH=arch-mips64
_ANDROID_EABI=mips64el-linux-android-4.9 _ANDROID_EABI=mips64el-linux-android-4.9
xLIB="/lib64" _ANDROID_GCC=mips64el-linux-android-gcc
_ANDROID_AR=mips64el-linux-android-ar
configure_platform="linux-generic64 -DB_ENDIAN" ;; configure_platform="linux-generic64 -DB_ENDIAN" ;;
"x86") "x86")
_ANDROID_TARGET_SELECT=arch-x86 _ANDROID_TARGET_SELECT=arch-x86
_ANDROID_ARCH=arch-x86 _ANDROID_ARCH=arch-x86
_ANDROID_EABI=x86-4.9 _ANDROID_EABI=x86-4.9
_ANDROID_GCC=i686-linux-android-gcc
_ANDROID_AR=i686-linux-android-ar
configure_platform="android-x86" ;; configure_platform="android-x86" ;;
"x86_64") "x86_64")
_ANDROID_TARGET_SELECT=arch-x86_64 _ANDROID_TARGET_SELECT=arch-x86_64
_ANDROID_ARCH=arch-x86_64 _ANDROID_ARCH=arch-x86_64
_ANDROID_EABI=x86_64-4.9 _ANDROID_EABI=x86_64-4.9
xLIB="/lib64" _ANDROID_GCC=x86_64-linux-android-gcc
_ANDROID_AR=x86_64-linux-android-ar
configure_platform="linux-generic64" ;; configure_platform="linux-generic64" ;;
*) *)
configure_platform="linux-elf" ;; configure_platform="linux-elf" ;;
...@@ -55,38 +104,37 @@ for arch in ${archs[@]}; do ...@@ -55,38 +104,37 @@ for arch in ${archs[@]}; do
mkdir libs/${arch} mkdir libs/${arch}
. ./setenv-android-mod.sh
echo "CROSS COMPILE ENV : $CROSS_COMPILE"
cd "${OPENSSL_VERSION}" cd "${OPENSSL_VERSION}"
xCFLAGS="-DSHARED_EXTENSION=.so -fPIC -DOPENSSL_PIC -DOPENSSL_THREADS -DDSO_DLFCN -DHAVE_DLFCN_H -mandroid -I$ANDROID_DEV/include -B$ANDROID_DEV/$xLIB -O3 -fomit-frame-pointer -Wall" export CC=${BASE_ANDROID_NDK_PATH}/toolchains/${_ANDROID_EABI}/prebuilt/${BUILD_HOST}/bin/${_ANDROID_GCC}
export AR=${BASE_ANDROID_NDK_PATH}/toolchains/${_ANDROID_EABI}/prebuilt/${BUILD_HOST}/bin/${_ANDROID_AR}
perl -pi -e 's/install: all install_docs install_sw/install: install_docs install_sw/g' Makefile.org export ANDROID_DEV=${BASE_ANDROID_NDK_PATH}/platforms/${BASE_ANDROID_TARGET}/${_ANDROID_ARCH}/usr
./Configure shared threads no-asm no-zlib no-ssl2 no-ssl3 no-comp no-hw no-engine --openssldir=/usr/local/ssl/android-21/ $configure_platform $xCFLAGS ./Configure shared threads no-asm no-zlib no-ssl2 no-ssl3 no-hw $configure_platform
# patch SONAME
perl -pi -e 's/SHLIB_EXT=\.so\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)/SHLIB_EXT=\.so/g' Makefile perl -pi -e 's/SHLIB_EXT=\.so\.\$\(SHLIB_MAJOR\)\.\$\(SHLIB_MINOR\)/SHLIB_EXT=\.so/g' Makefile
perl -pi -e 's/SHARED_LIBS_LINK_EXTS=\.so\.\$\(SHLIB_MAJOR\) \.so//g' Makefile perl -pi -e 's/SHARED_LIBS_LINK_EXTS=\.so\.\$\(SHLIB_MAJOR\) \.so//g' Makefile
# quote injection for proper SONAME, fuck...
perl -pi -e 's/SHLIB_MAJOR=1/SHLIB_MAJOR=`/g' Makefile perl -pi -e 's/SHLIB_MAJOR=1/SHLIB_MAJOR=`/g' Makefile
perl -pi -e 's/SHLIB_MINOR=0.0/SHLIB_MINOR=`/g' Makefile perl -pi -e 's/SHLIB_MINOR=0.0/SHLIB_MINOR=`/g' Makefile
make clean make clean
make depend -j4
make build_libs -j4 make build_libs -j4
file libcrypto.so file libcrypto.so
file libssl.so file libssl.so
file libcrypto.a
file libssl.a
cp libcrypto.so ../libs/${arch}/libcrypto.so cp libcrypto.so ../libs/${arch}/libcrypto.so
cp libssl.so ../libs/${arch}/libssl.so cp libssl.so ../libs/${arch}/libssl.so
cp libcrypto.a ../libs/${arch}/libcrypto.a
cp libssl.a ../libs/${arch}/libssl.a
cd .. cd ..
done done
cp -r -L ${OPENSSL_VERSION}/include/ libs/include cp -r -L ${OPENSSL_VERSION}/include/ libs/include
rm -rf "${OPENSSL_VERSION}" rm -rf "${OPENSSL_VERSION}"
rm "${OPENSSL_VERSION}.tar.gz" rm "${OPENSSL_VERSION}.tar.gz"
echo "BUILD DONE!"
exit 0 exit 0
# Android openssl build script for Linux - all android architectures
# ----------------------------------------------------------------------------
# 1. Download Android NDK r15c for Linux from website
# https://developer.android.com/ndk/downloads/index.html
# 2. Install NDK to /home/{User}/{Repository}/mobile-datovka/android/openssl/android-ndk-r15c
# 3. Set build variables below, privilegies for scripts and run build script.
# Do next commands:
# ----------------------------------------------------------------------------
cd /home/{User}/{Repository}/mobile-datovka/android/openssl
chmod 755 ./build-all-arch.sh
chmod 755 ./setenv-android-mod.sh
export ANDROID_NDK_ROOT=/home/{User}/{Repository}/mobile-datovka/android/openssl/android-ndk-r15c
# Example: export ANDROID_NDK_ROOT=/home/martin/Git/mobile-datovka/android/openssl/android-ndk-r15c
export OPENSSL_VERSION="openssl-1.0.2l"
./build-all-arch-linux.sh
#!/bin/bash
# Cross-compile environment for Android on ARMv7 and x86
#
# Contents licensed under the terms of the OpenSSL license
# http://www.openssl.org/source/license.html
#
# See http://wiki.openssl.org/index.php/FIPS_Library_and_Android
# and http://wiki.openssl.org/index.php/Android
#####################################################################
# Set ANDROID_NDK_ROOT to you NDK location. For example,
# /opt/android-ndk-r8e or /opt/android-ndk-r9. This can be done in a
# login script. If ANDROID_NDK_ROOT is not specified, the script will
# try to pick it up with the value of _ANDROID_NDK_ROOT below. If
# ANDROID_NDK_ROOT is set, then the value is ignored.
# _ANDROID_NDK="android-ndk-r8e"
_ANDROID_NDK="android-ndk-r13"
# _ANDROID_NDK="android-ndk-r10"
# Set _ANDROID_EABI to the EABI you want to use. You can find the
# list in $ANDROID_NDK_ROOT/toolchains. This value is always used.
# _ANDROID_EABI="x86-4.6"
# _ANDROID_EABI="arm-linux-androideabi-4.6"
#_ANDROID_EABI="arm-linux-androideabi-4.9"
# Set _ANDROID_ARCH to the architecture you are building for.
# This value is always used.
# _ANDROID_ARCH=arch-x86
#_ANDROID_ARCH=arch-arm
# Set _ANDROID_API to the API you want to use. You should set it
# to one of: android-14, android-9, android-8, android-14, android-5
# android-4, or android-3. You can't set it to the latest (for
# example, API-17) because the NDK does not supply the platform. At
# Android 5.0, there will likely be another platform added (android-22?).
# This value is always used.
# _ANDROID_API="android-14"
# _ANDROID_API="android-18"
_ANDROID_API="android-21"
#####################################################################
# Error checking
# ANDROID_NDK_ROOT should always be set by the user (even when not running this script)
# http://groups.google.com/group/android-ndk/browse_thread/thread/a998e139aca71d77
if [ -z "$ANDROID_NDK_ROOT" ] || [ ! -d "$ANDROID_NDK_ROOT" ]; then
echo "Error: ANDROID_NDK_ROOT is not a valid path. Please edit this script."
echo "$ANDROID_NDK_ROOT"
exit 1
fi
# Error checking
if [ ! -d "$ANDROID_NDK_ROOT/toolchains" ]; then
echo "Error: ANDROID_NDK_ROOT/toolchains is not a valid path. Please edit this script."
echo "$ANDROID_NDK_ROOT/toolchains"
exit 1
fi
# Error checking
if [ ! -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI" ]; then
echo "Error: ANDROID_EABI is not a valid path. Please edit this script."
echo "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI"
exit 1
fi
#####################################################################
# Based on ANDROID_NDK_ROOT, try and pick up the required toolchain. We expect something like:
# /opt/android-ndk-r83/toolchains/arm-linux-androideabi-4.7/prebuilt/linux-x86_64/bin
# Once we locate the toolchain, we add it to the PATH. Note: this is the 'hard way' of
# doing things according to the NDK documentation for Ice Cream Sandwich.
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
ANDROID_TOOLCHAIN=""
for host in "linux-x86_64" "linux-x86" "darwin-x86_64" "darwin-x86"
do
if [ -d "$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin" ]; then
ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/$_ANDROID_EABI/prebuilt/$host/bin"
break
fi
done
# Error checking
if [ -z "$ANDROID_TOOLCHAIN" ] || [ ! -d "$ANDROID_TOOLCHAIN" ]; then
echo "Error: ANDROID_TOOLCHAIN is not valid. Please edit this script."
echo "$ANDROID_TOOLCHAIN"
exit 1
fi
case $_ANDROID_TARGET_SELECT in
arch-arm)
ANDROID_TOOLS="arm-linux-androideabi-gcc arm-linux-androideabi-ranlib arm-linux-androideabi-ld"
;;
arch-arm64-v8a)
ANDROID_TOOLS="aarch64-linux-android-gcc aarch64-linux-android-randlib aarch64-linux-android-ld"
;;
arch-x86)
ANDROID_TOOLS="i686-linux-android-gcc i686-linux-android-ranlib i686-linux-android-ld"
;;
arch-x86_64)
ANDROID_TOOLS="x86_64-linux-android-gcc x86_64-linux-android-ranlib x86_64-linux-android-ld"
;;
arch-mips)
ANDROID_TOOLS="mipsel-linux-android-gcc mipsel-linux-android-ranlib mipsel-linux-android-ld"
;;
arch-mips64)
ANDROID_TOOLS="mips64el-linux-android-gcc mips64el-linux-android-ranlib mips64el-linux-android-ld"
;;
*)
echo "ERROR ERROR ERROR"
exit 1
;;
esac
for tool in $ANDROID_TOOLS
do
# Error checking
if [ ! -e "$ANDROID_TOOLCHAIN/$tool" ]; then
echo "Error: Failed to find $tool. Please edit this script."
echo "$ANDROID_TOOLCHAIN/$tool"
exit 1
fi
done
# Only modify/export PATH if ANDROID_TOOLCHAIN good
if [ ! -z "$ANDROID_TOOLCHAIN" ]; then
export ANDROID_TOOLCHAIN="$ANDROID_TOOLCHAIN"
export PATH="$ANDROID_TOOLCHAIN":"$PATH"
fi
#####################################################################
# For the Android SYSROOT. Can be used on the command line with --sysroot
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
export SYSROOT="$ANDROID_SYSROOT"
export NDK_SYSROOT="$ANDROID_SYSROOT"
# Error checking
if [ -z "$ANDROID_SYSROOT" ] || [ ! -d "$ANDROID_SYSROOT" ]; then
echo "Error: ANDROID_SYSROOT is not valid. Please edit this script."
echo "$ANDROID_SYSROOT"
exit 1
fi
#####################################################################
# If the user did not specify the FIPS_SIG location, try and pick it up
# If the user specified a bad location, then try and pick it up too.
if [ -z "$FIPS_SIG" ] || [ ! -e "$FIPS_SIG" ]; then
# Try and locate it
_FIPS_SIG=""
if [ -d "/usr/local/ssl/$_ANDROID_API" ]; then
_FIPS_SIG=`find "/usr/local/ssl/$_ANDROID_API" -name incore`
fi
if [ ! -e "$_FIPS_SIG" ]; then
_FIPS_SIG=`find $PWD -name incore`
fi
# If a path was set, then export it
if [ ! -z "$_FIPS_SIG" ] && [ -e "$_FIPS_SIG" ]; then
export FIPS_SIG="$_FIPS_SIG"
fi
fi
# Error checking. Its OK to ignore this if you are *not* building for FIPS
if [ -z "$FIPS_SIG" ] || [ ! -e "$FIPS_SIG" ]; then
echo "Error: FIPS_SIG does not specify incore module. Please edit this script."
# echo "$FIPS_SIG"
# exit 1
fi
#####################################################################
# Most of these should be OK (MACHINE, SYSTEM, ARCH). RELEASE is ignored.
export MACHINE=armv7
export RELEASE=2.6.37
export SYSTEM=android
export ARCH=arm
export CROSS_COMPILE="arm-linux-androideabi-"
if [ "$_ANDROID_TARGET_SELECT" == "arch-arm64-v8a" ]; then
export MACHINE=armv7
export ARCH=arm64
export CROSS_COMPILE="aarch64-linux-android-"
fi
if [ "$_ANDROID_TARGET_SELECT" == "arch-x86" ]; then
export MACHINE=i686
export ARCH=x86
export CROSS_COMPILE="i686-linux-android-"
fi
if [ "$_ANDROID_TARGET_SELECT" == "arch-x86_64" ]; then
export MACHINE=i686
export ARCH=x86_64
export CROSS_COMPILE="x86_64-linux-android-"
fi
if [ "$_ANDROID_TARGET_SELECT" == "arch-mips" ]; then
export MACHINE=i686
export ARCH=mips
export CROSS_COMPILE="mipsel-linux-android-"
fi
if [ "$_ANDROID_TARGET_SELECT" == "arch-mips64" ]; then
export MACHINE=i686
export ARCH=mips64
export CROSS_COMPILE="mips64el-linux-android-"
fi
echo "CHECK_CROSS_COMPILER = $CROSS_COMPILE"
# For the Android toolchain
# https://android.googlesource.com/platform/ndk/+/ics-mr0/docs/STANDALONE-TOOLCHAIN.html
export ANDROID_SYSROOT="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH"
export SYSROOT="$ANDROID_SYSROOT"
export NDK_SYSROOT="$ANDROID_SYSROOT"
export ANDROID_NDK_SYSROOT="$ANDROID_SYSROOT"
export ANDROID_API="$_ANDROID_API"
# CROSS_COMPILE and ANDROID_DEV are DFW (Don't Fiddle With). Its used by OpenSSL build system.
# export CROSS_COMPILE="arm-linux-androideabi-"
export ANDROID_DEV="$ANDROID_NDK_ROOT/platforms/$_ANDROID_API/$_ANDROID_ARCH/usr"
export HOSTCC=gcc
VERBOSE=1
if [ ! -z "$VERBOSE" ] && [ "$VERBOSE" != "0" ]; then
echo "ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT"
echo "ANDROID_ARCH: $_ANDROID_ARCH"
echo "ANDROID_EABI: $_ANDROID_EABI"
echo "ANDROID_API: $ANDROID_API"
echo "ANDROID_SYSROOT: $ANDROID_SYSROOT"
echo "ANDROID_TOOLCHAIN: $ANDROID_TOOLCHAIN"
echo "FIPS_SIG: $FIPS_SIG"
echo "CROSS_COMPILE: $CROSS_COMPILE"
echo "ANDROID_DEV: $ANDROID_DEV"
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment