Skip to content

Commit

Permalink
new branch
Browse files Browse the repository at this point in the history
  • Loading branch information
danryu committed Jul 17, 2024
1 parent 1284871 commit be157c8
Show file tree
Hide file tree
Showing 706 changed files with 99,942 additions and 9,723 deletions.
35 changes: 35 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: bug
assignees: ''
---

**Describe the bug**

<!-- A clear and concise description of what the bug is. -->

**To Reproduce**

<!-- Steps to reproduce the behavior: -->

**Expected behavior**

<!-- A clear and concise description of what you expected to happen. -->

**Screenshots**

<!-- If applicable, add screenshots to help explain your problem. -->

**Operating system**

<!-- Add the operating system you are running, e.g. Windows 10 Version 20H2, macOS 10.15.5, Ubuntu Linux 20.10. Also add where you got Jamulus from, e.g. if you downloaded it from the internet, if you got it from your Linux distribution or if you built from source. -->

**Version of Jamulus**

<!-- Get this from the Help > About menu or from the `Jamulus --version` command line -->

**Additional context**

<!-- Add any other context about the problem here. -->
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
contact_links:
- name: Support Request or Question
url: https://github.com/jamulussoftware/jamulus/discussions/new
about: Please ask questions by opening a new Discussion.

- name: Idea/Feature Request
url: https://github.com/jamulussoftware/jamulus/discussions/new
about: Please open a Discussion if you have ideas for new features or functions.
24 changes: 24 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
name: Specified Feature
about: Agreed specification for a feature or enhancement
title: ''
labels: 'feature request'
assignees: ''
---

**What is the current behaviour and why should it be changed?**

<!-- Please give a precise description of the status quo and why this is not optimal. -->

**Describe possible approaches**

<!--
List possible approaches with pros and cons, reference any relevant discussion threads if possible, and consider tagging the main participants.
Please note the contribution guidelines (https://github.com/jamulussoftware/jamulus/blob/main/CONTRIBUTING.md), especially the part about "keeping it simple and stupid".
-->

<!-- Describe the solution you'd like -->

**Has this feature been discussed and generally agreed?**

<!-- Don't worry about requesting something that hasn't been discussed - we'll just move it to Discussion if we think it's unclear. But ideally, issues should have an agreed, clear specification such that anyone could action it without much help. -->
10 changes: 10 additions & 0 deletions .github/autobuild/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Scripts for building Jamulus via GitHub Actions

The scripts in this folder are used by the Github autobuild actions in .github/workflows/autobuild.yml.
They are responsible for setting up the Github environment, building the binaries and passing the resulting artifacts back to the workflow.

The scripts may work outside of Github, but haven't been designed or tested for that use case.
Some of the scripts modify global system settings, install software or create files in directories which are usually managed by package managers.
In short: They should probably only used in throw-away environments.

See the various platform-specific build scripts in their own folders for standalone builds (e.g. windows/deploy_windows.ps1).
231 changes: 103 additions & 128 deletions .github/autobuild/android.sh
Original file line number Diff line number Diff line change
@@ -1,174 +1,149 @@
#!/bin/bash
##############################################################################
# Copyright (c) 2022-2024
#
# Author(s):
# Christian Hoffmann
# The Jamulus Development Team
#
##############################################################################
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or (at your option) any later
# version.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
# details.
#
# You should have received a copy of the GNU General Public License along with
# this program; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
#
##############################################################################

set -eu

## From https://github.com/actions/runner-images/blob/main/images/linux/Ubuntu2204-Readme.md
# Tools already installed:
# Android Command Line Tools 7.0
# Android SDK Build-tools 33.0.0
# Android SDK Platform-Tools 33.0.3
# Android SDK Platforms android-33 (rev 2)
# Android SDK Tools 26.1.1

# Env vars set:
# ANDROID_HOME /usr/local/lib/android/sdk
# ANDROID_NDK /usr/local/lib/android/sdk/ndk/25.1.8937393
# ANDROID_NDK_HOME /usr/local/lib/android/sdk/ndk/25.1.8937393
# ANDROID_NDK_LATEST_HOME /usr/local/lib/android/sdk/ndk/25.1.8937393
# ANDROID_NDK_ROOT /usr/local/lib/android/sdk/ndk/25.1.8937393
# ANDROID_SDK_ROOT /usr/local/lib/android/sdk

ANDROID_PLATFORM=android-33
AQTINSTALL_VERSION=3.0.1
QT_VERSION=6.4.1
# Some of the following version pinnings are semi-automatically checked for
# updates. Update .github/workflows/bump-dependencies.yaml when renaming those:
COMMANDLINETOOLS_VERSION=6858069
ANDROID_NDK_VERSION=r21d
ANDROID_PLATFORM=android-30
ANDROID_BUILD_TOOLS=30.0.2
AQTINSTALL_VERSION=3.1.16
QT_VERSION=5.15.2

# Only variables which are really needed by sub-commands are exported.
# Definitions have to stay in a specific order due to dependencies.
QT_BASEDIR="/opt/Qt"
ANDROID_BASEDIR="/opt/android"
BUILD_DIR=build
export ANDROID_SDK_ROOT="${ANDROID_BASEDIR}/android-sdk"
COMMANDLINETOOLS_DIR="${ANDROID_SDK_ROOT}"/cmdline-tools/latest/
export ANDROID_NDK_ROOT="${ANDROID_BASEDIR}/android-ndk"
ANDROID_NDK_HOST="linux-x86_64"
# Only variables which are really needed by sub-commands are exported.
export JAVA_HOME=${JAVA_HOME_11_X64}
ANDROID_SDKMANAGER="${COMMANDLINETOOLS_DIR}/bin/sdkmanager"
export JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
export PATH="${PATH}:${ANDROID_SDK_ROOT}/tools"
export PATH="${PATH}:${ANDROID_SDK_ROOT}/platform-tools"

if [[ ! ${KOORD_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable KOORD_BUILD_VERSION has to be set to a valid version string"
if [[ ! ${JAMULUS_BUILD_VERSION:-} =~ [0-9]+\.[0-9]+\.[0-9]+ ]]; then
echo "Environment variable JAMULUS_BUILD_VERSION has to be set to a valid version string"
exit 1
fi

setup_ubuntu_dependencies() {
export DEBIAN_FRONTEND="noninteractive"

sudo apt-get -qq update
sudo apt-get -qq --no-install-recommends -y install \
build-essential zip unzip bzip2 p7zip-full curl chrpath
# openjdk-11-jdk-headless
sudo apt-get -qq --no-install-recommends -y install build-essential zip unzip bzip2 p7zip-full curl chrpath openjdk-8-jdk-headless
}

setup_android_sdk() {
mkdir -p "${ANDROID_BASEDIR}"

if [[ -d "${COMMANDLINETOOLS_DIR}" ]]; then
echo "Using commandlinetools installation from previous run (actions/cache)"
else
mkdir -p "${COMMANDLINETOOLS_DIR}"
curl -s -o downloadfile "https://dl.google.com/android/repository/commandlinetools-linux-${COMMANDLINETOOLS_VERSION}_latest.zip"
unzip -q downloadfile
mv cmdline-tools/* "${COMMANDLINETOOLS_DIR}"
fi

yes | "${ANDROID_SDKMANAGER}" --licenses
"${ANDROID_SDKMANAGER}" --update
"${ANDROID_SDKMANAGER}" "platforms;${ANDROID_PLATFORM}"
"${ANDROID_SDKMANAGER}" "build-tools;${ANDROID_BUILD_TOOLS}"
}

setup_android_ndk() {
mkdir -p "${ANDROID_BASEDIR}"
if [[ -d "${ANDROID_NDK_ROOT}" ]]; then
echo "Using NDK installation from previous run (actions/cache)"
else
curl -s -o downloadfile "https://dl.google.com/android/repository/android-ndk-${ANDROID_NDK_VERSION}-linux-x86_64.zip"
unzip -q downloadfile
mv "android-ndk-${ANDROID_NDK_VERSION}" "${ANDROID_NDK_ROOT}"
fi
}

setup_qt() {
if [[ -d "${QT_BASEDIR}" ]]; then
echo "Using Qt installation from previous run (actions/cache)"
else
echo "Installing Qt..."
# python3 -m pip install "aqtinstall==${AQTINSTALL_VERSION}"
# # icu needs explicit installation
# # otherwise: "qmake: error while loading shared libraries: libicui18n.so.56: cannot open shared object file: No such file or directory"
# python3 -m aqt install-qt --outputdir "${QT_BASEDIR}" linux desktop "${QT_VERSION}" \
# --archives qtbase qtdeclarative qtsvg qttools icu

mkdir -p ${QT_BASEDIR}/${QT_VERSION}

# # Install Qt from Android build release
wget -q https://github.com/koord-live/koord-app/releases/download/androidqt_${QT_VERSION}/qt_android_${QT_VERSION}.tar.gz \
-O /tmp/qt_android_${QT_VERSION}.tar.gz
tar xf /tmp/qt_android_${QT_VERSION}.tar.gz -C ${QT_BASEDIR}/${QT_VERSION}
rm /tmp/qt_android_${QT_VERSION}.tar.gz
# qt android now installed in QT_BASEDIR/
python3 -m pip install "aqtinstall==${AQTINSTALL_VERSION}"
local qtmultimedia=()
if [[ ! "${QT_VERSION}" =~ 5\..* ]]; then
# From Qt6 onwards, qtmultimedia is a module and cannot be installed
# as an archive anymore.
qtmultimedia=("--modules")
fi
qtmultimedia+=("qtmultimedia")

python3 -m aqt install-qt --outputdir "${QT_BASEDIR}" linux android "${QT_VERSION}" \
--archives qtbase qttools qttranslations qtandroidextras \
"${qtmultimedia[@]}"
# Delete libraries, which we don't use, but which bloat the resulting package and might introduce unwanted dependencies.
find "${QT_BASEDIR}" -name 'libQt5*Quick*.so' -delete
rm -r "${QT_BASEDIR}/${QT_VERSION}/android/qml/"
fi
}

install_android_openssl() {
echo ">> Installing android_openssl as build dep ..."
wget https://github.com/KDAB/android_openssl/archive/refs/tags/1.1.1l_1.0.2u.tar.gz
mkdir android_openssl
tar zxvf 1.1.1l_1.0.2u.tar.gz -C android_openssl --strip-components 1
# android openssl libs are now installed at ./android_openssl/
}

build_app() {
local ARCH_ABI="${1}"

# local QT_DIR="${QT_BASEDIR}/${QT_VERSION}/android"
build_app_as_apk() {
local QT_DIR="${QT_BASEDIR}/${QT_VERSION}/android"
local MAKE="${ANDROID_NDK_ROOT}/prebuilt/${ANDROID_NDK_HOST}/bin/make"

echo "${GOOGLE_RELEASE_KEYSTORE}" | base64 --decode > android/android_release.keystore

echo ">>> Compiling for ${ARCH_ABI} ..."
"${QT_BASEDIR}/${QT_VERSION}/${ARCH_ABI}/bin/qmake" -version

ANDROID_ABIS=${ARCH_ABI} "${QT_BASEDIR}/${QT_VERSION}/${ARCH_ABI}/bin/qmake" -spec android-clang

"${QT_DIR}/bin/qmake" -spec android-clang
"${MAKE}" -j "$(nproc)"
"${MAKE}" INSTALL_ROOT="${BUILD_DIR}_${ARCH_ABI}" -f Makefile install
}

build_make_clean() {
echo ">>> Doing make clean ..."
local MAKE="${ANDROID_NDK_ROOT}/prebuilt/${ANDROID_NDK_HOST}/bin/make"
"${MAKE}" clean
rm -f Makefile
}

build_aab() {
local ARCH_ABI="${1}"
echo ">>> Building .aab file for ${ARCH_ABI}...."

ANDROID_ABIS=${ARCH_ABI} ${QT_BASEDIR}/${QT_VERSION}/gcc_64/bin/androiddeployqt --input android-Koord-deployment-settings.json \
--verbose \
--output "${BUILD_DIR}_${ARCH_ABI}" \
--aab \
--release \
--sign android/android_release.keystore koord \
--storepass ${GOOGLE_KEYSTORE_PASS} \
--android-platform "${ANDROID_PLATFORM}" \
--jdk "${JAVA_HOME}" \
--gradle
"${MAKE}" INSTALL_ROOT="${BUILD_DIR}" -f Makefile install
"${QT_DIR}"/bin/androiddeployqt --input android-Jamulus-deployment-settings.json --output "${BUILD_DIR}" \
--android-platform "${ANDROID_PLATFORM}" --jdk "${JAVA_HOME}" --gradle
}

pass_artifact_to_job() {
local ARCH_ABI="${1}"
echo ">>> Deploying .aab file for ${ARCH_ABI}...."

if [ "${ARCH_ABI}" == "armeabi-v7a" ]; then
NUM="1"
BUILDNAME="arm"
elif [ "${ARCH_ABI}" == "arm64-v8a" ]; then
NUM="2"
BUILDNAME="arm64"
elif [ "${ARCH_ABI}" == "x86" ]; then
NUM="3"
BUILDNAME="x86"
elif [ "${ARCH_ABI}" == "x86_64" ]; then
NUM="4"
BUILDNAME="x86_64"
fi

mkdir -p deploy
local artifact="Koord_${KOORD_BUILD_VERSION}_android_${BUILDNAME}.aab"
# debug to check for filenames
ls -alR ${BUILD_DIR}_${ARCH_ABI}/build/outputs/bundle/release/
ls -al ${BUILD_DIR}_${ARCH_ABI}/build/outputs/bundle/release/build_${ARCH_ABI}-release.aab
echo ">>> Moving ${BUILD_DIR}_${ARCH_ABI}/build/outputs/bundle/release/build_${ARCH_ABI}-release.aab to deploy/${artifact}"
mv "./${BUILD_DIR}_${ARCH_ABI}/build/outputs/bundle/release/build_${ARCH_ABI}-release.aab" "./deploy/${artifact}"
echo ">>> Moved .aab file to deploy/${artifact}"
echo ">>> Artifact number is: ${NUM}"
echo ">>> Setting output as such: name=artifact_${NUM}::${artifact}"
echo "artifact_${NUM}=${artifact}" >> "$GITHUB_OUTPUT"
mkdir deploy
local artifact="jamulus_${JAMULUS_BUILD_VERSION}_android.apk"
echo "Moving ${BUILD_DIR}/build/outputs/apk/debug/build-debug.apk to deploy/${artifact}"
mv "./${BUILD_DIR}/build/outputs/apk/debug/build-debug.apk" "./deploy/${artifact}"
echo "artifact_1=${artifact}" >> "$GITHUB_OUTPUT"
}

case "${1:-}" in
setup)
setup_ubuntu_dependencies
setup_android_ndk
setup_android_sdk
setup_qt
install_android_openssl
;;
build)
# Build all targets in sequence
build_app "armeabi-v7a"
build_aab "armeabi-v7a"
build_make_clean
build_app "arm64-v8a"
build_aab "arm64-v8a"
build_make_clean
build_app "x86"
build_aab "x86"
build_make_clean
build_app "x86_64"
build_aab "x86_64"
build_app_as_apk
;;
get-artifacts)
pass_artifact_to_job "armeabi-v7a"
pass_artifact_to_job "arm64-v8a"
pass_artifact_to_job "x86"
pass_artifact_to_job "x86_64"
pass_artifact_to_job
;;
*)
echo "Unknown stage '${1:-}'"
Expand Down
Loading

0 comments on commit be157c8

Please sign in to comment.