This repository has been archived on 2024-12-08. You can view files and clone it, but cannot push or open issues or pull requests.
PyBitmessage-2024-12-08/buildscripts/androiddev.sh

112 lines
4.2 KiB
Bash
Raw Permalink Normal View History

2021-12-15 07:44:37 +01:00
#!/bin/sh
2021-12-01 08:10:06 +01:00
ANDROID_HOME="/opt/android"
2021-12-15 07:44:37 +01:00
get_python_version=3
2021-12-01 08:10:06 +01:00
2021-12-15 07:44:37 +01:00
# INSTALL ANDROID PACKAGES
install_android_pkg ()
2021-12-01 08:10:06 +01:00
{
2021-12-15 07:44:37 +01:00
BUILDOZER_VERSION=1.2.0
CYTHON_VERSION=0.29.15
2021-12-01 08:10:06 +01:00
pip3 install buildozer==$BUILDOZER_VERSION
pip3 install --upgrade cython==$CYTHON_VERSION
}
# SYSTEM DEPENDENCIES
2021-12-15 07:44:37 +01:00
system_dependencies ()
2021-12-01 08:10:06 +01:00
{
2021-12-15 07:44:37 +01:00
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
2021-12-01 08:10:06 +01:00
apt -y autoremove
}
# build dependencies
# https://buildozer.readthedocs.io/en/latest/installation.html#android-on-ubuntu-16-04-64bit
2021-12-15 07:44:37 +01:00
build_dependencies ()
2021-12-01 08:10:06 +01:00
{
dpkg --add-architecture i386
2021-12-15 07:44:37 +01:00
apt -y update -qq
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
2021-12-01 08:10:06 +01:00
apt -y autoremove
apt -y clean
}
# RECIPES DEPENDENCIES
2021-12-15 07:44:37 +01:00
specific_recipes_dependencies ()
2021-12-01 08:10:06 +01:00
{
2021-12-15 07:44:37 +01:00
dpkg --add-architecture i386
2021-12-01 08:10:06 +01:00
apt -y update -qq
apt -y install -qq --no-install-recommends libffi-dev autoconf automake cmake gettext libltdl-dev libtool pkg-config
apt -y autoremove
apt -y clean
}
# INSTALL NDK
2021-12-15 07:44:37 +01:00
install_ndk()
{
ANDROID_NDK_VERSION=23b
2021-12-01 08:10:06 +01:00
ANDROID_NDK_HOME="${ANDROID_HOME}/android-ndk"
ANDROID_NDK_HOME_V="${ANDROID_NDK_HOME}-r${ANDROID_NDK_VERSION}"
# get the latest version from https://developer.android.com/ndk/downloads/index.html
2021-12-15 07:44:37 +01:00
ANDROID_NDK_ARCHIVE="android-ndk-r${ANDROID_NDK_VERSION}-linux.zip"
2021-12-01 08:10:06 +01:00
ANDROID_NDK_DL_URL="https://dl.google.com/android/repository/${ANDROID_NDK_ARCHIVE}"
wget -nc ${ANDROID_NDK_DL_URL}
2021-12-15 07:44:37 +01:00
mkdir --parents "${ANDROID_NDK_HOME_V}"
unzip -q "${ANDROID_NDK_ARCHIVE}" -d "${ANDROID_HOME}"
ln -sfn "${ANDROID_NDK_HOME_V}" "${ANDROID_NDK_HOME}"
2021-12-01 08:10:06 +01:00
rm -rf "${ANDROID_NDK_ARCHIVE}"
}
# INSTALL SDK
2021-12-23 08:03:14 +01:00
install_sdk()
2021-12-01 08:10:06 +01:00
{
2021-12-23 08:03:14 +01:00
ANDROID_SDK_BUILD_TOOLS_VERSION="29.0.2"
2021-12-01 08:10:06 +01:00
ANDROID_SDK_HOME="${ANDROID_HOME}/android-sdk"
# get the latest version from https://developer.android.com/studio/index.html
ANDROID_SDK_TOOLS_VERSION="4333796"
ANDROID_SDK_TOOLS_ARCHIVE="sdk-tools-linux-${ANDROID_SDK_TOOLS_VERSION}.zip"
ANDROID_SDK_TOOLS_DL_URL="https://dl.google.com/android/repository/${ANDROID_SDK_TOOLS_ARCHIVE}"
wget -nc ${ANDROID_SDK_TOOLS_DL_URL}
mkdir --parents "${ANDROID_SDK_HOME}"
unzip -q "${ANDROID_SDK_TOOLS_ARCHIVE}" -d "${ANDROID_SDK_HOME}"
rm -rf "${ANDROID_SDK_TOOLS_ARCHIVE}"
# update Android SDK, install Android API, Build Tools...
mkdir --parents "${ANDROID_SDK_HOME}/.android/"
echo '### Sources for Android SDK Manager' > "${ANDROID_SDK_HOME}/.android/repositories.cfg"
# accept Android licenses (JDK necessary!)
apt -y update -qq
2021-12-23 08:03:14 +01:00
apt -y install -qq --no-install-recommends openjdk-11-jdk
2021-12-01 08:10:06 +01:00
apt -y autoremove
yes | "${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
# download platforms, API, build tools
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-24" > /dev/null
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "platforms;android-28" > /dev/null
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "build-tools;${ANDROID_SDK_BUILD_TOOLS_VERSION}" > /dev/null
"${ANDROID_SDK_HOME}/tools/bin/sdkmanager" "extras;android;m2repository" > /dev/null
find /opt/android/android-sdk -type f -perm /0111 -print0|xargs -0 chmod a+x
chown -R buildbot.buildbot /opt/android/android-sdk
chmod +x "${ANDROID_SDK_HOME}/tools/bin/avdmanager"
}
# INSTALL APACHE-ANT
2021-12-23 08:03:14 +01:00
install_ant()
2021-12-01 08:10:06 +01:00
{
2021-12-23 08:03:14 +01:00
APACHE_ANT_VERSION="1.10.12"
2021-12-01 08:10:06 +01:00
APACHE_ANT_ARCHIVE="apache-ant-${APACHE_ANT_VERSION}-bin.tar.gz"
APACHE_ANT_DL_URL="http://archive.apache.org/dist/ant/binaries/${APACHE_ANT_ARCHIVE}"
APACHE_ANT_HOME="${ANDROID_HOME}/apache-ant"
APACHE_ANT_HOME_V="${APACHE_ANT_HOME}-${APACHE_ANT_VERSION}"
wget -nc ${APACHE_ANT_DL_URL}
tar -xf "${APACHE_ANT_ARCHIVE}" -C "${ANDROID_HOME}"
ln -sfn "${APACHE_ANT_HOME_V}" "${APACHE_ANT_HOME}"
rm -rf "${APACHE_ANT_ARCHIVE}"
}
system_dependencies
build_dependencies
specific_recipes_dependencies
install_android_pkg
install_ndk
install_sdk
install_ant