diff --git a/.github/actions_scripts/analyse_git_reference.py b/.github/actions_scripts/analyse_git_reference.py new file mode 100644 index 0000000000..463aaeafc5 --- /dev/null +++ b/.github/actions_scripts/analyse_git_reference.py @@ -0,0 +1,39 @@ +#!/usr/bin/python3 + +import sys + +print('Number of arguments:', len(sys.argv), 'arguments.') +print('Argument List:', str(sys.argv)) + +fullref=sys.argv[1] +pushed_name=sys.argv[2] +jamulus_version=sys.argv[3] +release_version_name = jamulus_version + +if fullref.startswith("refs/tags/"): + print('python is Tag') + is_prerelease=False + if pushed_name == "latest": + release_version_name = "latest" + release_title='Release "latest"' + else: + release_version_name = jamulus_version + release_title="Release {} ({})".format(release_version_name, pushed_name) +elif fullref.startswith("refs/heads/"): + print('python is Head') + is_prerelease=True + release_title='Pre-Release of "{}"'.format(pushed_name) +else: + print('unknown git-reference type') + release_title='Pre-Release of "{}"'.format(pushed_name) + is_prerelease=True + +print("IS_PRERELEASE::{}".format(is_prerelease)) #debug output +print("RELEASE_TITLE::{}".format(release_title)) #debug output +print("::set-output name=IS_PRERELEASE::{}".format(str(is_prerelease).lower())) +print("::set-output name=RELEASE_TITLE::{}".format(release_title)) +print("::set-output name=RELEASE_TAG::{}".format("releasetag/"+pushed_name)) +print("::set-output name=PUSHED_NAME::{}".format(pushed_name)) +print("::set-output name=JAMULUS_VERSION::{}".format(jamulus_version)) +print("::set-output name=RELEASE_VERSION_NAME::{}".format(release_version_name)) + \ No newline at end of file diff --git a/.github/actions_scripts/get_release_vars.sh b/.github/actions_scripts/get_release_vars.sh index 02f0bcd38c..a45fcc09f7 100755 --- a/.github/actions_scripts/get_release_vars.sh +++ b/.github/actions_scripts/get_release_vars.sh @@ -1,7 +1,14 @@ #!/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/*/}" +set -e + +# get version from project-file +JAMULUS_VERSION=$(cat ${1}/Jamulus.pro | grep -oP 'VERSION = \K\w[^\s\\]*') + +# get the tag/branch-name which pushed this +PUSHED_NAME=${GITHUB_REF#refs/*/} + +# calculate various variables +python3 ${1}/.github/actions_scripts/analyse_git_reference.py ${GITHUB_REF} ${PUSHED_NAME} ${JAMULUS_VERSION} + 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 ef1c735a11..083d69cda2 100644 --- a/.github/workflows/autobuild.yml +++ b/.github/workflows/autobuild.yml @@ -3,123 +3,115 @@ on: push: tags: - - "r*" # run this action if a tag beginning with r is created - workflow_dispatch: - + - "r*" + - latest + branches: + - "*" +# - master # could be restricted to master, if all branches take too much build time name: Publish Release -jobs: - - ## Creates the releases on GitHub ## +jobs: 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 + + # Set variables + # Determine releas / pre-release + - name: Get Jamulus build info run: sh ${{ github.workspace }}/.github/actions_scripts/get_release_vars.sh ${{ github.workspace }} id: jamulus-build-vars - - name: Remove latest tag # removes the "latest" tag from the last version + + # remove tag "latest" from that release + - name: Remove release, if existing (for latest and branches) + 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 - 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) - body_path: ${{ github.workspace }}/autoLatestChangelog.md - draft: false - prerelease: false - - - name: Prepare tag release # creates a release with the tag which triggered this action - id: create_release + # create release (empty, filled by next job) + - name: 'Create Release ${{steps.jamulus-build-vars.outputs.RELEASE_TAG}} {{steps.jamulus-build-vars.outputs.RELEASE_TITLE}}' + id: create_release_step 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) + 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 - - ## Builds and uploads the binaries ## + + + ### CANCEL ### can be used for development concerning release-creation + #- name: Cancelthrougherroe + # run: myundefinedfunction + + release_assets: - name: Release assets + name: Release assets for ${{ matrix.config.config_name }} needs: create_release - runs-on: ${{ matrix.config.os }} + runs-on: ${{ matrix.config.building_on_os }} strategy: 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_path: ${{ github.workspace }}\deploy\Jamulus-installer-win.exe - # asset_latest_name: jamulus_latest_win.exe - # asset_name: jamulus_${{ needs.create_release.outputs.upload_url }}_win.exe - + 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_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 - # Install Qt (currently Windows only) - - name: Install Qt (64 Bit) - uses: jurplel/install-qt-action@v2 - if: matrix.config.os == 'windows-latest' with: - version: '5.15.2' - dir: '${{ github.workspace }}' - arch: 'win64_msvc2019_64' - - name: Install Qt (32 Bit) - uses: jurplel/install-qt-action@v2 - if: matrix.config.os == 'windows-latest' - with: - version: '5.15.2' - dir: '${{ github.workspace }}' - arch: 'win32_msvc2019' - - ### Build ### - + submodules: true + + # 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\deploy_windows.ps1 ${{ github.workspace }}\Qt\5.15.2\; cp deploy\Jamulus*installer-win.exe deploy\Jamulus-installer-win.exe - if: matrix.config.os == 'windows-latest' + run: powershell .\windows\autorelease_windows.ps1 -sourcepath "${{ github.workspace }}" + 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: ./distribute_android/ # Uses an action in the directory + if: matrix.config.target_os == 'android' + + # Upload tag + - name: Upload Release Asset - Tag id: upload-release-asset uses: actions/upload-release-asset@v1 env: @@ -130,38 +122,3 @@ jobs: 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 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 diff --git a/.gitignore b/.gitignore index 7978df4ef8..8870ac0b87 100644 --- a/.gitignore +++ b/.gitignore @@ -25,7 +25,6 @@ debug/ release/ build/ deploy/ -debian/ build-gui/ build-nox/ jamulus.sln diff --git a/README.md b/README.md index 1dbfd8c298..757c36d40d 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![Build Status](https://travis-ci.org/corrados/jamulus.svg?branch=master)](https://travis-ci.org/corrados/jamulus) ![CodeQL](https://github.com/corrados/jamulus/workflows/CodeQL/badge.svg) -Jamulus - Internet Jam Session Software +Jamulus - Internet Jam Session Software ======================================= diff --git a/distribute_android/Dockerfile b/distribute_android/Dockerfile new file mode 100644 index 0000000000..5ee4b06e73 --- /dev/null +++ b/distribute_android/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.sh /build.sh +RUN chmod +x /build.sh + +ENTRYPOINT /bin/bash /build.sh + + diff --git a/distribute_android/__example__jamulusbuild.sh b/distribute_android/__example__jamulusbuild.sh new file mode 100644 index 0000000000..98029559da --- /dev/null +++ b/distribute_android/__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 ./distribute_android +docker run --rm -v `pwd`:/jamulus -w /jamulus -e CONFIG=release myjambuild diff --git a/distribute_android/build.sh b/distribute_android/build.sh new file mode 100644 index 0000000000..09b6b6d17a --- /dev/null +++ b/distribute_android/build.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/distribute_android/docker_action.yml b/distribute_android/docker_action.yml new file mode 100644 index 0000000000..bc2c6ae0dd --- /dev/null +++ b/distribute_android/docker_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: './distribute_android/Dockerfile' + args: + - ${{ inputs.who-to-greet }} + - CONFIG=release \ No newline at end of file diff --git a/distribute_android/install-qt.sh b/distribute_android/install-qt.sh new file mode 100644 index 0000000000..7224fb6c72 --- /dev/null +++ b/distribute_android/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="http://download.qt.io/online/qtsdkrepository/${HOST_OS}/${TARGET_PLATFORM}" + local ANDROID_ARCH=$(echo ${TOOLCHAIN##android_}) + + if [[ "${COMPONENT}" =~ "qtcreator" ]]; then + + SHORT_VERSION=${VERSION%??} + BASE_URL="http://download.qt.io/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/windows/autorelease_windows.bat b/windows/autorelease_windows.bat deleted file mode 100644 index 6da09c0346..0000000000 --- a/windows/autorelease_windows.bat +++ /dev/null @@ -1 +0,0 @@ -# Sets up the environment for autobuild on Windows diff --git a/windows/autorelease_windows.ps1 b/windows/autorelease_windows.ps1 new file mode 100644 index 0000000000..9d1725ce30 --- /dev/null +++ b/windows/autorelease_windows.ps1 @@ -0,0 +1,19 @@ +# Sets up the environment for autobuild on Windows + +# Get the source path via parameter +param ([string] $sourcepath) + +echo "Install Qt..." +# Install Qt +pip install aqtinstall +echo "Get Qt 64 bit..." +aqt install --outputdir C:\Qt 5.15.2 windows desktop win64_msvc2019_64 +echo "Get Qt 32 bit..." +aqt install --outputdir C:\Qt 5.15.2 windows desktop win32_msvc2019 + +echo "Build installer..." +# Build the installer +powershell "$sourcepath\windows\deploy_windows.ps1" "C:\Qt\5.15.2" + +# Rename the installer +cp "$sourcepath\deploy\Jamulus*installer-win.exe" "$sourcepath\deploy\Jamulus-installer-win.exe"