From: George Thessalonikefs Date: Mon, 2 Mar 2020 14:09:07 +0000 (+0100) Subject: - Merge PR #174: Add Android to Travis testing, by noloader. X-Git-Tag: 1.11.0rc1~114^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f4eaf6c0ff2c181fe127d29789c57ba60ac5f731;p=thirdparty%2Funbound.git - Merge PR #174: Add Android to Travis testing, by noloader. - Move android build scripts to contrib/ and allow android tests to fail. --- diff --git a/.travis.yml b/.travis.yml index 61c13f6d5..5fe4735a5 100644 --- a/.travis.yml +++ b/.travis.yml @@ -133,6 +133,20 @@ jobs: - ANDROID_SDK_ROOT="$HOME/android-sdk" - ANDROID_NDK_ROOT="$HOME/android-ndk" + allow_failures: + - os: linux + arch: amd64 + name: Android armv7a, Linux, Amd64 + - os: linux + arch: amd64 + name: Android aarch64, Linux, Amd64 + - os: linux + arch: amd64 + name: Android x86, Linux, Amd64 + - os: linux + arch: amd64 + name: Android x86_64, Linux, Amd64 + script: - | if [ "$TEST_UBSAN" = "yes" ]; then @@ -143,19 +157,19 @@ script: ./configure elif [ "$TEST_ANDROID" = "yes" ]; then export AUTOTOOLS_BUILD="$(./config.guess)" - if ! ./android/install_ndk.sh ; then + if ! ./contrib/android/install_ndk.sh ; then echo "Failed to install Android SDK and NDK" exit 1 fi - if ! source ./android/setenv_android.sh "$ANDROID_CPU"; then + if ! source ./contrib/android/setenv_android.sh "$ANDROID_CPU"; then echo "Failed to set Android environment" exit 1 fi - if ! ./android/install_openssl.sh; then + if ! ./contrib/android/install_openssl.sh; then echo "Failed to build and install OpenSSL" exit 1 fi - if ! ./android/install_expat.sh; then + if ! ./contrib/android/install_expat.sh; then echo "Failed to build and install Expat" exit 1 fi diff --git a/README-Travis.md b/README-Travis.md index 4978e5282..631a4a45b 100644 --- a/README-Travis.md +++ b/README-Travis.md @@ -71,11 +71,11 @@ export ANDROID_SDK_ROOT="$HOME/android-sdk" export ANDROID_NDK_ROOT="$HOME/android-ndk" ``` -The second step installs the NDK and SDK. This step is handled in by the script `android/install_ndk.sh`. The script uses `ANDROID_NDK_ROOT` and `ANDROID_SDK_ROOT` to place the NDK and SDK in the `$HOME` directory. +The second step installs the NDK and SDK. This step is handled in by the script `contrib/android/install_ndk.sh`. The script uses `ANDROID_NDK_ROOT` and `ANDROID_SDK_ROOT` to place the NDK and SDK in the `$HOME` directory. -The third step sets the cross-compile environment using the script `android/setenv_android.sh`. The script is `sourced` so the variables set in the script are available to the calling shell. The script sets variables like `CC`, `CXX`, `AS` and `AR`; sets `CFLAGS` and `CXXFLAGS`; sets a `sysroot` so Android headers and libraries are found; and adds the path to the toolchain to `PATH`. +The third step sets the cross-compile environment using the script `contrib/android/setenv_android.sh`. The script is `sourced` so the variables set in the script are available to the calling shell. The script sets variables like `CC`, `CXX`, `AS` and `AR`; sets `CFLAGS` and `CXXFLAGS`; sets a `sysroot` so Android headers and libraries are found; and adds the path to the toolchain to `PATH`. -`setenv_android.sh` knows which toolchain and architecture to select by inspecting environmental variables set by Travis for the job. In particular, the variables `ANDROID_CPU` and `ANDROID_API` tell `setenv_android.sh` what tools and libraries to select. For example, below is part of the Aarch64 recipe. +`contrib/android/setenv_android.sh` knows which toolchain and architecture to select by inspecting environmental variables set by Travis for the job. In particular, the variables `ANDROID_CPU` and `ANDROID_API` tell `contrib/android/setenv_android.sh` what tools and libraries to select. For example, below is part of the Aarch64 recipe. ``` - os: linux @@ -91,7 +91,7 @@ The third step sets the cross-compile environment using the script `android/sete - ANDROID_API=23 ``` -The `setenv_android.sh` script specifies the tools in a `case` statement like the following. There is a case for each of the architectures armv7a, aarch64, x86 and x86_64. +The `contrib/android/setenv_android.sh` script specifies the tools in a `case` statement like the following. There is a case for each of the architectures armv7a, aarch64, x86 and x86_64. ``` armv8a|aarch64|arm64|arm64-v8a) @@ -113,19 +113,19 @@ Finally, once all the variables are set the Travis script cross-compiles OpenSSL elif [ "$TEST_ANDROID" = "yes" ]; then # AUTOTOOLS_HOST is set in the job export AUTOTOOLS_BUILD="$(./config.guess)" - if ! ./android/install_ndk.sh ; then + if ! ./contrib/android/install_ndk.sh ; then echo "Failed to install Android SDK and NDK" exit 1 fi - if ! source ./android/setenv_android.sh "$ANDROID_CPU"; then + if ! source ./contrib/android/setenv_android.sh "$ANDROID_CPU"; then echo "Failed to set Android environment" exit 1 fi - if ! ./android/install_openssl.sh; then + if ! ./contrib/android/install_openssl.sh; then echo "Failed to build and install OpenSSL" exit 1 fi - if ! ./android/install_expat.sh; then + if ! ./contrib/android/install_expat.sh; then echo "Failed to build and install Expat" exit 1 fi @@ -150,7 +150,7 @@ Note the `--prefix="$ANDROID_SYSROOT"` used by OpenSSL, Expat and Unbound. This ## Android flags -`android/setenv_android.sh` uses specific flags for `CFLAGS` and `CXXFLAGS`. The flags are not arbitrary; they are taken from the `ndk-build` tool. It is important to use the same flags across projects to avoid subtle problems due to mixing and matching different flags. +`contrib/android/setenv_android.sh` uses specific flags for `CFLAGS` and `CXXFLAGS`. The flags are not arbitrary; they are taken from the `ndk-build` tool. It is important to use the same flags across projects to avoid subtle problems due to mixing and matching different flags. `CXXFLAGS` includes `-fexceptions` because exceptions are disabled by default. `CFLAGS` include `-funwind-tables` and `-fexceptions` to ensure C++ exceptions pass through C code, if needed. Also see `docs/CPLUSPLUS—SUPPORT.html` in the NDK docs. diff --git a/android/15-android.conf b/contrib/android/15-android.conf similarity index 100% rename from android/15-android.conf rename to contrib/android/15-android.conf diff --git a/android/install_expat.sh b/contrib/android/install_expat.sh similarity index 100% rename from android/install_expat.sh rename to contrib/android/install_expat.sh diff --git a/android/install_ndk.sh b/contrib/android/install_ndk.sh similarity index 100% rename from android/install_ndk.sh rename to contrib/android/install_ndk.sh diff --git a/android/install_openssl.sh b/contrib/android/install_openssl.sh similarity index 94% rename from android/install_openssl.sh rename to contrib/android/install_openssl.sh index 0377cc9fa..64d87e313 100755 --- a/android/install_openssl.sh +++ b/contrib/android/install_openssl.sh @@ -22,7 +22,7 @@ fi cd openssl-1.1.1d || exit 1 # Damn OpenSSL devs... They just make the shit up as they go... -if ! cp ../android/15-android.conf Configurations/; then +if ! cp ../contrib/android/15-android.conf Configurations/; then echo "Failed to copy OpenSSL Android config" exit 1 fi diff --git a/android/setenv_android.sh b/contrib/android/setenv_android.sh similarity index 100% rename from android/setenv_android.sh rename to contrib/android/setenv_android.sh diff --git a/doc/Changelog b/doc/Changelog index 5cf0ac716..232bf40f3 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -4,6 +4,8 @@ 2 March 2020: George - Fix compiler warning in dns64/dns64.c + - Merge PR #174: Add Android to Travis testing, by noloader. + - Move android build scripts to contrib/ and allow android tests to fail. 2 March 2020: Wouter - Fix #177: dnstap does not build on macOS.