Travis builds for Linux and Android

This commit is contained in:
pokamest 2022-08-19 16:17:37 +03:00
parent eec8743e2f
commit 2e42c5e875
6 changed files with 270 additions and 439 deletions

View file

@ -1,5 +1,3 @@
language: cpp
branches:
only:
- master
@ -10,7 +8,8 @@ jobs:
include:
- name: MacOS
os: osx
osx_image: xcode12.5
osx_image: xcode13.4
language: cpp
env:
- QT_VERSION=5.15.2
@ -35,9 +34,9 @@ jobs:
deploy:
provider: releases
token: $GH_TOKEN
skip_cleanup: true
cleanup: false
file:
- "AmneziaVPN_unsigned.dmg"
- "AmneziaVPN.dmg"
on:
tags: true
branch: master
@ -45,6 +44,7 @@ jobs:
# ------------------------------------------------------
- name: Windows_x64
os: windows
language: cpp
env:
- PATH=/c/Python39:/c/Python39/Scripts:$PATH
@ -53,11 +53,9 @@ jobs:
- QT_BIN_DIR="c:\\Qt\\$QT_VERSION\\msvc2019_64\\bin"
- QIF_BIN_DIR="c:\\Qt\\Tools\\QtInstallerFramework\\${QIF_VERSION}\\bin"
- BUILD_ARCH=64
- MSVC_PATH="/C/Program Files (x86)/Microsoft Visual Studio/2019/Community"
- MSVC_PATH_WIN="C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community"
install:
- if [ ! -f "$MSVC_PATH/VC/Auxiliary/Build/vcvars64.bat" ]; then choco install --ignorepackagecodes --no-progress -y visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended --nocache --installPath $MSVC_PATH_WIN"; fi
- if [ ! -f /C/Qt/$QT_VERSION/msvc2019_64/bin/qmake ]; then choco install python --version 3.9.1; fi
- |
if [ ! -f /C/Qt/$QT_VERSION/msvc2019_64/bin/qmake ]; then \
@ -69,8 +67,6 @@ jobs:
fi
script:
- dir "%MSVC_PATH%\VC\Auxiliary\Build"
- dir "%MSVC_PATH%\Common7\Tools"
- echo set BUILD_ARCH=$BUILD_ARCH > winbuild.bat
- echo set QT_BIN_DIR="$QT_BIN_DIR" >> winbuild.bat
- echo set QIF_BIN_DIR="$QIF_BIN_DIR" >> winbuild.bat
@ -82,7 +78,7 @@ jobs:
deploy:
provider: releases
token: $GH_TOKEN
skip_cleanup: true
cleanup: false
file:
- "AmneziaVPN_x64.exe"
on:
@ -92,6 +88,7 @@ jobs:
# ------------------------------------------------------
- name: Windows_x32
os: windows
language: cpp
env:
- PATH=/c/Python39:/c/Python39/Scripts:$PATH
@ -100,11 +97,9 @@ jobs:
- QT_BIN_DIR="c:\\Qt\\${QT_VERSION}\\msvc2019\\bin"
- QIF_BIN_DIR="c:\\Qt\\Tools\\QtInstallerFramework\\${QIF_VERSION}\\bin"
- BUILD_ARCH=32
- MSVC_PATH="/C/Program Files (x86)/Microsoft Visual Studio/2019/Community"
- MSVC_PATH_WIN="C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community"
install:
- if [ ! -f "$MSVC_PATH/VC/Auxiliary/Build/vcvars64.bat" ]; then choco install --ignorepackagecodes --no-progress -y visualstudio2019buildtools --package-parameters "--add Microsoft.VisualStudio.Workload.VCTools --add Microsoft.VisualStudio.Workload.NativeDesktop --add Microsoft.VisualStudio.Component.VC.ATLMFC --includeRecommended --nocache --installPath $MSVC_PATH_WIN"; fi
- if [ ! -f /C/Qt/$QT_VERSION/msvc2019/bin/qmake ]; then choco install python --version 3.9.1; fi
- |
if [ ! -f /C/Qt/$QT_VERSION/msvc2019/bin/qmake ]; then \
@ -116,8 +111,6 @@ jobs:
fi
script:
- dir "%MSVC_PATH%\VC\Auxiliary\Build"
- dir "%MSVC_PATH%\Common7\Tools"
- echo set BUILD_ARCH=$BUILD_ARCH > winbuild.bat
- echo set QT_BIN_DIR="$QT_BIN_DIR" >> winbuild.bat
- echo set QIF_BIN_DIR="$QIF_BIN_DIR" >> winbuild.bat
@ -129,15 +122,112 @@ jobs:
deploy:
provider: releases
token: $GH_TOKEN
skip_cleanup: true
cleanup: false
file:
- "AmneziaVPN_x32.exe"
on:
tags: true
branch: master
deploy:
skip_cleanup: true
# ------------------------------------------------------
- name: Linux
os: linux
env:
- QT_VERSION=5.15.2
- QIF_VERSION=4.4
- QT_BIN_DIR=$HOME/Qt/$QT_VERSION/gcc_64/bin
- QIF_BIN_DIR=$QT_BIN_DIR/../../../Tools/QtInstallerFramework/$QIF_VERSION/bin
install:
- |
if [ ! -f $HOME/Qt/$QT_VERSION/gcc_64/bin/qmake ]; then \
apt install -yy p7zip python3 && \
python3 -m pip install --upgrade pip && \
pip install -U aqtinstall requests py7zr && \
pip show aqtinstall && \
aqt install-qt linux desktop $QT_VERSION clang_64 -m all -O $HOME/Qt && \
aqt install-tool linux desktop tools_ifw -O $HOME/Qt ; \
fi
script:
- bash deploy/build_linux.sh
deploy:
provider: releases
token: $GH_TOKEN
cleanup: false
file:
- "AmneziaVPN.bundle"
on:
tags: true
branch: master
# ------------------------------------------------------
- name: Android
os: linux
language: android
components:
# Uncomment the lines below if you want to
# use the latest revision of Android SDK Tools
# - tools
# - platform-tools
# The BuildTools version used by your project
- build-tools-30.0.2
# The SDK version used to compile your project
- android-30
# Additional components
- extra
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
env:
- QT_VERSION=5.15.2
- QT_BIN_DIR=$HOME/Qt/$QT_VERSION/android/bin
- USE_ANDROID_NDK_VERSION=21d
install:
- |
if [ ! -f $HOME/Qt/$QT_VERSION/android/bin/qmake ]; then \
apt install -yy p7zip python3 && \
python3 -m pip install --upgrade pip && \
pip install -U aqtinstall requests py7zr && \
pip show aqtinstall && \
aqt install-qt linux android $QT_VERSION armv7 -m all -O $HOME/Qt && \
aqt install-qt linux android $QT_VERSION arm64_v8a -m all -O $HOME/Qt && \
aqt install-qt linux android $QT_VERSION x86_64 -m all -O $HOME/Qt && \
aqt install-qt linux android $QT_VERSION x86 -m all -O $HOME/Qt && \
fi
- |
export TERM=dumb &&
curl -L https://dl.google.com/android/repository/android-ndk-r${USE_ANDROID_NDK_VERSION}-linux-x86_64.zip -O &&
unzip ./android-ndk-r${USE_ANDROID_NDK_VERSION}-linux-x86_64.zip > /dev/null &&
rm android-ndk-r${USE_ANDROID_NDK_VERSION}-linux-x86_64.zip &&
export ANDROID_NDK_HOME=`pwd`/android-ndk-r${USE_ANDROID_NDK_VERSION} &&
export LOCAL_ANDROID_NDK_HOME="$ANDROID_NDK_HOME" &&
export LOCAL_ANDROID_NDK_HOST_PLATFORM="linux-x86_64" &&
export PATH=$PATH:${ANDROID_NDK_HOME} &&
env
script:
- bash deploy/build_android.sh
deploy:
provider: releases
token: $GH_TOKEN
cleanup: false
file:
- "AmneziaVPN.aab"
on:
tags: true
branch: master
before_cache:
- if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew cleanup; fi
@ -149,4 +239,6 @@ cache:
- $HOME/Qt
- /C/Qt
- $HOME/Library/Caches/Homebrew
- "/C/Program Files (x86)/Microsoft Visual Studio/2019/Community"
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache

67
deploy/build_android.sh Normal file
View file

@ -0,0 +1,67 @@
#!/bin/bash
echo "Build script started ..."
set -o errexit -o nounset
# Hold on to current directory
PROJECT_DIR=$(pwd)
DEPLOY_DIR=$PROJECT_DIR/deploy
mkdir -p $DEPLOY_DIR/build
BUILD_DIR=$DEPLOY_DIR/build
echo "Project dir: ${PROJECT_DIR}"
echo "Build dir: ${BUILD_DIR}"
APP_NAME=AmneziaVPN
APP_FILENAME=$APP_NAME.app
APP_DOMAIN=org.amneziavpn.package
OUT_APP_DIR=$BUILD_DIR/client
BUNDLE_DIR=$OUT_APP_DIR/$APP_FILENAME
INSTALLER_DATA_DIR=$BUILD_DIR/installer/packages/$APP_DOMAIN/data
INSTALLER_BUNDLE_DIR=$BUILD_DIR/installer/$APP_FILENAME
PRO_FILE_PATH=$PROJECT_DIR/$APP_NAME.pro
QMAKE_STASH_FILE=$PROJECT_DIR/.qmake_stash
# Seacrh Qt
if [ -z "${QT_VERSION+x}" ]; then
QT_VERSION=5.15.2;
QT_BIN_DIR=$HOME/Qt/$QT_VERSION/gcc_64/bin
fi
echo "Using Qt in $QT_BIN_DIR"
# Checking env
$QT_BIN_DIR/qmake -v
make -v
gcc -v
# Build App
echo "Building App..."
cd $BUILD_DIR
$QT_BIN_DIR/qmake -r -spec android-clang CONFIG+=qtquickcompiler ANDROID_ABIS="armeabi-v7a arm64-v8a x86 x86_64" $PROJECT_DIR/AmneziaVPN.pro
$ANDROID_NDK_HOME/prebuilt/linux-x86_64/bin/make -j2
$ANDROID_NDK_HOME/prebuilt/linux-x86_64/bin/make install INSTALL_ROOT=android
# Build and run tests here
#echo "............Deploy.................."
# TODO possible solution: https://github.com/mhoeher/opentodolist/blob/b8981852e500589851132a02c5a62af9b0ed592c/ci/android-cmake-build.sh
#$QT_BIN_DIR/androiddeployqt \
# --output $OUT_APP_DIR \
# --gradle \
# --release \
# --deployment bundled
#cp $OUT_APP_DIR/build/outputs/apk/release/android-build-release-unsigned.apk \
# OpenTodoList-${ANDROID_ABIS}-${OTL_VERSION}.apk

59
deploy/build_linux.sh Normal file
View file

@ -0,0 +1,59 @@
#!/bin/bash
echo "Build script started ..."
set -o errexit -o nounset
# Hold on to current directory
PROJECT_DIR=$(pwd)
DEPLOY_DIR=$PROJECT_DIR/deploy
mkdir -p $DEPLOY_DIR/build
BUILD_DIR=$DEPLOY_DIR/build
echo "Project dir: ${PROJECT_DIR}"
echo "Build dir: ${BUILD_DIR}"
APP_NAME=AmneziaVPN
APP_FILENAME=$APP_NAME.app
APP_DOMAIN=org.amneziavpn.package
OUT_APP_DIR=$BUILD_DIR/client
BUNDLE_DIR=$OUT_APP_DIR/$APP_FILENAME
DEPLOY_DATA_DIR=$PROJECT_DIR/deploy/data/linux
INSTALLER_DATA_DIR=$BUILD_DIR/installer/packages/$APP_DOMAIN/data
INSTALLER_BUNDLE_DIR=$BUILD_DIR/installer/$APP_FILENAME
PRO_FILE_PATH=$PROJECT_DIR/$APP_NAME.pro
QMAKE_STASH_FILE=$PROJECT_DIR/.qmake_stash
# Seacrh Qt
if [ -z "${QT_VERSION+x}" ]; then
QT_VERSION=5.15.2;
QIF_VERSION=4.1
QT_BIN_DIR=$HOME/Qt/$QT_VERSION/gcc_64/bin
QIF_BIN_DIR=$QT_BIN_DIR/../../../Tools/QtInstallerFramework/$QIF_VERSION/bin
fi
echo "Using Qt in $QT_BIN_DIR"
echo "Using QIF in $QIF_BIN_DIR"
# Checking env
$QT_BIN_DIR/qmake -v
make -v
gcc -v
# Build App
echo "Building App..."
cd $BUILD_DIR
$QT_BIN_DIR/qmake $PROJECT_DIR/AmneziaVPN.pro 'CONFIG+=release CONFIG+=x86_64'
make
# Build and run tests here
#echo "............Deploy.................."

View file

@ -3,6 +3,13 @@ echo "Build script started ..."
set -o errexit -o nounset
while getopts n: flag
do
case "${flag}" in
n) NOTARIZE_APP=1;;
esac
done
# Hold on to current directory
PROJECT_DIR=$(pwd)
DEPLOY_DIR=$PROJECT_DIR/deploy
@ -27,7 +34,7 @@ INSTALLER_BUNDLE_DIR=$BUILD_DIR/installer/$APP_FILENAME
PRO_FILE_PATH=$PROJECT_DIR/$APP_NAME.pro
QMAKE_STASH_FILE=$PROJECT_DIR/.qmake_stash
DMG_FILENAME=$PROJECT_DIR/${APP_NAME}_unsigned.dmg
DMG_FILENAME=$PROJECT_DIR/${APP_NAME}.dmg
# Seacrh Qt
if [ -z "${QT_VERSION+x}" ]; then
@ -121,37 +128,39 @@ echo "Building installer..."
$QIF_BIN_DIR/binarycreator --offline-only -v -c $BUILD_DIR/installer/config/macos.xml -p $BUILD_DIR/installer/packages -f $INSTALLER_BUNDLE_DIR
if [ "${MAC_CERT_PW+x}" ]; then
echo "Signing installer bundle..."
security unlock-keychain -p $TEMP_PASS $KEYCHAIN
/usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "Developer ID Application: Privacy Technologies OU (X7UJ388FXK)" $INSTALLER_BUNDLE_DIR
/usr/bin/codesign --verify -vvvv $INSTALLER_BUNDLE_DIR || true
echo "Notatizing installer bundle..."
/usr/bin/ditto -c -k --keepParent $INSTALLER_BUNDLE_DIR $PROJECT_DIR/Installer_bundle_to_notarize.zip
xcrun altool --notarize-app -f $PROJECT_DIR/Installer_bundle_to_notarize.zip -t osx --primary-bundle-id "$APP_DOMAIN" -u "$APPLE_DEV_EMAIL" -p $APPLE_DEV_PASSWORD
rm $PROJECT_DIR/Installer_bundle_to_notarize.zip
sleep 600
xcrun stapler staple $INSTALLER_BUNDLE_DIR
xcrun stapler validate $INSTALLER_BUNDLE_DIR
spctl -a -vvvv $INSTALLER_BUNDLE_DIR || true
echo "Signing installer bundle..."
security unlock-keychain -p $TEMP_PASS $KEYCHAIN
/usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "Developer ID Application: Privacy Technologies OU (X7UJ388FXK)" $INSTALLER_BUNDLE_DIR
/usr/bin/codesign --verify -vvvv $INSTALLER_BUNDLE_DIR || true
if [ "${NOTARIZE_APP+x}" ]; then
echo "Notatizing installer bundle..."
/usr/bin/ditto -c -k --keepParent $INSTALLER_BUNDLE_DIR $PROJECT_DIR/Installer_bundle_to_notarize.zip
xcrun altool --notarize-app -f $PROJECT_DIR/Installer_bundle_to_notarize.zip -t osx --primary-bundle-id "$APP_DOMAIN" -u "$APPLE_DEV_EMAIL" -p $APPLE_DEV_PASSWORD
rm $PROJECT_DIR/Installer_bundle_to_notarize.zip
sleep 600
xcrun stapler staple $INSTALLER_BUNDLE_DIR
xcrun stapler validate $INSTALLER_BUNDLE_DIR
spctl -a -vvvv $INSTALLER_BUNDLE_DIR || true
fi
fi
echo "Building DMG installer..."
hdiutil create -volname $APP_NAME -srcfolder $BUILD_DIR/installer/$APP_NAME.app -ov -format UDZO $DMG_FILENAME
if [ "${MAC_CERT_PW+x}" ]; then
echo "Signing DMG installer..."
security unlock-keychain -p $TEMP_PASS $KEYCHAIN
/usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "Developer ID Application: Privacy Technologies OU (X7UJ388FXK)" $DMG_FILENAME
/usr/bin/codesign --verify -vvvv $DMG_FILENAME || true
echo "Notatizing DMG installer..."
xcrun altool --notarize-app -f $DMG_FILENAME -t osx --primary-bundle-id $APP_DOMAIN -u $APPLE_DEV_EMAIL -p $APPLE_DEV_PASSWORD
sleep 600
xcrun stapler staple $DMG_FILENAME
xcrun stapler validate $DMG_FILENAME
echo "Signing DMG installer..."
security unlock-keychain -p $TEMP_PASS $KEYCHAIN
/usr/bin/codesign --deep --force --verbose --timestamp -o runtime --sign "Developer ID Application: Privacy Technologies OU (X7UJ388FXK)" $DMG_FILENAME
/usr/bin/codesign --verify -vvvv $DMG_FILENAME || true
if [ "${NOTARIZE_APP+x}" ]; then
echo "Notatizing DMG installer..."
xcrun altool --notarize-app -f $DMG_FILENAME -t osx --primary-bundle-id $APP_DOMAIN -u $APPLE_DEV_EMAIL -p $APPLE_DEV_PASSWORD
sleep 600
xcrun stapler staple $DMG_FILENAME
xcrun stapler validate $DMG_FILENAME
fi
fi
echo "Finished, artifact is $DMG_FILENAME"

View file

@ -1,335 +0,0 @@
#!/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$
##
#############################################################################
set -eu
function help() {
cat <<EOF
usage: install-qt [options] [components]
Examples
./install-qt.sh --version 5.13.1 qtbase
./install-qt.sh --version 5.14.0 --target android --toolchain any qtbase qtscript
Positional arguments
components
SDK components to be installed. All possible components
can be found in the online repository at https://download.qt.io,
for instance: qtbase, qtdeclarative, qtscript, qttools, icu, ...
In addition to Qt packages, qtcreator is also accepted.
The actual availability of packages may differ depending on
target and toolchain.
Options
-d, --directory <directory>
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 <host-os>
The host operating system. Can be one of linux_x64, mac_x64,
windows_x86. Auto-detected by default.
--target <target-platform>
The desired target platform. Can be one of desktop, android, ios.
The default value is desktop.
--toolchain <toolchain-type>
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 <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
7z l -ba -slt -y ${DOWNLOAD_DIR}/package.7z | tr '\\' '/' | sed -n -e "s|^Path\ =\ |${INSTALL_DIR}/|p" >> "${HASH_FILEPATH}"
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" ] && [ ! "${QT_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

View file

@ -1,61 +0,0 @@
#!/bin/bash -ex
QT_BIN_DIR='/Users/admin/Qt/5.14.2/clang_64/bin'
QIF_BIN_DIR='/Users/admin/Qt/Tools/QtInstallerFramework/4.0/bin'
APP_NAME=AmneziaVPN
APP_FILENAME=$APP_NAME.app
APP_DOMAIN=org.amneziavpn.package
PLIST_NAME=$APP_NAME.plist
LAUNCH_DIR=$(pwd)
TOP_DIR=$LAUNCH_DIR/..
RELEASE_DIR=$TOP_DIR/../$APP_NAME-build
OUT_APP_DIR=$RELEASE_DIR/client/release
BUNDLE_DIR=$OUT_APP_DIR/$APP_FILENAME
DEPLOY_DATA_DIR=$LAUNCH_DIR/data/macos
INSTALLER_DATA_DIR=$RELEASE_DIR/installer/packages/$APP_DOMAIN/data
PRO_FILE_PATH=$TOP_DIR/$APP_NAME.pro
QMAKE_STASH_FILE=$TOP_DIR/.qmake_stash
TARGET_FILENAME=$TOP_DIR/$APP_NAME.dmg
cleanBuild()
{
rm -rf $RELEASE_DIR
rm -rf $QMAKE_STASH_FILE
}
cleanBuild
cd $TOP_DIR
$QT_BIN_DIR/qmake $PRO_FILE_PATH 'CONFIG+=release CONFIG+=x86_64'
make -j `sysctl -n hw.ncpu`
$QT_BIN_DIR/macdeployqt $OUT_APP_DIR/$APP_FILENAME -always-overwrite
cp -av $RELEASE_DIR/server/release/$APP_NAME-service.app/Contents/macOS/$APP_NAME-service $BUNDLE_DIR/Contents/macOS
cp -Rv $LAUNCH_DIR/data/macos/* $BUNDLE_DIR/Contents/macOS
mkdir -p $INSTALLER_DATA_DIR
cp -av $LAUNCH_DIR/installer $RELEASE_DIR
cp -av $DEPLOY_DATA_DIR/post_install.sh $INSTALLER_DATA_DIR/post_install.sh
cp -av $DEPLOY_DATA_DIR/post_uninstall.sh $INSTALLER_DATA_DIR/post_uninstall.sh
cp -av $DEPLOY_DATA_DIR/$PLIST_NAME $INSTALLER_DATA_DIR/$PLIST_NAME
rm -f $BUNDLE_DIR/Contents/macOS/post_install.sh $BUNDLE_DIR/Contents/macOS/post_uninstall.sh
chmod a+x $INSTALLER_DATA_DIR/post_install.sh $INSTALLER_DATA_DIR/post_uninstall.sh
cd $BUNDLE_DIR
tar czf $INSTALLER_DATA_DIR/$APP_NAME.tar.gz ./
cd $RELEASE_DIR/installer
$QIF_BIN_DIR/binarycreator --offline-only -v -c config/macos.xml -p packages -f $APP_NAME
hdiutil create -volname $APP_NAME -srcfolder $APP_NAME.app -ov -format UDZO $TARGET_FILENAME
cleanBuild
cd $LAUNCH_DIR
echo "Finished, see $APP_NAME.dmg in '$TOP_DIR'"