update androiddev.sh for docker

This commit is contained in:
surbhicis 2021-12-15 12:14:37 +05:30
parent 8d779f3760
commit 05046154da
Signed by untrusted user: surbhicis
GPG Key ID: 48A8C2D218DE7B0B
2 changed files with 31 additions and 57 deletions

View File

@ -1,66 +1,40 @@
#!/bin/bash #!/bin/sh
ANDROID_HOME="/opt/android" ANDROID_HOME="/opt/android"
get_python_version=$@ get_python_version=3
# INSTALL ANDROID PACKAGES # INSTALL ANDROID PACKAGES
function install_android_pkg () install_android_pkg ()
{ {
if [[ "$get_python_version" -eq " 2 " ]]; BUILDOZER_VERSION=1.2.0
then
BUILDOZER_VERSION=0.39
CYTHON_VERSION=0.28.6
elif [[ "$get_python_version" -eq " 3 " ]];
then
BUILDOZER_VERSION=1.0
CYTHON_VERSION=0.29.15 CYTHON_VERSION=0.29.15
else
exit
fi
pip3 install buildozer==$BUILDOZER_VERSION pip3 install buildozer==$BUILDOZER_VERSION
pip3 install --upgrade cython==$CYTHON_VERSION pip3 install --upgrade cython==$CYTHON_VERSION
} }
# SYSTEM DEPENDENCIES # SYSTEM DEPENDENCIES
function system_dependencies () system_dependencies ()
{ {
if [[ "$get_python_version" -eq " 2 " ]];
then
apt -y update -qq
apt -y install -qq --no-install-recommends python virtualenv python-pip python-setuptools python-wheel git wget unzip lbzip2 patch sudo software-properties-common
elif [[ "$get_python_version" -eq " 3 " ]];
then
apt -y update -qq apt -y update -qq
apt -y install --no-install-recommends python3-pip pip3 python3 virtualenv python3-setuptools python3-wheel git wget unzip sudo patch bzip2 lzma apt -y install --no-install-recommends python3-pip pip3 python3 virtualenv python3-setuptools python3-wheel git wget unzip sudo patch bzip2 lzma
else
exit
fi
apt -y autoremove apt -y autoremove
} }
# build dependencies # build dependencies
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit # https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
function build_dependencies () build_dependencies ()
{ {
dpkg --add-architecture i386 dpkg --add-architecture i386
apt -y update -qq apt -y update -qq
if [[ "$get_python_version" -eq " 2 " ]];
then
apt -y install -qq --no-install-recommends build-essential ccache git python python-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
elif [[ "$get_python_version" -eq " 3 " ]];
then
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 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
else
exit
fi
apt -y autoremove apt -y autoremove
apt -y clean apt -y clean
} }
# RECIPES DEPENDENCIES # RECIPES DEPENDENCIES
function specific_recipes_dependencies () specific_recipes_dependencies ()
{ {
dpkg --add-architecture i386
apt -y update -qq apt -y update -qq
apt -y install -qq --no-install-recommends libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config apt -y install -qq --no-install-recommends libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config
apt -y autoremove apt -y autoremove
@ -68,24 +42,14 @@ function specific_recipes_dependencies ()
} }
# INSTALL NDK # INSTALL NDK
function install_ndk() install_ndk()
{ {
if [[ "$get_python_version" -eq " 2 " ]]; ANDROID_NDK_VERSION=23b
then
ANDROID_NDK_VERSION="17c"
elif [[ "$get_python_version" -eq " 3 " ]];
then
ANDROID_NDK_VERSION=21
else
# echo "-----"
exit
fi
ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk" ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}" ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}"
# get the latest version from https://developer.android.com/ndk/downloads/index.html # get the latest version from https://developer.android.com/ndk/downloads/index.html
ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux-x86_64.zip" ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux.zip"
ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}" ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"
echo "Downloading ndk.........................................................................."
wget -nc ${ANDROID_NDK_DL_URL} wget -nc ${ANDROID_NDK_DL_URL}
mkdir --parents "${ANDROID_NDK_HOME_V}" mkdir --parents "${ANDROID_NDK_HOME_V}"
unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}" unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}"

View File

@ -103,3 +103,13 @@ RUN VERSION=$(python setup.py -V) \
RUN buildscripts/appimage.sh RUN buildscripts/appimage.sh
RUN VERSION=$(python setup.py -V) \ RUN VERSION=$(python setup.py -V) \
&& out/PyBitmessage-${VERSION}.glibc2.15-x86_64.AppImage --appimage-extract-and-run -t && out/PyBitmessage-${VERSION}.glibc2.15-x86_64.AppImage --appimage-extract-and-run -t
FROM base AS appandroid
COPY . /home/builder/src
WORKDIR /home/builder/src
RUN chmod +x buildscripts/androiddev.sh
RUN buildscripts/androiddev.sh