diff --git a/.github/actions_scripts/analyse_git_reference.py b/.github/actions_scripts/analyse_git_reference.py new file mode 100755 index 0000000000..156befff22 --- /dev/null +++ b/.github/actions_scripts/analyse_git_reference.py @@ -0,0 +1,94 @@ +#!/usr/bin/python3 + +import sys +import os + +def get_jamulus_version(repo_path_on_disk): + jamulus_version = "" + with open (repo_path_on_disk + '/Jamulus.pro','r') as f: + pro_content = f.read() + pro_content = pro_content.replace('\r','') + pro_lines = pro_content.split('\n') + for line in pro_lines: + line = line.strip() + VERSION_LINE_STARTSWITH = 'VERSION = ' + if line.startswith(VERSION_LINE_STARTSWITH): + jamulus_version = line[len(VERSION_LINE_STARTSWITH):] + return jamulus_version + + +if len(sys.argv) == 1: + repo_path_on_disk = os.environ['GITHUB_WORKSPACE'] + release_version_name = get_jamulus_version(repo_path_on_disk) + + os.system('perl "{}"/.github/actions_scripts/getChangelog.pl "{}"/ChangeLog "{}" > "{}"/autoLatestChangelog.md'.format( + os.environ['GITHUB_WORKSPACE'], + os.environ['GITHUB_WORKSPACE'], + release_version_name, + os.environ['GITHUB_WORKSPACE'] + )) + +elif len(sys.argv) == 4: + #fullref=sys.argv[1] + #pushed_name=sys.argv[2] + release_version_name = sys.argv[3] +else: + print('Expecing 4 arguments, 1 script path and 3 parameters') + print('Number of arguments:', len(sys.argv), 'arguments.') + print('Argument List:', str(sys.argv)) + raise Exception("wrong agruments") + +fullref=os.environ['GITHUB_REF'] +reflist = fullref.split("/", 2) +pushed_name = reflist[2] + + + +if fullref.startswith("refs/tags/"): + print('this reference is a Tag') + publish_to_release = True + release_tag = pushed_name # tag already exists + release_title="Release {} ({})".format(release_version_name, pushed_name) + if pushed_name.startswith("r"): + if "beta" in pushed_name: + print('this reference is a Beta-Release-Tag') + is_prerelease = True + else: + print('this reference is a Release-Tag') + publish_to_release = True + is_prerelease = False + else: + print('this reference is a Non-Release-Tag') + publish_to_release = False + is_prerelease = True # just in case + + + if pushed_name == "latest": + print('this reference is a Latest-Tag') + publish_to_release = True + release_version_name = "latest" + release_title='Release "latest"' +elif fullref.startswith("refs/heads/"): + print('this reference is a Head/Branch') + publish_to_release = False + is_prerelease = True + release_title='Pre-Release of "{}"'.format(pushed_name) + release_tag = "releasetag/"+pushed_name #better not use pure pushed name, creates a tag with the name of the branch, leads to ambiguous references => can not push to this branch easily +else: + print('unknown git-reference type: ' + fullref) + publish_to_release = False + is_prerelease = True + release_title='Pre-Release of "{}"'.format(pushed_name) + release_tag = "releasetag/"+pushed_name #avoid ambiguity in references in all cases + +def set_github_variable(varname, varval): + print("{}='{}'".format(varname, varval)) #console output + print("::set-output name={}::{}".format(varname, varval)) + +set_github_variable("PUBLISH_TO_RELEASE", str(publish_to_release).lower()) +set_github_variable("IS_PRERELEASE", str(is_prerelease).lower()) +set_github_variable("RELEASE_TITLE", release_title) +set_github_variable("RELEASE_TAG", release_tag) +set_github_variable("PUSHED_NAME", pushed_name) +set_github_variable("JAMULUS_VERSION", release_version_name) +set_github_variable("RELEASE_VERSION_NAME", release_version_name) diff --git a/.github/actions_scripts/get_release_vars.sh b/.github/actions_scripts/get_release_vars.sh deleted file mode 100755 index 02f0bcd38c..0000000000 --- a/.github/actions_scripts/get_release_vars.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -VERSION=$(cat ${1}/Jamulus.pro | grep -oP 'VERSION = \K\w[^\s\\]*') -echo "::set-output name=JAMULUS_VERSION::${VERSION}" -# get the tag which pushed this -echo "::set-output name=PUSH_TAG::${GITHUB_REF#refs/*/}" -perl ${1}/.github/actions_scripts/getChangelog.pl ${1}/ChangeLog ${VERSION} > ${1}/autoLatestChangelog.md diff --git a/.github/workflows/autobuild.yml b/.github/workflows/autobuild.yml index cb4cd4eb36..097e583568 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -1,110 +1,123 @@ #### Automatically build and upload releases to GitHub #### on: + workflow_dispatch: push: tags: - - "r*" # run this action if a tag beginning with r is created - workflow_dispatch: - + # - "*" + branches: + # - "*" + # - master + # - *autobuild* name: Publish Release jobs: - - ## Creates the releases on GitHub ## create_release: name: Create release runs-on: ubuntu-latest - outputs: # The outputs the following steps give back are sent to the other job - upload_url: ${{ steps.create_release.outputs.upload_url }} - upload_latest_url: ${{ steps.create_latest_release.outputs.upload_url }} + outputs: + upload_url: ${{ steps.create_release_step.outputs.upload_url }} version: ${{ steps.jamulus-build-vars.outputs.JAMULUS_VERSION }} + version_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_VERSION_NAME }} steps: + # Checkout code - name: Checkout code uses: actions/checkout@v2 - - name: Get Jamulus build info # Gets Changelog and version of this build - run: sh ${{ github.workspace }}/.github/actions_scripts/get_release_vars.sh ${{ github.workspace }} + + # Set variables + # Determine release / pre-release + - name: Get Jamulus build info, determine actions & variables + run: python3 ${{ github.workspace }}/.github/actions_scripts/analyse_git_reference.py id: jamulus-build-vars - - name: Remove latest tag # removes the "latest" tag from the last version + + # remove release, if it exists (with this releasetag) + - name: Remove release, if existing (for latest and branches) + if: ${{ contains(steps.jamulus-build-vars.outputs.PUBLISH_TO_RELEASE, 'true') }} + continue-on-error: true uses: dev-drprasad/delete-tag-and-release@v0.1.2 with: - delete_release: true - tag_name: latest # tag name to delete + delete_release: false + tag_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_TAG }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - # Actually create the release on GitHub - - name: Prepare latest release # create a release tagged latest - id: create_latest_release + # create release (empty, filled by next jobs) + - name: 'Create Release ${{steps.jamulus-build-vars.outputs.RELEASE_TAG}} {{steps.jamulus-build-vars.outputs.RELEASE_TITLE}}' + if: ${{ contains(steps.jamulus-build-vars.outputs.PUBLISH_TO_RELEASE, 'true') }} + id: create_release_step uses: actions/create-release@v1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: - tag_name: latest - release_name: Latest release ${{ steps.jamulus-build-vars.outputs.JAMULUS_VERSION }} (auto build) + tag_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_TAG }} + release_name: ${{ steps.jamulus-build-vars.outputs.RELEASE_TITLE }} body_path: ${{ github.workspace }}/autoLatestChangelog.md + prerelease: ${{ steps.jamulus-build-vars.outputs.IS_PRERELEASE }} draft: false - prerelease: false - - name: Prepare tag release # creates a release with the tag which triggered this action - id: create_release - uses: actions/create-release@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - tag_name: ${{ steps.jamulus-build-vars.outputs.PUSH_TAG }} - release_name: Release ${{ steps.jamulus-build-vars.outputs.JAMULUS_VERSION }} (auto build) - body_path: ${{ github.workspace }}/autoLatestChangelog.md - draft: false - prerelease: false - ## Builds and uploads the binaries ## + ### CANCEL ### can be used for development concerning release-creation + #- name: Cancelthrougherroe + # run: myundefinedfunction + + release_assets: - name: Release assets + name: Build assets for ${{ matrix.config.config_name }} needs: create_release - runs-on: ${{ matrix.config.os }} + runs-on: ${{ matrix.config.building_on_os }} strategy: + fail-fast: false matrix: # Think of this like a foreach loop. Basically runs the steps with every combination of the contents of this. More info: https://docs.github.com/en/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix config: - - os: ubuntu-18.04 + - config_name: Linux (normal) + target_os: linux + building_on_os: ubuntu-18.04 asset_path: deploy/Jamulus_amd64.deb - asset_name: jamulus_${{ needs.create_release.outputs.version }}_ubuntu_amd64.deb - asset_latest_name: jamulus_latest_ubuntu_amd64.deb - asset_path_two: deploy/Jamulus_headless_amd64.deb - asset_name_two: jamulus_headless_${{ needs.create_release.outputs.version }}_ubuntu_amd64.deb - asset_latest_name_two: jamulus_headless_ubuntu_amd64.deb - - os: macos-10.15 + asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_ubuntu_amd64.deb + - config_name: Linux (headless) + target_os: linux + building_on_os: ubuntu-18.04 + asset_path: deploy/Jamulus_headless_amd64.deb + asset_name: jamulus_headless_${{ needs.create_release.outputs.version_name }}_ubuntu_amd64.deb + - config_name: MacOS + target_os: macos + building_on_os: macos-10.15 asset_path: deploy/Jamulus-installer-mac.dmg - asset_name: jamulus_${{ needs.create_release.outputs.version }}_mac.dmg - asset_latest_name: jamulus_latest_mac.dmg - - os: windows-latest + asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_mac.dmg + - config_name: Windows + target_os: windows + building_on_os: windows-latest asset_path: deploy\Jamulus-installer-win.exe - asset_latest_name: jamulus_latest_win.exe - asset_name: jamulus_${{ needs.create_release.outputs.version }}_win.exe - + asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_win.exe + - config_name: AndroidAPK + target_os: android + building_on_os: ubuntu-18.04 + asset_path: android-build/build/outputs/apk/debug/android-build-debug.apk + asset_name: jamulus_${{ needs.create_release.outputs.version_name }}_android.apk steps: - ### Setup ### - - # Get the code + # Checkout code - name: Checkout code uses: actions/checkout@v2 + with: + submodules: true - ### Build ### - + # Build - name: "Build deb (Linux)" run: sh linux/autorelease_linux.sh ${{ github.workspace }} - if: matrix.config.os == 'ubuntu-18.04' + if: matrix.config.target_os == 'linux' - name: "Build (Windows)" run: powershell .\windows\autorelease_windows.ps1 -sourcepath "${{ github.workspace }}" - if: matrix.config.os == 'windows-latest' + if: matrix.config.target_os == 'windows' - name: "Build (macOS)" run: sh mac/autorelease_mac.sh ${{ github.workspace }} - if: matrix.config.os == 'macos-10.15' - - ### Upload releases ### - - ## Upload assets to the release which is tagged with the tag that triggered this action. - - name: Upload Release Asset 1 + if: matrix.config.target_os == 'macos' + - name: "Build (Android)" + uses: ./android/automated_build/ # Uses an action in the directory + if: matrix.config.target_os == 'android' + + # Upload release + - name: Upload Release Asset - Tag + if: ${{ contains(steps.jamulus-build-vars.outputs.PUBLISH_TO_RELEASE, 'true') }} id: upload-release-asset uses: actions/upload-release-asset@v1 env: @@ -114,39 +127,25 @@ jobs: asset_path: ${{ matrix.config.asset_path }} asset_name: ${{ matrix.config.asset_name }} asset_content_type: application/octet-stream - - # There might be two assets (at least for Debian) - - name: Upload Release Asset 2 - if: matrix.config.asset_name_two != null - id: upload-release-asset-two - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_url }} - asset_path: ${{ matrix.config.asset_path_two }} - asset_name: ${{ matrix.config.asset_name_two }} - asset_content_type: application/octet-stream - - ## Upload assets latest release - - name: Upload latest Release Asset 1 - id: upload-latest-release-asset - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_latest_url }} # See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps - asset_path: ${{ matrix.config.asset_path }} - asset_name: ${{ matrix.config.asset_latest_name }} - asset_content_type: application/octet-stream - - name: Upload latest Release Asset 2 - if: matrix.config.asset_latest_name_two != null - id: upload-latest-release-asset-two - uses: actions/upload-release-asset@v1 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ needs.create_release.outputs.upload_latest_url }} - asset_path: ${{ matrix.config.asset_path_two }} - asset_name: ${{ matrix.config.asset_latest_name_two }} - asset_content_type: application/octet-stream + + ## Builds a Linux flatpack ## + flatpak-builder: + name: "Flatpak Builder" + runs-on: ubuntu-latest + needs: [create_release] + container: + image: docker.io/bilelmoussaoui/flatpak-github-actions + options: --privileged + steps: + - uses: actions/checkout@v2 + - name: Change branch name in manifest + run: python3 io.jamulus.Jamulus.prepare.py $GITHUB_SHA + working-directory: ./distributions/ + - uses: bilelmoussaoui/flatpak-github-actions@v2 + with: + bundle: "io.jamulus.Jamulus.flatpak" + manifest-path: "distributions/io.jamulus.Jamulus.json" + - uses: actions/download-artifact@v2 + with: + name: io.jamulus.Jamulus + path: ~/io.jamulus.Jamulus diff --git a/.github/workflows/autobuild_flatpak.yml b/.github/workflows/autobuild_flatpak.yml deleted file mode 100644 index ee3d27c245..0000000000 --- a/.github/workflows/autobuild_flatpak.yml +++ /dev/null @@ -1,19 +0,0 @@ -on: - push: - tags: - - "r*" - workflow_dispatch: -name: "Autobuild Flatpak" -jobs: - flatpak-builder: - name: "Flatpak Builder" - runs-on: ubuntu-latest - container: - image: docker.io/bilelmoussaoui/flatpak-github-actions - options: --privileged - steps: - - uses: actions/checkout@v2 - - uses: bilelmoussaoui/flatpak-github-actions@v2 - with: - bundle: "io.jamulus.Jamulus.flatpak" - manifest-path: "distributions/io.jamulus.Jamulus.json" diff --git a/android/automated_build/Dockerfile b/android/automated_build/Dockerfile new file mode 100644 index 0000000000..478ac5222d --- /dev/null +++ b/android/automated_build/Dockerfile @@ -0,0 +1,82 @@ +FROM ubuntu:18.04 + +#based on https://gitlab.com/vikingsoftware/qt5.12.4androiddocker +#LABEL "Maintainer"="Guenter Schwann" +#LABEL "version"="0.3" + +ENV DEBIAN_FRONTEND=noninteractive + +RUN apt-get update && \ + apt-get install -y build-essential git zip unzip bzip2 p7zip-full wget curl chrpath libxkbcommon-x11-0 && \ +# Dependencies to create Android pkg + apt-get install -y openjdk-8-jre openjdk-8-jdk openjdk-8-jdk-headless gradle && \ +# Clean apt cache + apt-get clean && rm -rf /var/lib/apt/lists/* + +# Add Android tools and platform tools to PATH +ENV ANDROID_HOME /opt/android/android-sdk +ENV ANDROID_SDK_ROOT /opt/android/android-sdk +ENV ANDROID_NDK_ROOT /opt/android/android-ndk + +# paths for Android SDK +RUN mkdir -p ${ANDROID_SDK_ROOT}/cmdline-tools/latest/ +RUN mkdir -p ${ANDROID_SDK_ROOT}/build-tools/latest/ + +# Install Android sdk +#https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip +#https://dl.google.com/android/repository/sdk-tools-linux-3859397.zip +RUN downloadfile="downloadfile" && \ + wget -q -O downloadfile https://dl.google.com/android/repository/commandlinetools-linux-6858069_latest.zip && \ + unzip -q downloadfile && \ + rm downloadfile && \ + mv cmdline-tools/* /opt/android/android-sdk/cmdline-tools/latest/ && \ + rm -r cmdline-tools + +# Install Android ndk +#https://dl.google.com/android/repository/android-ndk-r19c-linux-x86_64.zip +#https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip +RUN downloadfile="downloadfile" && \ + wget -q -O downloadfile https://dl.google.com/android/repository/android-ndk-r21d-linux-x86_64.zip && \ + unzip -q downloadfile && \ + rm downloadfile && \ + mv android-ndk-r21d /opt/android/android-ndk + +# Add Android tools and platform tools to PATH +ENV ANDROID_HOME /opt/android/android-sdk +ENV ANDROID_SDK_ROOT /opt/android/android-sdk +ENV ANDROID_NDK_ROOT /opt/android/android-ndk +ENV PATH $PATH:$ANDROID_HOME/tools +ENV PATH $PATH:$ANDROID_HOME/platform-tools +ENV JAVA_HOME /usr/lib/jvm/java-8-openjdk-amd64/ + +ENV ANDROID_NDK_HOST linux-x86_64 + +ENV ANDROID_SDKMANAGER $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager + +# Install Android SDK +RUN yes | $ANDROID_SDKMANAGER --licenses && $ANDROID_SDKMANAGER --update +RUN $ANDROID_SDKMANAGER "platforms;android-17" +RUN $ANDROID_SDKMANAGER "platforms;android-28" +RUN $ANDROID_SDKMANAGER "platforms;android-30" +RUN $ANDROID_SDKMANAGER "build-tools;28.0.3" +RUN $ANDROID_SDKMANAGER "build-tools;30.0.2" + + +#5.15.2 +ENV MY_QT_VERSION 5.15.2 + +# Download / install Qt +####ADD https://code.qt.io/cgit/qbs/qbs.git/plain/scripts/install-qt.sh ./ +COPY install-qt.sh /install-qt.sh +RUN bash install-qt.sh --version $MY_QT_VERSION --target android --toolchain android qtbase qt3d qtdeclarative qtandroidextras qtconnectivity qtgamepad qtlocation qtmultimedia qtquickcontrols2 qtremoteobjects qtscxml qtsensors qtserialport qtsvg qtimageformats qttools qtspeech qtwebchannel qtwebsockets qtwebview qtxmlpatterns qttranslations + +# Set the QTDIR environment variable +ENV QTDIR="/opt/Qt/$MY_QT_VERSION/android" + + +COPY build_qt_project.sh /build_qt_project.sh +RUN chmod +x /build_qt_project.sh + +ENTRYPOINT /bin/bash /build_qt_project.sh + + diff --git a/android/automated_build/__example__jamulusbuild.sh b/android/automated_build/__example__jamulusbuild.sh new file mode 100644 index 0000000000..82152e5d2e --- /dev/null +++ b/android/automated_build/__example__jamulusbuild.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +# execute this file in an empty folder + +#clean & download code & change into folder +rm -r jamulus +git clone --recurse-submodules https://github.com/corrados/jamulus.git +cd jamulus + +#################################################### +### these two lines run in toplevel folder of repo## +#################################################### + +#build & run docker +docker build -t myjambuild ./android/automated_build +docker run --rm -v `pwd`:/jamulus -w /jamulus -e CONFIG=release myjambuild diff --git a/android/automated_build/action.yml b/android/automated_build/action.yml new file mode 100644 index 0000000000..3abff7594d --- /dev/null +++ b/android/automated_build/action.yml @@ -0,0 +1,11 @@ +name: 'Run Android-Build-Docker' +description: 'Run Android-Build-Docker' +#outputs: +# time: +# description: 'The time we greeted you' +runs: + using: 'docker' + image: ./Dockerfile + args: + - ${{ inputs.who-to-greet }} + - CONFIG=release diff --git a/android/automated_build/build_qt_project.sh b/android/automated_build/build_qt_project.sh new file mode 100644 index 0000000000..09b6b6d17a --- /dev/null +++ b/android/automated_build/build_qt_project.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +$QTDIR/bin/qmake -spec android-clang CONFIG+=$CONFIG +/opt/android/android-ndk/prebuilt/linux-x86_64/bin/make +$ANDROID_NDK_ROOT/prebuilt/$ANDROID_NDK_HOST/bin/make INSTALL_ROOT=android-build -f Makefile install +$QTDIR/bin/androiddeployqt --input $(ls *.json) --output android-build --android-platform android-30 --jdk $JAVA_HOME --gradle diff --git a/android/automated_build/install-qt.sh b/android/automated_build/install-qt.sh new file mode 100644 index 0000000000..fd12fc0afc --- /dev/null +++ b/android/automated_build/install-qt.sh @@ -0,0 +1,339 @@ +#!/usr/bin/env bash +############################################################################# +## +## Copyright (C) 2019 Richard Weickelt. +## Contact: https://www.qt.io/licensing/ +## +## This file is part of Qbs. +## +## $QT_BEGIN_LICENSE:LGPL$ +## Commercial License Usage +## Licensees holding valid commercial Qt licenses may use this file in +## accordance with the commercial license agreement provided with the +## Software or, alternatively, in accordance with the terms contained in +## a written agreement between you and The Qt Company. For licensing terms +## and conditions see https://www.qt.io/terms-conditions. For further +## information use the contact form at https://www.qt.io/contact-us. +## +## GNU Lesser General Public License Usage +## Alternatively, this file may be used under the terms of the GNU Lesser +## General Public License version 3 as published by the Free Software +## Foundation and appearing in the file LICENSE.LGPL3 included in the +## packaging of this file. Please review the following information to +## ensure the GNU Lesser General Public License version 3 requirements +## will be met: https://www.gnu.org/licenses/lgpl-3.0.html. +## +## GNU General Public License Usage +## Alternatively, this file may be used under the terms of the GNU +## General Public License version 2.0 or (at your option) the GNU General +## Public license version 3 or any later version approved by the KDE Free +## Qt Foundation. The licenses are as published by the Free Software +## Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 +## included in the packaging of this file. Please review the following +## information to ensure the GNU General Public License requirements will +## be met: https://www.gnu.org/licenses/gpl-2.0.html and +## https://www.gnu.org/licenses/gpl-3.0.html. +## +## $QT_END_LICENSE$ +## +############################################################################# + +## https://code.qt.io/cgit/qbs/qbs.git/tree/scripts/install-qt.sh + +set -eu + +function help() { + cat < + Root directory where to install the components. + Maps to C:/Qt on Windows, /opt/Qt on Linux, /usr/local/Qt on Mac + by default. + + -f, --force + Force download and do not attempt to re-use an existing installation. + + --host + The host operating system. Can be one of linux_x64, mac_x64, + windows_x86. Auto-detected by default. + + --target + The desired target platform. Can be one of desktop, android, ios. + The default value is desktop. + + --toolchain + The toolchain that has been used to build the binaries. + Possible values depend on --host and --target, respectively: + + linux_x64 + android + any, android_armv7, android_arm64_v8a + desktop + gcc_64 (default) + + mac_x64 + android + any, android_armv7, android_arm64_v8a + desktop + clang_64 (default), + ios + ios + + windows_x86 + android + any, android_armv7, android_arm64_v8a + desktop + win64_mingw73, win64_msvc2017_64 (default) + + --version + The desired Qt version. Currently supported are all versions + above 5.9.0. + +EOF +} + +TARGET_PLATFORM=desktop +COMPONENTS= +VERSION= +FORCE_DOWNLOAD=false +MD5_TOOL=md5sum + +case "$OSTYPE" in + *linux*) + HOST_OS=linux_x64 + INSTALL_DIR=/opt/Qt + TOOLCHAIN=gcc_64 + ;; + *darwin*) + HOST_OS=mac_x64 + INSTALL_DIR=/usr/local/Qt + TOOLCHAIN=clang_64 + MD5_TOOL="md5 -r" + ;; + msys) + HOST_OS=windows_x86 + INSTALL_DIR=/c/Qt + TOOLCHAIN=win64_msvc2015_64 + ;; + *) + HOST_OS= + INSTALL_DIR= + ;; +esac + +while [ $# -gt 0 ]; do + case "$1" in + --directory|-d) + INSTALL_DIR="$2" + shift + ;; + --force|-f) + FORCE_DOWNLOAD=true + ;; + --host) + HOST_OS="$2" + shift + ;; + --target) + TARGET_PLATFORM="$2" + shift + ;; + --toolchain) + TOOLCHAIN=$(echo $2 | tr '[A-Z]' '[a-z]') + shift + ;; + --version) + VERSION="$2" + shift + ;; + --help|-h) + help + exit 0 + ;; + *) + COMPONENTS="${COMPONENTS} $1" + ;; + esac + shift +done + +if [ -z "${HOST_OS}" ]; then + echo "No --host specified or auto-detection failed." >&2 + exit 1 +fi + +if [ -z "${INSTALL_DIR}" ]; then + echo "No --directory specified or auto-detection failed." >&2 + exit 1 +fi + +if [ -z "${VERSION}" ]; then + echo "No --version specified." >&2 + exit 1 +fi + +if [ -z "${COMPONENTS}" ]; then + echo "No components specified." >&2 + exit 1 +fi + +case "$TARGET_PLATFORM" in + android) + ;; + ios) + ;; + desktop) + ;; + *) + echo "Error: TARGET_PLATFORM=${TARGET_PLATFORM} is not valid." >&2 + exit 1 + ;; +esac + +HASH=$(echo "${OSTYPE} ${TARGET_PLATFORM} ${TOOLCHAIN} ${VERSION} ${INSTALL_DIR}" | ${MD5_TOOL} | head -c 16) +HASH_FILEPATH="${INSTALL_DIR}/${HASH}.manifest" +INSTALLATION_IS_VALID=false +if ! ${FORCE_DOWNLOAD} && [ -f "${HASH_FILEPATH}" ]; then + INSTALLATION_IS_VALID=true + while read filepath; do + if [ ! -e "${filepath}" ]; then + INSTALLATION_IS_VALID=false + break + fi + done <"${HASH_FILEPATH}" +fi + +if ${INSTALLATION_IS_VALID}; then + echo "Already installed. Skipping download." >&2 + exit 0 +fi + +DOWNLOAD_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'install-qt'` + +# +# The repository structure is a mess. Try different URL variants +# +function compute_url(){ + local COMPONENT=$1 + local CURL="curl -s -L" + local BASE_URL="https://mirrors.ocf.berkeley.edu/qt/online/qtsdkrepository/${HOST_OS}/${TARGET_PLATFORM}" + local ANDROID_ARCH=$(echo ${TOOLCHAIN##android_}) + + if [[ "${COMPONENT}" =~ "qtcreator" ]]; then + + SHORT_VERSION=${VERSION%??} + BASE_URL="https://mirrors.ocf.berkeley.edu/qt/official_releases/qtcreator" + REMOTE_PATH="${SHORT_VERSION}/${VERSION}/installer_source/${HOST_OS}/qtcreator.7z" + echo "${BASE_URL}/${REMOTE_PATH}" + return 0 + + else + REMOTE_BASES=( + # New repository format (>=6.0.0) + "qt6_${VERSION//./}/qt.qt6.${VERSION//./}.${TOOLCHAIN}" + "qt6_${VERSION//./}_${ANDROID_ARCH}/qt.qt6.${VERSION//./}.${TOOLCHAIN}" + "qt6_${VERSION//./}_${ANDROID_ARCH}/qt.qt6.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}" + # New repository format (>=5.9.6) + "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${TOOLCHAIN}" + "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}" + # Multi-abi Android since 5.14 + "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${TARGET_PLATFORM}" + "qt5_${VERSION//./}/qt.qt5.${VERSION//./}.${COMPONENT}.${TARGET_PLATFORM}" + # Older repository format (<5.9.0) + "qt5_${VERSION//./}/qt.${VERSION//./}.${TOOLCHAIN}" + "qt5_${VERSION//./}/qt.${VERSION//./}.${COMPONENT}.${TOOLCHAIN}" + ) + + for REMOTE_BASE in ${REMOTE_BASES[*]}; do + REMOTE_PATH="$(${CURL} ${BASE_URL}/${REMOTE_BASE}/ | grep -o -E "[[:alnum:]_.\-]*7z" | grep "${COMPONENT}" | tail -1)" + if [ ! -z "${REMOTE_PATH}" ]; then + echo "${BASE_URL}/${REMOTE_BASE}/${REMOTE_PATH}" + return 0 + fi + done + fi + + echo "Could not determine a remote URL for ${COMPONENT} with version ${VERSION}">&2 + exit 1 +} + +mkdir -p ${INSTALL_DIR} +rm -f "${HASH_FILEPATH}" + +for COMPONENT in ${COMPONENTS}; do + + URL="$(compute_url ${COMPONENT})" + echo "Downloading ${COMPONENT} ${URL}..." >&2 + curl --progress-bar -L -o ${DOWNLOAD_DIR}/package.7z ${URL} >&2 + 7z x -y -o${INSTALL_DIR} ${DOWNLOAD_DIR}/package.7z >/dev/null 2>&1 + 7z l -ba -slt -y ${DOWNLOAD_DIR}/package.7z | tr '\\' '/' | sed -n -e "s|^Path\ =\ |${INSTALL_DIR}/|p" >> "${HASH_FILEPATH}" 2>/dev/null + rm -f ${DOWNLOAD_DIR}/package.7z + + # + # conf file is needed for qmake + # + if [ "${COMPONENT}" == "qtbase" ]; then + if [[ "${TOOLCHAIN}" =~ "win64_mingw" ]]; then + SUBDIR="${TOOLCHAIN/win64_/}_64" + elif [[ "${TOOLCHAIN}" =~ "win32_mingw" ]]; then + SUBDIR="${TOOLCHAIN/win32_/}_32" + elif [[ "${TOOLCHAIN}" =~ "win64_msvc" ]]; then + SUBDIR="${TOOLCHAIN/win64_/}" + elif [[ "${TOOLCHAIN}" =~ "win32_msvc" ]]; then + SUBDIR="${TOOLCHAIN/win32_/}" + elif [[ "${TOOLCHAIN}" =~ "any" ]] && [[ "${TARGET_PLATFORM}" == "android" ]]; then + SUBDIR="android" + else + SUBDIR="${TOOLCHAIN}" + fi + + if [ "${TARGET_PLATFORM}" == "android" ] && [ ! "${VERSION}" \< "6.0.0" ]; then + CONF_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/target_qt.conf" + sed -i "s|target|../$TOOLCHAIN|g" "${CONF_FILE}" + sed -i "/HostPrefix/ s|$|gcc_64|g" "${CONF_FILE}" + ANDROID_QMAKE_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/qmake" + QMAKE_FILE="${INSTALL_DIR}/${VERSION}/gcc_64/bin/qmake" + sed -i "s|\/home\/qt\/work\/install\/bin\/qmake|$QMAKE_FILE|g" "${ANDROID_QMAKE_FILE}" + else + CONF_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/bin/qt.conf" + echo "[Paths]" > ${CONF_FILE} + echo "Prefix = .." >> ${CONF_FILE} + fi + + # Adjust the license to be able to run qmake + # sed with -i requires intermediate file on Mac OS + PRI_FILE="${INSTALL_DIR}/${VERSION}/${SUBDIR}/mkspecs/qconfig.pri" + sed -i.bak 's/Enterprise/OpenSource/g' "${PRI_FILE}" + sed -i.bak 's/licheck.*//g' "${PRI_FILE}" + rm "${PRI_FILE}.bak" + + # Print the directory so that the caller can + # adjust the PATH variable. + echo $(dirname "${CONF_FILE}") + elif [[ "${COMPONENT}" =~ "qtcreator" ]]; then + if [ "${HOST_OS}" == "mac_x64" ]; then + echo "${INSTALL_DIR}/Qt Creator.app/Contents/MacOS" + else + echo "${INSTALL_DIR}/bin" + fi + fi + +done + diff --git a/distributions/io.jamulus.Jamulus.prepare.py b/distributions/io.jamulus.Jamulus.prepare.py new file mode 100644 index 0000000000..09baaf8285 --- /dev/null +++ b/distributions/io.jamulus.Jamulus.prepare.py @@ -0,0 +1,26 @@ +#!/usr/bin/python3 + +import sys +import json + + +print('Number of arguments:', len(sys.argv), 'arguments.') +print('Argument List:', str(sys.argv)) + +checkoutbranchname=sys.argv[1] + +jsonfilename = "io.jamulus.Jamulus.json" +print("read {}".format(jsonfilename)) +with open(jsonfilename,'r') as file: + data = json.load(file) + +if data['modules'][1]['name'] != 'jamulus': + print('error') + raise Exception('unexpected format of file') +else: + print("change branch to '{}'".format(checkoutbranchname)) + data['modules'][1]['sources'][0]['branch'] = checkoutbranchname + +print("write {}".format(jsonfilename)) +with open(jsonfilename,'w') as file: + json.dump(data, file, indent=2) diff --git a/windows/autorelease_windows.ps1 b/windows/autorelease_windows.ps1 index 9d1725ce30..ca5a463bd0 100644 --- a/windows/autorelease_windows.ps1 +++ b/windows/autorelease_windows.ps1 @@ -7,8 +7,11 @@ echo "Install Qt..." # Install Qt pip install aqtinstall echo "Get Qt 64 bit..." +# intermediate solution if the main server is down: append e.g. " -b https://mirrors.ocf.berkeley.edu/qt/" to the "aqt"-line below aqt install --outputdir C:\Qt 5.15.2 windows desktop win64_msvc2019_64 + echo "Get Qt 32 bit..." +# intermediate solution if the main server is down: append e.g. " -b https://mirrors.ocf.berkeley.edu/qt/" to the "aqt"-line below aqt install --outputdir C:\Qt 5.15.2 windows desktop win32_msvc2019 echo "Build installer..." diff --git a/windows/deploy_windows.ps1 b/windows/deploy_windows.ps1 index 7fff77d0fb..00a8448921 100644 --- a/windows/deploy_windows.ps1 +++ b/windows/deploy_windows.ps1 @@ -26,7 +26,7 @@ $ErrorActionPreference = "Stop" # Execute native command with errorlevel handling -Function Execute-Native-Command { +Function Invoke-Native-Command { Param( [string] $Command, [string[]] $Arguments @@ -52,27 +52,27 @@ Function Clean-Build-Environment # For sourceforge links we need to get the correct mirror (especially NISIS) Thanks: https://www.powershellmagazine.com/2013/01/29/pstip-retrieve-a-redirected-url/ Function Get-RedirectedUrl { - + Param ( [Parameter(Mandatory=$true)] [String]$URL ) - + $request = [System.Net.WebRequest]::Create($url) $request.AllowAutoRedirect=$false $response=$request.GetResponse() - + if ($response.StatusCode -eq "Found") { $response.GetResponseHeader("Location") } } -function Load-Module ($m) { # see https://stackoverflow.com/a/51692402 +function Initialize-Module-Here ($m) { # see https://stackoverflow.com/a/51692402 # If module is imported say that and do nothing if (Get-Module | Where-Object {$_.Name -eq $m}) { - write-host "Module $m is already imported." + Write-Output "Module $m is already imported." } else { @@ -90,7 +90,7 @@ function Load-Module ($m) { # see https://stackoverflow.com/a/51692402 else { # If module is not imported, not available and not in online gallery then abort - write-host "Module $m not imported, not available and not in online gallery, exiting." + Write-Output "Module $m not imported, not available and not in online gallery, exiting." EXIT 1 } } @@ -133,7 +133,7 @@ Function Install-Dependencies if (-not (Get-PackageProvider -Name nuget).Name -eq "nuget") { Install-PackageProvider -Name "Nuget" -Scope CurrentUser -Force } - Load-Module -m "VSSetup" + Initialize-Module-Here -m "VSSetup" Install-Dependency -Uri $AsioSDKUrl ` -Name $AsioSDKName -Destination "ASIOSDK2" Install-Dependency -Uri $NsisUrl ` @@ -143,7 +143,7 @@ Function Install-Dependencies } # Setup environment variables and build tool paths -Function Setup-Build-Environment +Function Initialize-Build-Environment { param( [Parameter(Mandatory=$true)] @@ -201,7 +201,7 @@ Function Setup-Build-Environment # Import environment variables set by vcvarsXX.bat into current scope $EnvDump = [System.IO.Path]::GetTempFileName() - Execute-Native-Command -Command "cmd" ` + Invoke-Native-Command -Command "cmd" ` -Arguments ("/c", "`"$VcVarsBin`" && set > `"$EnvDump`"") foreach ($_ in Get-Content -Path $EnvDump) @@ -225,18 +225,18 @@ Function Build-App [string] $BuildArch ) - Execute-Native-Command -Command "$Env:QtQmakePath" ` + Invoke-Native-Command -Command "$Env:QtQmakePath" ` -Arguments ("$RootPath\$AppName.pro", "CONFIG+=$BuildConfig $BuildArch", ` "-o", "$BuildPath\Makefile") Set-Location -Path $BuildPath - Execute-Native-Command -Command "nmake" -Arguments ("$BuildConfig") - Execute-Native-Command -Command "$Env:QtWinDeployPath" ` + Invoke-Native-Command -Command "nmake" -Arguments ("$BuildConfig") + Invoke-Native-Command -Command "$Env:QtWinDeployPath" ` -Arguments ("--$BuildConfig", "--compiler-runtime", "--dir=$DeployPath\$BuildArch", "$BuildPath\$BuildConfig\$AppName.exe") Move-Item -Path "$BuildPath\$BuildConfig\$AppName.exe" -Destination "$DeployPath\$BuildArch" -Force - Execute-Native-Command -Command "nmake" -Arguments ("clean") + Invoke-Native-Command -Command "nmake" -Arguments ("clean") Set-Location -Path $RootPath } @@ -251,7 +251,7 @@ function Build-App-Variants foreach ($_ in ("x86_64", "x86")) { $OriginalEnv = Get-ChildItem Env: - Setup-Build-Environment -QtInstallPath $QtInstallPath -BuildArch $_ + Initialize-Build-Environment -QtInstallPath $QtInstallPath -BuildArch $_ Build-App -BuildConfig "release" -BuildArch $_ $OriginalEnv | % { Set-Item "Env:$($_.Name)" $_.Value } } @@ -269,7 +269,7 @@ Function Build-Installer } } - Execute-Native-Command -Command "$WindowsPath\NSIS\makensis" ` + Invoke-Native-Command -Command "$WindowsPath\NSIS\makensis" ` -Arguments ("/v4", "/DAPP_NAME=$AppName", "/DAPP_VERSION=$AppVersion", ` "/DROOT_PATH=$RootPath", "/DWINDOWS_PATH=$WindowsPath", "/DDEPLOY_PATH=$DeployPath", ` "$WindowsPath\installer.nsi")