From ceaa23792851758da1f5955eb7f5bf8352460cbc Mon Sep 17 00:00:00 2001 From: linsui <2873532-linsui@users.noreply.gitlab.com> Date: Sun, 29 Oct 2023 07:07:14 +0000 Subject: [PATCH] template: add buildozer template --- templates/README.md | 1 + templates/build-ant.yml | 2 ++ templates/build-buildozer.yml | 58 +++++++++++++++++++++++++++++++ templates/build-flutter.yml | 1 - templates/build-gradle.yml | 2 ++ templates/build-maven.yml | 3 +- templates/build-native-script.yml | 4 ++- 7 files changed, 68 insertions(+), 3 deletions(-) create mode 100644 templates/build-buildozer.yml diff --git a/templates/README.md b/templates/README.md index 4b225c1afa..7ec595e59e 100644 --- a/templates/README.md +++ b/templates/README.md @@ -5,3 +5,4 @@ This directory contains some templates for different kinds of apps. - [Ant](./build-ant.yml) - [Maven](./build-maven.yml) - [React Native](./build-react-native.yml) +- [Buildozer](./build-buildozer.yml) diff --git a/templates/build-ant.yml b/templates/build-ant.yml index ab8eb53314..2b0f1bd8d7 100644 --- a/templates/build-ant.yml +++ b/templates/build-ant.yml @@ -1,3 +1,5 @@ +# PLEASE REMOVE ALL COMMENTS BEFORE SUBMITTING TO F-DROID DATA! + Builds: - versionName: '1.0' versionCode: 1 diff --git a/templates/build-buildozer.yml b/templates/build-buildozer.yml new file mode 100644 index 0000000000..a80f1386a5 --- /dev/null +++ b/templates/build-buildozer.yml @@ -0,0 +1,58 @@ +# PLEASE REMOVE ALL COMMENTS BEFORE SUBMITTING TO F-DROID DATA! + +Builds: + - versionName: 1.0.0 + versionCode: 100000 + commit: v1.0.0 + subdir: src + sudo: + - apt-get update + # These packages are needed to build python, etc. + - apt-get install -y g++ libc-dev make automake libltdl-dev libtool zlib1g-dev + libffi-dev libssl-dev cython3 + # These packages are needed to install buildozer. + - apt-get install -y python3-pip python3-pexpect python3-virtualenv python3-sh + # These packages are needed to install p4a + - apt-get install -y -t bullseye-backports python3-appdirs python3-colorama python3-jinja2 python3-build + python3-toml python3-packaging + # Install ant so that it's not downloaded by buildozer + - apt-get install -y ant + - apt-get install -y openjdk-17-jdk-headless + - update-alternatives --auto java + # The old sdkmanager doesn't work with jdk 17 so we use the python sdkmanager. + # The buildozer doesn't use sdkmanager from path or the cmdline-tools. + - rm /opt/android-sdk/tools/bin/sdkmanager + - ln -s $(which sdkmanager) /opt/android-sdk/tools/bin/sdkmanager + # The old avdmanager doesn't work with jdk 17. + # It's used only to list targets so we use this simple script instead. + - echo -e '#!/usr/bin/sh\nls /opt/android-sdk/platforms | sed "s/android-/API + level:\ /g"' > /opt/android-sdk/tools/bin/avdmanager + - chmod +x /opt/android-sdk/tools/bin/avdmanager + output: bin/*.apk + srclibs: + # Python cross compiling requires a Python interpreter for the build platform. + # The version of the build Python must match the version of the cross compiled host Python. + - cpython@v3.8.18 + # Pin these versions instead of installing the latest versions from pypi. + - python-for-android@v2023.09.16 + - buildozer@1.5.0 + prebuild: + # We disable the auto downloading so install them manully. + - sdkmanager 'platforms;android-33' 'build-tools;33.0.0' + # We disable the auto downloading of Android SDK/NDK, p4a and ant. + - sed -i -e 's/log_level =.*/log_level = 1/' -e '/^\[app\]/aandroid.ndk_path + = $$NDK$$\nandroid.sdk_path = $$SDK$$\nandroid.skip_update = True\np4a.source_dir + = $$python-for-android$$\nandroid.ant_path = /usr' buildozer.spec + build: + - pushd $$cpython$$ + - ./configure --prefix=$HOME/.local + - make -j`nproc` + - make altinstall + - popd + - pip3 install $$buildozer$$ + # The buildozer checks cython but Debian cython3 package only provides cython3 command. + - ln -s $(which cython3) /home/vagrant/.local/bin/cython + - export PATH="$PATH:$HOME/.local/bin" + # Set the abi and version code here to split the abi if it's needed. + - APP_ANDROID_ARCH=arm64-v8a APP_ANDROID_NUMERIC_VERSION=$$VERCODE$$ buildozer android release + ndk: r25b diff --git a/templates/build-flutter.yml b/templates/build-flutter.yml index 6ea4927fc4..468f6f1adb 100644 --- a/templates/build-flutter.yml +++ b/templates/build-flutter.yml @@ -51,4 +51,3 @@ VercodeOperation: UpdateCheckData: pubspec.yaml|version:\s.+\+(\d+)|.|version:\s(.+)\+ CurrentVersion: '1.0' CurrentVersionCode: 11 - diff --git a/templates/build-gradle.yml b/templates/build-gradle.yml index 11eaf40108..d96bc7e7a8 100644 --- a/templates/build-gradle.yml +++ b/templates/build-gradle.yml @@ -1,3 +1,5 @@ +# PLEASE REMOVE ALL COMMENTS BEFORE SUBMITTING TO F-DROID DATA! + Builds: - versionName: '1.0' versionCode: 1 diff --git a/templates/build-maven.yml b/templates/build-maven.yml index 810599ae36..479a026604 100644 --- a/templates/build-maven.yml +++ b/templates/build-maven.yml @@ -1,3 +1,5 @@ +# PLEASE REMOVE ALL COMMENTS BEFORE SUBMITTING TO F-DROID DATA! + Builds: - versionName: '1.0' versionCode: 1 @@ -7,6 +9,5 @@ Builds: # Maven is not installed by default - apt-get install -y maven maven: 'yes' - # As with all build methods, use `subdir: app` if the app resides under a # subdirectory called "app". diff --git a/templates/build-native-script.yml b/templates/build-native-script.yml index fb102bd7a9..e606ebbb04 100644 --- a/templates/build-native-script.yml +++ b/templates/build-native-script.yml @@ -1,3 +1,5 @@ +# PLEASE REMOVE ALL COMMENTS BEFORE SUBMITTING TO F-DROID DATA! + Builds: - versionName: 2.0.2 versionCode: 3 @@ -47,4 +49,4 @@ Builds: - echo "The following files were found:" - find -maxdepth 1 -type f -name "*.apk") # Please adjust the NDK version as needed, sync these [1] - ndk: r20b \ No newline at end of file + ndk: r20b