From 20292e5e63e59421de53f5ff8ca9d1ddce14082d Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sun, 20 May 2018 01:51:39 +0200 Subject: [PATCH 1/2] Build `testapp` using `setup_testapp_python3` Has the following requirements: sdl2,pyjnius,kivy,python3crystax Also updated Dockerfile to download and install CrystaX NDK. Refs #1263 --- .travis.yml | 1 + Dockerfile | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 5fe9942769..6322fbade6 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ env: # overrides requirements to skip `peewee` pure python module, see: # https://github.com/kivy/python-for-android/issues/1263#issuecomment-390421054 - COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python2_sqlite_openssl.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/android-ndk --requirements sdl2,pyjnius,kivy,python2,openssl,requests,sqlite3' + - COMMAND='. venv/bin/activate && cd testapps/ && python setup_testapp_python3.py apk --sdk-dir /opt/android/android-sdk --ndk-dir /opt/android/crystax-ndk' script: - docker run p4a /bin/sh -c "$COMMAND" diff --git a/Dockerfile b/Dockerfile index 183b972b2d..278b3acd8f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -16,16 +16,22 @@ FROM ubuntu:16.04 # get the latest version from https://developer.android.com/ndk/downloads/index.html ENV ANDROID_NDK_VERSION="16b" +# get the latest version from https://www.crystax.net/en/download +ENV CRYSTAX_NDK_VERSION="10.3.2" # get the latest version from https://developer.android.com/studio/index.html ENV ANDROID_SDK_TOOLS_VERSION="3859397" ENV ANDROID_HOME="/opt/android" ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk" \ + CRYSTAX_NDK_HOME="${ANDROID_HOME}/crystax-ndk" \ ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk" -ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" +ENV ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" \ + CRYSTAX_NDK_HOME_V="${CRYSTAX_NDK_HOME}-${CRYSTAX_NDK_VERSION}" ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip" \ + CRYSTAX_NDK_ARCHIVE="crystax-ndk-${CRYSTAX_NDK_VERSION}-linux-x86.tar.xz" \ ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip" ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}" \ + CRYSTAX_NDK_DL_URL="https://eu.crystax.net/download/${CRYSTAX_NDK_ARCHIVE}" \ ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}" # install system dependencies @@ -46,6 +52,11 @@ RUN curl --progress-bar "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE} unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" && \ ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}" +# download and install CrystaX NDK +RUN curl --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" && \ + tar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" && \ + ln -sfn "${CRYSTAX_NDK_HOME_V}" "${CRYSTAX_NDK_HOME}" + # download and install Android SDK RUN curl --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \ mkdir --parents "${ANDROID_SDK_HOME}" && \ From d013a86f624b81757f80363f3cea31f1ca3c793a Mon Sep 17 00:00:00 2001 From: Andre Miras Date: Sun, 20 May 2018 02:42:06 +0200 Subject: [PATCH 2/2] curl to follow redirects and use bsdtar On Travis CrystaX download is redirected from https://eu.crystax.net/download/crystax-ndk-10.3.2-linux-x86.tar.xz to https://us.crystax.net/download/crystax-ndk-10.3.2-linux-x86.tar.xz Adding `--location` flag makes it possible to automatically follow that redirect. Also replaced tar by bsdtar, since tar was failing with the following: ``` tar: crystax-ndk-10.3.2/sources/cpufeatures: Directory renamed before its status could be extracted ``` Plus excluded some folders from the extract command to save time and space. Reduces decompressed size from 7.6G to 6.3G. Also added `gnutls_handshake` flag to `curl` to workaround random `gnutls_handshake()` issues on CrystaX download only. The error was: ``` curl: (35) gnutls_handshake() failed: Error in the pull function. ``` --- Dockerfile | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/Dockerfile b/Dockerfile index 278b3acd8f..50bdd1859f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -36,7 +36,7 @@ ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_A # install system dependencies RUN apt update -qq && apt install -qq --yes --no-install-recommends \ - python virtualenv python-pip wget curl lbzip2 patch + python virtualenv python-pip wget curl lbzip2 patch bsdtar # build dependencies # https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit @@ -47,18 +47,27 @@ RUN dpkg --add-architecture i386 && apt update -qq && apt install -qq --yes --n RUN pip install --quiet --upgrade cython==0.21 # download and install Android NDK -RUN curl --progress-bar "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE}" && \ +RUN curl --location --progress-bar "${ANDROID_NDK_DL_URL}" --output "${ANDROID_NDK_ARCHIVE}" && \ mkdir --parents "${ANDROID_NDK_HOME_V}" && \ unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" && \ ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}" # download and install CrystaX NDK -RUN curl --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" && \ - tar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" && \ +# added `gnutls_handshake` flag to workaround random `gnutls_handshake()` issues +RUN curl --location --progress-bar "${CRYSTAX_NDK_DL_URL}" --output "${CRYSTAX_NDK_ARCHIVE}" --insecure && \ + bsdtar -xf "${CRYSTAX_NDK_ARCHIVE}" --directory "${ANDROID_HOME}" \ + --exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/docs \ + --exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/samples \ + --exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/tests \ + --exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/renderscript \ + --exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/x86_64-* \ + --exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/llvm-* \ + --exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/aarch64-* \ + --exclude=crystax-ndk-${CRYSTAX_NDK_VERSION}/toolchains/mips64el-* && \ ln -sfn "${CRYSTAX_NDK_HOME_V}" "${CRYSTAX_NDK_HOME}" # download and install Android SDK -RUN curl --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \ +RUN curl --location --progress-bar "${ANDROID_SDK_TOOLS_DL_URL}" --output "${ANDROID_SDK_TOOLS_ARCHIVE}" && \ mkdir --parents "${ANDROID_SDK_HOME}" && \ unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" -d "${ANDROID_SDK_HOME}"