diff options
Diffstat (limited to 'contrib/android')
| -rw-r--r-- | contrib/android/15-android.conf | 37 | ||||
| -rwxr-xr-x | contrib/android/bootstrap_ldns.sh | 55 | ||||
| -rwxr-xr-x | contrib/android/install_ndk.sh | 60 | ||||
| -rwxr-xr-x | contrib/android/install_openssl.sh | 44 | ||||
| -rwxr-xr-x | contrib/android/install_tools.sh | 26 | ||||
| -rwxr-xr-x | contrib/android/setenv_android.sh | 203 |
6 files changed, 0 insertions, 425 deletions
diff --git a/contrib/android/15-android.conf b/contrib/android/15-android.conf deleted file mode 100644 index e1fc91e703f2..000000000000 --- a/contrib/android/15-android.conf +++ /dev/null @@ -1,37 +0,0 @@ -#### Android... -# -# Heavily hacked 15-android.conf based on OpenSSL's config file of the same name. -# This 15-android.conf avoids compiler errors using NDK-r20. This 15-android.conf -# requires an environment set (sourced) using setenv-android.sh. - -my %targets = ( - "android" => { - inherit_from => [ "linux-generic32" ], - template => 1, - bin_cflags => add("-fPIE"), - bin_lflags => add("-pie"), - enable => [ ], - }, - - "android-arm" => { - inherit_from => [ "android", asm("armv4_asm") ], - bn_ops => [ "BN_LLONG", "RC4_CHAR" ], - }, - "android-arm64" => { - inherit_from => [ "android", asm("aarch64_asm") ], - bn_ops => [ "SIXTY_FOUR_BIT_LONG", "RC4_CHAR" ], - perlasm_scheme => "linux64", - }, - - "android-x86" => { - inherit_from => [ "android", asm("x86_asm") ], - cflags => add(picker(release => "-fomit-frame-pointer")), - bn_ops => [ "BN_LLONG", "RC4_INT" ], - perlasm_scheme => "android", - }, - "android-x86_64" => { - inherit_from => [ "android", asm("x86_64_asm") ], - bn_ops => [ "SIXTY_FOUR_BIT_LONG", "RC4_INT" ], - perlasm_scheme => "elf", - }, -); diff --git a/contrib/android/bootstrap_ldns.sh b/contrib/android/bootstrap_ldns.sh deleted file mode 100755 index 7e423030ccae..000000000000 --- a/contrib/android/bootstrap_ldns.sh +++ /dev/null @@ -1,55 +0,0 @@ -#!/usr/bin/env bash - -if ! git submodule update --init; then - echo "Failed to init submodule" - exit 1 -fi - -echo "AUTOTOOLS_BUILD: $AUTOTOOLS_BUILD" -echo "AUTOTOOLS_HOST: $AUTOTOOLS_HOST" - -# libtool complains about our updated config.guess and config.sub. -# Remove them to get through bootstrap. Re-add them after libtoolize. - -echo "Running libtoolize" -if [ -n "$(command -v glibtoolize)" ]; then - rm -f config.guess config.sub - if ! glibtoolize -ci ; then - echo "Failed to libtoolize (glibtoolize)" - exit 1 - fi -elif [ -n "$(command -v libtoolize)" ]; then - rm -f config.guess config.sub - if ! libtoolize -ci ; then - echo "Failed to libtoolize (libtoolize)" - exit 1 - fi -else - echo "Failed to find a libtool" - exit 1 -fi - -echo "Updating config.guess" -if ! wget -q -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'; then - echo "Failed to download config.guess" -fi - -echo "Updating config.sub" -if ! wget -q -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'; then - echo "Failed to download config.sub" -fi - -echo "Fixing config permissions" -chmod a+x config.guess config.sub -if [ -n "$(command -v xattr 2>/dev/null)" ]; then - xattr -d com.apple.quarantine config.guess 2>/dev/null - xattr -d com.apple.quarantine config.sub 2>/dev/null -fi - -echo "Running autoreconf" -if ! autoreconf -fi ; then - echo "Failed to autoreconf" - exit 1 -fi - -exit 0 diff --git a/contrib/android/install_ndk.sh b/contrib/android/install_ndk.sh deleted file mode 100755 index 90e453153db5..000000000000 --- a/contrib/android/install_ndk.sh +++ /dev/null @@ -1,60 +0,0 @@ -#!/usr/bin/env bash - -if [ -z "$ANDROID_SDK_ROOT" ]; then - echo "ERROR: ANDROID_SDK_ROOT is not set. Please set it." - echo "SDK root is $ANDROID_SDK_ROOT" - exit 1 -fi - -if [ -z "$ANDROID_NDK_ROOT" ]; then - echo "ERROR: ANDROID_NDK_ROOT is not set. Please set it." - echo "NDK root is $ANDROID_NDK_ROOT" - exit 1 -fi - -echo "Using ANDROID_SDK_ROOT: $ANDROID_SDK_ROOT" -echo "Using ANDROID_NDK_ROOT: $ANDROID_NDK_ROOT" - -echo "Downloading SDK" -if ! curl -L -k -s -o "$HOME/android-sdk.zip" https://dl.google.com/android/repository/commandlinetools-linux-6200805_latest.zip; -then - echo "Failed to download SDK" - exit 1 -fi - -echo "Downloading NDK" -if ! curl -L -k -s -o "$HOME/android-ndk.zip" https://dl.google.com/android/repository/android-ndk-r20b-linux-x86_64.zip; -then - echo "Failed to download NDK" - exit 1 -fi - -echo "Unpacking SDK to $ANDROID_SDK_ROOT" -if ! unzip -qq "$HOME/android-sdk.zip" -d "$ANDROID_SDK_ROOT"; -then - echo "Failed to unpack SDK" - exit 1 -fi - -echo "Unpacking NDK to $ANDROID_NDK_ROOT" -if ! unzip -qq "$HOME/android-ndk.zip" -d "$HOME"; -then - echo "Failed to unpack NDK" - exit 1 -fi - -if ! mv "$HOME/android-ndk-r20b" "$ANDROID_NDK_ROOT"; -then - echo "Failed to move $HOME/android-ndk-r20b to $ANDROID_NDK_ROOT" - exit 1 -fi - -rm -f "$HOME/android-sdk.zip" -rm -f "$HOME/android-ndk.zip" - -# https://stackoverflow.com/a/47028911/608639 -touch "$ANDROID_SDK_ROOT/repositories.cfg" - -echo "Finished installing SDK and NDK" - -exit 0 diff --git a/contrib/android/install_openssl.sh b/contrib/android/install_openssl.sh deleted file mode 100755 index e4fb87266e2e..000000000000 --- a/contrib/android/install_openssl.sh +++ /dev/null @@ -1,44 +0,0 @@ -#!/usr/bin/env bash - -echo "Downloading OpenSSL" -if ! curl -L -k -s -o openssl-1.1.1d.tar.gz https://www.openssl.org/source/openssl-1.1.1d.tar.gz; -then - echo "Failed to download OpenSSL" - exit 1 -fi - -echo "Unpacking OpenSSL" -rm -rf ./openssl-1.1.1d -if ! tar -xf openssl-1.1.1d.tar.gz; -then - echo "Failed to unpack OpenSSL" - exit 1 -fi - -cd openssl-1.1.1d || exit 1 - -if ! cp ../contrib/android/15-android.conf Configurations/; then - echo "Failed to copy OpenSSL Android config" - exit 1 -fi - -echo "Configuring OpenSSL" -if ! ./Configure "$OPENSSL_HOST" no-comp no-asm no-hw no-engine shared \ - --prefix="$ANDROID_PREFIX" --openssldir="$ANDROID_PREFIX"; then - echo "Failed to configure OpenSSL" - exit 1 -fi - -echo "Building OpenSSL" -if ! make; then - echo "Failed to build OpenSSL" - exit 1 -fi - -echo "Installing OpenSSL" -if ! make install_sw; then - echo "Failed to install OpenSSL" - exit 1 -fi - -exit 0 diff --git a/contrib/android/install_tools.sh b/contrib/android/install_tools.sh deleted file mode 100755 index 45aff601e2d7..000000000000 --- a/contrib/android/install_tools.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/usr/bin/env bash - -# This step should install tools needed for all packages - OpenSSL and LDNS -echo "Updating tools" -sudo apt-get -qq update -sudo apt-get -qq install --no-install-recommends curl wget tar zip unzip patch perl openjdk-8-jdk autoconf automake libtool pkg-config - -# Android builds run config.guess early to determine BUILD and HOST. We need to add config.guess -# and config.sub now. Later, bootstrap_ldns.sh will handle the complete bootstrap of LDNS. - -echo "Adding config.guess" -if ! wget -q -O config.guess 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD'; then - echo "Failed to download config.guess" -fi - -echo "Adding config.sub" -if ! wget -q -O config.sub 'https://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD'; then - echo "Failed to download config.sub" -fi - -echo "Fixing config permissions" -chmod a+x config.guess config.sub -if [ -n "$(command -v xattr 2>/dev/null)" ]; then - xattr -d com.apple.quarantine config.guess 2>/dev/null - xattr -d com.apple.quarantine config.sub 2>/dev/null -fi diff --git a/contrib/android/setenv_android.sh b/contrib/android/setenv_android.sh deleted file mode 100755 index f45acb0f7ead..000000000000 --- a/contrib/android/setenv_android.sh +++ /dev/null @@ -1,203 +0,0 @@ -#!/usr/bin/env bash - -# ==================================================================== -# Sets the cross compile environment for Android -# -# Based upon OpenSSL's setenv-android.sh by TH, JW, and SM. -# Heavily modified by JWW for Crypto++. -# Updated by Skycoder42 for current recommendations for Android. -# Modified by JWW for LDNS. -# ==================================================================== - -######################################### -##### Some validation ##### -######################################### - -if [ -z "$ANDROID_API" ]; then - echo "ANDROID_API is not set. Please set it" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 -fi - -if [ -z "$ANDROID_CPU" ]; then - echo "ANDROID_CPU is not set. Please set it" - [[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1 -fi - -if [ ! -d "$ANDROID_NDK_ROOT" ]; then - echo "ERROR: ANDROID_NDK_ROOT is not a valid path. Please set it." - echo "NDK root is $ANDROID_NDK_ROOT" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# cryptest-android.sh may run this script without sourcing. -if [ "$0" = "${BASH_SOURCE[0]}" ]; then - echo "setenv-android.sh is usually sourced, but not this time." -fi - -##################################################################### - -# Need to set THIS_HOST to darwin-x86_64, linux-x86_64, -# windows, or windows-x86_64 - -if [[ "$(uname -s | grep -i -c darwin)" -ne 0 ]]; then - THIS_HOST=darwin-x86_64 -elif [[ "$(uname -s | grep -i -c linux)" -ne 0 ]]; then - THIS_HOST=linux-x86_64 -else - echo "ERROR: Unknown host" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -ANDROID_TOOLCHAIN="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$THIS_HOST/bin" -ANDROID_SYSROOT="$ANDROID_NDK_ROOT/toolchains/llvm/prebuilt/$THIS_HOST/sysroot" - -# Error checking -if [ ! -d "$ANDROID_TOOLCHAIN" ]; then - echo "ERROR: ANDROID_TOOLCHAIN is not a valid path. Please set it." - echo "Path is $ANDROID_TOOLCHAIN" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -d "$ANDROID_SYSROOT" ]; then - echo "ERROR: ANDROID_SYSROOT is not a valid path. Please set it." - echo "Path is $ANDROID_SYSROOT" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -##################################################################### - -THE_ARCH=$(tr '[:upper:]' '[:lower:]' <<< "$ANDROID_CPU") - -# https://developer.android.com/ndk/guides/abis.html -case "$THE_ARCH" in - armv7*|armeabi*) - CC="armv7a-linux-androideabi$ANDROID_API-clang" - CXX="armv7a-linux-androideabi$ANDROID_API-clang++" - LD="arm-linux-androideabi-ld" - AS="arm-linux-androideabi-as" - AR="arm-linux-androideabi-ar" - RANLIB="arm-linux-androideabi-ranlib" - STRIP="arm-linux-androideabi-strip" - - CFLAGS="-march=armv7-a -mthumb -mfloat-abi=softfp -funwind-tables -fexceptions" - CXXFLAGS="-march=armv7-a -mthumb -mfloat-abi=softfp -funwind-tables -fexceptions -frtti" - ;; - - armv8*|aarch64|arm64) - CC="aarch64-linux-android$ANDROID_API-clang" - CXX="aarch64-linux-android$ANDROID_API-clang++" - LD="aarch64-linux-android-ld" - AS="aarch64-linux-android-as" - AR="aarch64-linux-android-ar" - RANLIB="aarch64-linux-android-ranlib" - STRIP="aarch64-linux-android-strip" - - CFLAGS="-funwind-tables -fexceptions" - CXXFLAGS="-funwind-tables -fexceptions -frtti" - ;; - - x86) - CC="i686-linux-android$ANDROID_API-clang" - CXX="i686-linux-android$ANDROID_API-clang++" - LD="i686-linux-android-ld" - AS="i686-linux-android-as" - AR="i686-linux-android-ar" - RANLIB="i686-linux-android-ranlib" - STRIP="i686-linux-android-strip" - - CFLAGS="-mtune=intel -mssse3 -mfpmath=sse -funwind-tables -fexceptions" - CXXFLAGS="-mtune=intel -mssse3 -mfpmath=sse -funwind-tables -fexceptions -frtti" - ;; - - x86_64|x64) - CC="x86_64-linux-android$ANDROID_API-clang" - CXX="x86_64-linux-android$ANDROID_API-clang++" - LD="x86_64-linux-android-ld" - AS="x86_64-linux-android-as" - AR="x86_64-linux-android-ar" - RANLIB="x86_64-linux-android-ranlib" - STRIP="x86_64-linux-android-strip" - - CFLAGS="-march=x86-64 -msse4.2 -mpopcnt -mtune=intel -funwind-tables -fexceptions" - CXXFLAGS="-march=x86-64 -msse4.2 -mpopcnt -mtune=intel -funwind-tables -fexceptions -frtti" - ;; - - *) - echo "ERROR: Unknown architecture $ANDROID_CPU" - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 - ;; -esac - -##################################################################### - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$CC" ]; then - echo "ERROR: Failed to find Android clang. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$CXX" ]; then - echo "ERROR: Failed to find Android clang++. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$RANLIB" ]; then - echo "ERROR: Failed to find Android ranlib. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$AR" ]; then - echo "ERROR: Failed to find Android ar. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$AS" ]; then - echo "ERROR: Failed to find Android as. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -# Error checking -if [ ! -e "$ANDROID_TOOLCHAIN/$LD" ]; then - echo "ERROR: Failed to find Android ld. Please edit this script." - [ "$0" = "${BASH_SOURCE[0]}" ] && exit 1 || return 1 -fi - -##################################################################### - -LENGTH=${#ANDROID_TOOLCHAIN} -SUBSTR=${PATH:0:$LENGTH} -if [ "$SUBSTR" != "$ANDROID_TOOLCHAIN" ]; then - export PATH="$ANDROID_TOOLCHAIN:$PATH" -fi - -##################################################################### - -export CPP CC CXX LD AS AR RANLIB STRIP -export ANDROID_SYSROOT="$AOSP_SYSROOT" -export CPPFLAGS="-D__ANDROID_API__=$ANDROID_API" -export CFLAGS="$CFLAGS --sysroot=$AOSP_SYSROOT" -export CXXFLAGS="$CXXFLAGS -stdlib=libc++ --sysroot=$AOSP_SYSROOT" - -##################################################################### - -echo "ANDROID_TOOLCHAIN: $ANDROID_TOOLCHAIN" - -echo "CPP: $(command -v "$CPP")" -echo "CC: $(command -v "$CC")" -echo "CXX: $(command -v "$CXX")" -echo "LD: $(command -v "$LD")" -echo "AS: $(command -v "$AS")" -echo "AR: $(command -v "$AR")" - -echo "ANDROID_SYSROOT: $ANDROID_SYSROOT" - -echo "CPPFLAGS: $CPPFLAGS" -echo "CFLAGS: $CFLAGS" -echo "CXXFLAGS: $CXXFLAGS" - -[ "$0" = "${BASH_SOURCE[0]}" ] && exit 0 || return 0 |
