Skip to content

Commit

Permalink
Merge branch 'master' into enhance-rebuild-recipes
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreMiras authored Feb 9, 2019
2 parents c4424cf + db53ef6 commit e0dfdc3
Show file tree
Hide file tree
Showing 199 changed files with 8,185 additions and 3,649 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ services:
- docker

before_install:
- sudo apt update -qq
- sudo apt install -qq --no-install-recommends python2.7 python3
- travis_retry sudo apt update -qq
- travis_retry sudo apt install -qq --no-install-recommends python2.7 python3
- sudo pip install tox>=2.0
# https://github.com/travis-ci/travis-ci/issues/6069#issuecomment-266546552
- git remote set-branches --add origin master
Expand All @@ -31,5 +31,5 @@ before_script:
- tox

script:
- docker build --tag=p4a --file Dockerfile.py2 .
- docker build --tag=p4a --file Dockerfile.py3 .
- docker run p4a /bin/sh -c "$COMMAND"
61 changes: 33 additions & 28 deletions Dockerfile.py2
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# - python-for-android dependencies
#
# Build with:
# docker build --tag=p4a --file Dockerfile.py2 .
# docker build --tag=p4apy2 --file Dockerfile.py2 .
#
# Run with:
# docker run -it --rm p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
# docker run -it --rm p4apy2 /bin/sh -c '. venv/bin/activate && p4a apk --help'
#
# Or for interactive shell:
# docker run -it --rm p4a
# docker run -it --rm p4apy2
#
# Note:
# Use 'docker run' without '--rm' flag for keeping the container and use
Expand All @@ -19,11 +19,23 @@ FROM ubuntu:18.04

ENV ANDROID_HOME="/opt/android"

# configure locale
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \
locales && \
locale-gen en_US.UTF-8
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends curl unzip \
&& apt -y autoremove \
&& apt -y clean
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
&& apt -y autoremove

# retry helper script, refs:
# https://github.com/kivy/python-for-android/issues/1306
ENV RETRY="retry -t 3 --"
RUN curl https://raw.githubusercontent.com/kadwanev/retry/1.0.1/retry \
--output /usr/local/bin/retry && chmod +x /usr/local/bin/retry

ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
ENV ANDROID_NDK_VERSION="17c"
Expand All @@ -34,7 +46,7 @@ ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"

# download and install Android NDK
RUN curl --location --progress-bar --insecure \
RUN ${RETRY} curl --location --progress-bar --insecure \
"${ANDROID_NDK_DL_URL}" \
--output "${ANDROID_NDK_ARCHIVE}" \
&& mkdir --parents "${ANDROID_NDK_HOME_V}" \
Expand All @@ -47,11 +59,12 @@ ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"

# get the latest version from https://developer.android.com/studio/index.html
ENV ANDROID_SDK_TOOLS_VERSION="3859397"
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="26.0.2"
ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"

# download and install Android SDK
RUN curl --location --progress-bar --insecure \
RUN ${RETRY} curl --location --progress-bar --insecure \
"${ANDROID_SDK_TOOLS_DL_URL}" \
--output "${ANDROID_SDK_TOOLS_ARCHIVE}" \
&& mkdir --parents "${ANDROID_SDK_HOME}" \
Expand All @@ -64,16 +77,14 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"

# accept Android licenses (JDK necessary!)
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends openjdk-8-jdk \
&& apt -y autoremove \
&& apt -y clean
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" --licenses > /dev/null
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
&& apt -y autoremove
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null

# download platforms, API, build tools
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;26.0.2" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" && \
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"


Expand All @@ -83,27 +94,23 @@ ENV WORK_DIR="${HOME_DIR}" \
PATH="${HOME_DIR}/.local/bin:${PATH}"

# install system dependencies
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends \
RUN ${RETRY} apt -y install -qq --no-install-recommends \
python virtualenv python-pip wget lbzip2 patch sudo \
&& apt -y autoremove \
&& apt -y clean
&& apt -y autoremove

# build dependencies
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
RUN dpkg --add-architecture i386 \
&& apt -y update -qq \
&& apt -y install -qq --no-install-recommends \
&& ${RETRY} apt -y update -qq \
&& ${RETRY} apt -y install -qq --no-install-recommends \
build-essential ccache git python2.7 python2.7-dev \
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
zip zlib1g-dev zlib1g:i386 \
&& apt -y autoremove \
&& apt -y clean
&& apt -y autoremove

# specific recipes dependencies (e.g. libffi requires autoreconf binary)
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends \
RUN ${RETRY} apt -y install -qq --no-install-recommends \
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
&& apt -y autoremove \
&& apt -y clean
Expand All @@ -120,10 +127,8 @@ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN pip install --upgrade cython==0.28.6

WORKDIR ${WORK_DIR}
COPY . ${WORK_DIR}

# user needs ownership/write access to these directories
RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME}
COPY --chown=user:user . ${WORK_DIR}
RUN chown --recursive ${USER} ${ANDROID_SDK_HOME}
USER ${USER}

# install python-for-android from current branch
Expand Down
61 changes: 33 additions & 28 deletions Dockerfile.py3
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
# - python-for-android dependencies
#
# Build with:
# docker build --tag=p4apy3 .
# docker build --tag=p4a --file Dockerfile.py3 .
#
# Run with:
# docker run -it --rm p4apy3 /bin/sh -c '. venv/bin/activate && p4a apk --help'
# docker run -it --rm p4a /bin/sh -c '. venv/bin/activate && p4a apk --help'
#
# Or for interactive shell:
# docker run -it --rm p4apy3
# docker run -it --rm p4a
#
# Note:
# Use 'docker run' without '--rm' flag for keeping the container and use
Expand All @@ -19,11 +19,23 @@ FROM ubuntu:18.04

ENV ANDROID_HOME="/opt/android"

# configure locale
RUN apt update -qq > /dev/null && apt install -qq --yes --no-install-recommends \
locales && \
locale-gen en_US.UTF-8
ENV LANG="en_US.UTF-8" \
LANGUAGE="en_US.UTF-8" \
LC_ALL="en_US.UTF-8"

RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends curl unzip \
&& apt -y autoremove \
&& apt -y clean
&& apt -y install -qq --no-install-recommends curl unzip ca-certificates \
&& apt -y autoremove

# retry helper script, refs:
# https://github.com/kivy/python-for-android/issues/1306
ENV RETRY="retry -t 3 --"
RUN curl https://raw.githubusercontent.com/kadwanev/retry/1.0.1/retry \
--output /usr/local/bin/retry && chmod +x /usr/local/bin/retry

ENV ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
ENV ANDROID_NDK_VERSION="17c"
Expand All @@ -34,7 +46,7 @@ ENV ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip"
ENV ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"

# download and install Android NDK
RUN curl --location --progress-bar --insecure \
RUN ${RETRY} curl --location --progress-bar --insecure \
"${ANDROID_NDK_DL_URL}" \
--output "${ANDROID_NDK_ARCHIVE}" \
&& mkdir --parents "${ANDROID_NDK_HOME_V}" \
Expand All @@ -47,11 +59,12 @@ ENV ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"

# get the latest version from https://developer.android.com/studio/index.html
ENV ANDROID_SDK_TOOLS_VERSION="3859397"
ENV ANDROID_SDK_BUILD_TOOLS_VERSION="26.0.2"
ENV ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
ENV ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"

# download and install Android SDK
RUN curl --location --progress-bar --insecure \
RUN ${RETRY} curl --location --progress-bar --insecure \
"${ANDROID_SDK_TOOLS_DL_URL}" \
--output "${ANDROID_SDK_TOOLS_ARCHIVE}" \
&& mkdir --parents "${ANDROID_SDK_HOME}" \
Expand All @@ -64,16 +77,14 @@ RUN mkdir --parents "${ANDROID_SDK_HOME}/.android/" \
> "${ANDROID_SDK_HOME}/.android/repositories.cfg"

# accept Android licenses (JDK necessary!)
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends openjdk-8-jdk \
&& apt -y autoremove \
&& apt -y clean
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" --licenses > /dev/null
RUN ${RETRY} apt -y install -qq --no-install-recommends openjdk-8-jdk \
&& apt -y autoremove
RUN yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null

# download platforms, API, build tools
RUN "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-19" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-27" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;26.0.2" && \
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" && \
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"


Expand All @@ -83,27 +94,23 @@ ENV WORK_DIR="${HOME_DIR}" \
PATH="${HOME_DIR}/.local/bin:${PATH}"

# install system dependencies
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends \
RUN ${RETRY} apt -y install -qq --no-install-recommends \
python3 virtualenv python3-pip wget lbzip2 patch sudo \
&& apt -y autoremove \
&& apt -y clean
&& apt -y autoremove

# build dependencies
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
RUN dpkg --add-architecture i386 \
&& apt -y update -qq \
&& apt -y install -qq --no-install-recommends \
&& ${RETRY} apt -y update -qq \
&& ${RETRY} apt -y install -qq --no-install-recommends \
build-essential ccache git python3 python3-dev \
libncurses5:i386 libstdc++6:i386 libgtk2.0-0:i386 \
libpangox-1.0-0:i386 libpangoxft-1.0-0:i386 libidn11:i386 \
zip zlib1g-dev zlib1g:i386 \
&& apt -y autoremove \
&& apt -y clean
&& apt -y autoremove

# specific recipes dependencies (e.g. libffi requires autoreconf binary)
RUN apt -y update -qq \
&& apt -y install -qq --no-install-recommends \
RUN ${RETRY} apt -y install -qq --no-install-recommends \
libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config \
&& apt -y autoremove \
&& apt -y clean
Expand All @@ -120,10 +127,8 @@ RUN echo "%sudo ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
RUN pip3 install --upgrade cython==0.28.6

WORKDIR ${WORK_DIR}
COPY . ${WORK_DIR}

# user needs ownership/write access to these directories
RUN chown --recursive ${USER} ${WORK_DIR} ${ANDROID_SDK_HOME}
COPY --chown=user:user . ${WORK_DIR}
RUN chown --recursive ${USER} ${ANDROID_SDK_HOME}
USER ${USER}

# install python-for-android from current branch
Expand Down
2 changes: 1 addition & 1 deletion MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ prune doc/build
recursive-include pythonforandroid *.py *.tmpl biglink liblink
recursive-include pythonforandroid/recipes *.py *.patch *.c *.pyx Setup *.h

recursive-include pythonforandroid/bootstraps *.properties *.xml *.java *.tmpl *.txt *.png *.aidl *.py *.sh *.c *.h *.html
recursive-include pythonforandroid/bootstraps *.properties *.xml *.java *.tmpl *.txt *.png *.aidl *.py *.sh *.c *.h *.html *.patch

prune .git
prune pythonforandroid/bootstraps/pygame/build/libs
Loading

0 comments on commit e0dfdc3

Please sign in to comment.