diff options
Diffstat (limited to 'coin/provisioning/common/unix')
28 files changed, 1178 insertions, 793 deletions
diff --git a/coin/provisioning/common/unix/DownloadURL.sh b/coin/provisioning/common/unix/DownloadURL.sh index 0579451f..455d65d3 100755 --- a/coin/provisioning/common/unix/DownloadURL.sh +++ b/coin/provisioning/common/unix/DownloadURL.sh @@ -1,37 +1,6 @@ -#!/bin/sh - -############################################################################# -## -## Copyright (C) 2019 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +#!/bin/bash +# Copyright (C) 2019 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # A helper script used for downloading a file from a URL or an alternative @@ -39,10 +8,12 @@ # based on the SHA length). Target filename should also be given. ############################ BOILERPLATE ############################### -command -v sha1sum >/dev/null || alias sha1sum='shasum -a 1' -command -v sha256sum >/dev/null || alias sha256sum='shasum -a 256' -command -v sha384sum >/dev/null || alias sha384sum='shasum -a 384' -command -v sha512sum >/dev/null || alias sha512sum='shasum -a 512' + +command -v sha1sum >/dev/null || sha1sum () { shasum -a 1 "$@" ; } +command -v sha256sum >/dev/null || sha256sum () { shasum -a 256 "$@" ; } +command -v sha384sum >/dev/null || sha384sum () { shasum -a 384 "$@" ; } +command -v sha512sum >/dev/null || sha512sum () { shasum -a 512 "$@" ; } + ######################################################################## @@ -50,9 +21,12 @@ Download () { url="$1" targetFile="$2" - command -v curl >/dev/null \ - && curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" \ - || wget --tries 5 -O "$targetFile" "$url" + if command -v curl >/dev/null + then + curl --fail -L --retry 5 --retry-delay 5 -o "$targetFile" "$url" + else + wget --tries 5 -O "$targetFile" "$url" + fi } VerifyHash () { @@ -73,10 +47,10 @@ VerifyHash () { 65) sha256sum "$file" ;; 97) sha384sum "$file" ;; 129) sha512sum "$file" ;; - *) echo "FATAL! Unknown hash length: $hashLength" 1>&2 && exit 1 ;; + *) echo "FATAL! Unknown hash length: $hashLength" 1>&2 ;; esac | cut -d ' ' -f 1` - if [ ! "$expectedHash" = "$hash" ] + if [ -z "$hash" ] || [ ! "$expectedHash" = "$hash" ] then echo "FAIL! wrong file hash: $file $hash" 1>&2 return 1 @@ -89,22 +63,36 @@ DownloadURL () { url=$1 url2=$2 expectedHash=$3 - targetFile=$4 - - if VerifyHash "$targetFile" "$expectedHash" + # Optional argument $4: destination filename + if [ -z "$4" ] then - echo "Skipping download, found and validated existing file: $targetFile" + # defaults to the last component of $url + targetFile="${url/*\//}" else - echo "Downloading from primary URL: $url" - if ! Download "$url" "$targetFile" + targetFile=$4 + fi + + # If a non-empty file already exists + if [ -s "$targetFile" ] + then + if VerifyHash "$targetFile" "$expectedHash" + then + echo "Skipping download, found and validated existing file: $targetFile" + return + else + echo "WARNING: Non-empty but different file found at destination; will re-download and overwrite file: $targetFile" + fi + fi + + echo "Downloading from primary URL: $url" + if ! Download "$url" "$targetFile" + then + echo "FAIL! to download, trying alternative URL: $url2" 1>&2 + if ! Download "$url2" "$targetFile" then - echo "FAIL! to download, trying alternative URL: $url2" 1>&2 - if ! Download "$url" "$targetFile" - then - echo 'FAIL! to download even from alternative url' 1>&2 - return 1 - fi + echo 'FAIL! to download even from alternative URL' 1>&2 + return 1 fi - VerifyHash "$targetFile" "$expectedHash" fi + VerifyHash "$targetFile" "$expectedHash" } diff --git a/coin/provisioning/common/unix/InstallFromCompressedFileFromURL.sh b/coin/provisioning/common/unix/InstallFromCompressedFileFromURL.sh index 34bcf289..c1358fdd 100755 --- a/coin/provisioning/common/unix/InstallFromCompressedFileFromURL.sh +++ b/coin/provisioning/common/unix/InstallFromCompressedFileFromURL.sh @@ -1,37 +1,6 @@ #!/usr/bin/env bash - -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2018 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only set -ex @@ -67,6 +36,9 @@ function InstallFromCompressedFileFromURL { "xz") tar -xf "$targetFile" --directory "$targetDirectory" ;; + "tbz2") + tar -xjf "$targetFile" --directory "$targetDirectory" + ;; *) exit 1 ;; diff --git a/coin/provisioning/common/unix/SetEnvVar.sh b/coin/provisioning/common/unix/SetEnvVar.sh index d5aa4dcd..3f457bb4 100755 --- a/coin/provisioning/common/unix/SetEnvVar.sh +++ b/coin/provisioning/common/unix/SetEnvVar.sh @@ -1,37 +1,6 @@ #!/usr/bin/env bash - -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # A helper script used for setting environment variables on Unix systems @@ -43,9 +12,17 @@ function SetEnvVar { echo "Setting environment variable $name to $path." - if uname -a |grep -q "Ubuntu"; then - echo "export $name=$path" >> ~/.profile + if uname -a |grep -q -E "Ubuntu|Debian"; then + if lsb_release -a |grep "Ubuntu 22.04"; then + echo "export $name=$path" >> ~/.bashrc + echo "export $name=$path" >> ~/.bash_profile + else + echo "export $name=$path" >> ~/.profile + fi else echo "export $name=$path" >> ~/.bashrc + echo "export $name=$path" >> ~/.zshrc + echo "export $name=$path" >> ~/.zshenv + echo "export $name=$path" >> ~/.zprofile fi } diff --git a/coin/provisioning/common/unix/check_and_set_proxy.sh b/coin/provisioning/common/unix/check_and_set_proxy.sh index 1c33641a..59598205 100755 --- a/coin/provisioning/common/unix/check_and_set_proxy.sh +++ b/coin/provisioning/common/unix/check_and_set_proxy.sh @@ -1,36 +1,6 @@ #!/usr/bin/env bash -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2017 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only set -ex diff --git a/coin/provisioning/common/unix/common.sourced.sh b/coin/provisioning/common/unix/common.sourced.sh index a52880b2..c15d9453 100644..100755 --- a/coin/provisioning/common/unix/common.sourced.sh +++ b/coin/provisioning/common/unix/common.sourced.sh @@ -1,38 +1,6 @@ #!/bin/sh - - -############################################################################# -## -## Copyright (C) 2019 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2019 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # Script to be sourced from everywhere you need a common environment. Defines: @@ -43,6 +11,7 @@ export PROVISIONING_ARCH export CMD_PKG_INSTALL export CMD_PKG_LOCALINSTALL export CMD_INSTALL +export COIN_RUNS_IN_QT_COMPANY @@ -65,8 +34,10 @@ fatal () { fi } +# Takes one argument which should be the filename of this script. Returns true +# if the script is being sourced, false if the script is being executed. is_script_executed () { - [ x"$(basename "$0")" = x"$1" ] + [ "$(basename "$(echo "$0" | sed s/^-//)")" = "$1" ] } @@ -74,20 +45,39 @@ is_script_executed common.sourced.sh \ && fatal "Script common.sourced.sh should always be sourced, not executed" +_detect_linux_OS_ID () { + if [ -f /etc/os-release ] + then + # shellcheck source=/dev/null + . /etc/os-release + PROVISIONING_OS_ID="$ID" + elif [ -f /etc/redhat-release ] + then + case "$(cat /etc/redhat-release)" in + "Red Hat Enterprise Linux"*) + PROVISIONING_OS_ID="rhel" + ;; + "CentOS Linux"*) + PROVISIONING_OS_ID="centos" + ;; + *) fatal "Unknown string in /etc/redhat-release" ;; + esac + fi +} + set_common_environment () { # Unfortunately we can't find the provisioning directory from a sourced # script in a portable way # PROVISIONING_DIR="$(dirname "$0")/../../" - [ x"$PROVISIONING_DIR" = x ] \ + [ -z "$PROVISIONING_DIR" ] \ && fatal "PROVISIONING_DIR variable needs to be set before calling set_common_environment" uname_s="$(uname -s)" case "$uname_s" in Linux) PROVISIONING_OS=linux - . /etc/os-release - PROVISIONING_OS_ID="$ID" + _detect_linux_OS_ID case "$PROVISIONING_OS_ID" in suse|sles|opensuse*) CMD_PKG_INSTALL="sudo zypper -nq install" @@ -118,11 +108,19 @@ set_common_environment () { uname_m="$(uname -m)" case "$uname_m" in x86_64|amd64) PROVISIONING_ARCH=amd64 ;; + aarch64|arm64)PROVISIONING_ARCH=arm64 ;; i[3456]86) PROVISIONING_ARCH=x86 ;; *) fatal "Unknown architecture in uname: $uname_m" 43 ;; esac CMD_INSTALL="sudo install" + + COIN_RUNS_IN_QT_COMPANY=false + if ping -c1 repo-clones.ci.qt.io >/dev/null 2>&1 + then + COIN_RUNS_IN_QT_COMPANY=true + fi + } set_common_environment diff --git a/coin/provisioning/common/unix/disable-ntp_macos.sh b/coin/provisioning/common/unix/disable-ntp_macos.sh index 581ea7cb..fd490e43 100755 --- a/coin/provisioning/common/unix/disable-ntp_macos.sh +++ b/coin/provisioning/common/unix/disable-ntp_macos.sh @@ -1,37 +1,6 @@ #!/usr/bin/env bash - -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2018 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only set -ex diff --git a/coin/provisioning/common/unix/emsdk.sh b/coin/provisioning/common/unix/emsdk.sh index acb2483a..580f966f 100755 --- a/coin/provisioning/common/unix/emsdk.sh +++ b/coin/provisioning/common/unix/emsdk.sh @@ -1,97 +1,54 @@ #!/usr/bin/env bash -############################################################################# -## -## Copyright (C) 2019 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -# shellcheck source=./InstallFromCompressedFileFromURL.sh -source "${BASH_SOURCE%/*}/InstallFromCompressedFileFromURL.sh" # shellcheck source=./SetEnvVar.sh source "${BASH_SOURCE%/*}/SetEnvVar.sh" + # shellcheck source=./DownloadURL.sh source "${BASH_SOURCE%/*}/DownloadURL.sh" -version="1.38.27" -version_node="8.9.1" -urlOfficial="https://s3.amazonaws.com/mozilla-games/emscripten/packages" -urlCache="http://ci-files01-hki.intra.qt.io/input/emsdk" -targetFolder="/opt/emsdk" - -urlEmscriptenCache="$urlCache/emscripten-$version.tar.gz" -urlEmscriptenExternal="https://github.com/kripken/emscripten/archive/$version.tar.gz" -sha1Emscripten="ff9748a8f6b8eaa8192cce9fe2befc801443a161" - +version="3.1.50" +versionNode="v16.20.0" +tarBallVersion="${version//./_}" if uname -a |grep -q Darwin; then - urlEmscriptenLlvmCache="$urlCache/macos/emscripten-llvm-e$version.tar.gz" - urlEmscriptenLlvmExternal="$urlOfficial/llvm/tag/osx_64bit/emscripten-llvm-e$version.tar.gz" - urlNodeCache="$urlCache/macos/node-v$version_node-darwin-x64.tar.gz" - urlNodeExternal="$urlOfficial/node-v$version_node-darwin-x64.tar.gz" - sha1EmscriptenLlvm="66dffbc44cfcb7bcb1ed0d2658b519276c3077fa" - sha1Node="b9ec6fe9701d385e385886a4b171ba02bb6aead7" - node_js="$targetFolder/node-v$version_node-darwin-x64/bin" + tarBallPackage="emsdk_macos_${tarBallVersion}.tar.gz" + sha="c12169ec8d22fc7a9ef1ba98027435bdf3b72729" else - urlEmscriptenLlvmCache="$urlCache/linux/emscripten-llvm-e$version.tar.gz" - urlEmscriptenLlvmExternal="$urlOfficial/llvm/tag/linux_64bit/emscripten-llvm-e$version.tar.gz" - urlNodeCache="$urlCache/linux/node-v$version_node-linux-x64.tar.xz" - urlNodeExternal="$urlOfficial/node-v$version_node-linux-x64.tar.xz" - sha1EmscriptenLlvm="8f5cd026c98cd40e53e6d11fbc32b116280ef9bb" - sha1Node="eaec5de2af934f7ebc7f9597983e71c5d5a9a726" - node_js="$targetFolder/node-v$version_node-linux-x64/bin" + tarBallPackage="emsdk_linux_${tarBallVersion}.tar.gz" + sha="5d81a8f1ddcb8d74c70ba5608efd4266c857944a" fi +cacheUrl="https://ci-files01-hki.ci.qt.io/input/emsdk/${tarBallPackage}" +target="/tmp/${tarBallPackage}" -sudo mkdir "$targetFolder" +mkdir -p /opt +cd /opt +echo "URL: $cacheUrl" -InstallFromCompressedFileFromURL "$urlEmscriptenCache" "$urlEmscriptenExternal" "$sha1Emscripten" "$targetFolder" "" -InstallFromCompressedFileFromURL "$urlEmscriptenLlvmCache" "$urlEmscriptenLlvmExternal" "$sha1EmscriptenLlvm" "$targetFolder" "" -InstallFromCompressedFileFromURL "$urlNodeCache" "$urlNodeExternal" "$sha1Node" "$targetFolder" "" +if DownloadURL "$cacheUrl" "" "$sha" "$target"; then + sudo tar -xzf "$target" -C /opt/ + sudo rm -f "$target" +else + echo "Emsdk isn't cached. Cloning it" + sudo git clone https://github.com/emscripten-core/emsdk.git + cd emsdk + sudo ./emsdk install "$version" + sudo ./emsdk activate "$version" +fi -sudo chmod -R a+rwx "$targetFolder" +# platform-specific toolchain and node binaries. urls obtained from "emsdk install" +if uname -a |grep -q Darwin; then + pathNodeExecutable="node-$versionNode-darwin-x64/bin/node" +else + pathNodeExecutable="node-$versionNode-linux-x64/bin/node" +fi -echo "Writing $targetFolder/.emscripten" -cat <<EOM >"$targetFolder/.emscripten" -LLVM_ROOT='$targetFolder/emscripten-llvm-e$version/' -EMSCRIPTEN_NATIVE_OPTIMIZER='$targetFolder/emscripten-llvm-e$version/optimizer' -BINARYEN_ROOT='$targetFolder/emscripten-llvm-e$version/binaryen' -NODE_JS='$node_js/node' -EMSCRIPTEN_ROOT='$targetFolder/emscripten-$version' -SPIDERMONKEY_ENGINE = '' -V8_ENGINE = '' -TEMP_DIR = '/tmp' -COMPILER_ENGINE = NODE_JS -JS_ENGINES = [NODE_JS] -EOM +emsdkPath="/opt/emsdk/" +emscriptenPath="${emsdkPath}upstream/emscripten/" -SetEnvVar "PATH" "\"\$PATH:$targetFolder/emscripten-llvm-e$version/:$node_js:$targetFolder/emscripten-$version\"" -SetEnvVar "EMSCRIPTEN" "$targetFolder/emscripten-$version" -SetEnvVar "EM_CONFIG" "$targetFolder/.emscripten" +SetEnvVar "PATH" "\"\$PATH:${emscriptenPath}\"" +SetEnvVar "EMSCRIPTEN" "${emscriptenPath}" +SetEnvVar "EMSDK" "${emsdkPath}" +SetEnvVar "EMSDK_NODE" "${emsdkPath}${pathNodeExecutable}" echo "Emsdk = $version" >> ~/versions.txt -echo "Emsdk node = $version_node" >> ~/versions.txt diff --git a/coin/provisioning/common/unix/install-breakpad.sh b/coin/provisioning/common/unix/install-breakpad.sh index b05b3510..7c3a34fb 100755 --- a/coin/provisioning/common/unix/install-breakpad.sh +++ b/coin/provisioning/common/unix/install-breakpad.sh @@ -1,37 +1,6 @@ #!/usr/bin/env bash - -############################################################################ -## -## Copyright (C) 2019 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################ +# Copyright (C) 2019 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # shellcheck source=../unix/DownloadURL.sh source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh" @@ -42,12 +11,12 @@ set -ex breakpad_commit_sha="b988fa74ec18de6214b18f723e48331d9a7802ae" breakpad_tar="breakpad_$breakpad_commit_sha.tar.gz" -breakpad_tar_url="http://ci-files01-hki.intra.qt.io/input/breakpad/$breakpad_tar" +breakpad_tar_url="http://ci-files01-hki.ci.qt.io/input/breakpad/$breakpad_tar" breakpad_tar_sha="a2d404d2aebc947cdac5840a9bccd65dfafae24c" linux_syscall_support_commit_sha1="93426bda6535943ff1525d0460aab5cc0870ccaf" linux_syscall_support_tar="linux-syscall-support_$linux_syscall_support_commit_sha1.tar.gz" -linux_syscall_support_tar_url="http://ci-files01-hki.intra.qt.io/input/linux-syscall-support/$linux_syscall_support_tar" +linux_syscall_support_tar_url="http://ci-files01-hki.ci.qt.io/input/linux-syscall-support/$linux_syscall_support_tar" linux_syscall_support_tar_sha="62565be0920f3661e138d68026b79fbbdc2a11e4" targetBreakpad="/tmp/$breakpad_tar" diff --git a/coin/provisioning/common/unix/install-conan.sh b/coin/provisioning/common/unix/install-conan.sh new file mode 100755 index 00000000..8fc83090 --- /dev/null +++ b/coin/provisioning/common/unix/install-conan.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +#Copyright (C) 2023 The Qt Company Ltd +#SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# shellcheck source=../unix/SetEnvVar.sh +source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" + +# This script will install Conan +# Note! Python3 is required for Conan installation + +os="$1" + +# Install Conan to Python user install directory (typically ~./local/) +pip3 install conan --user + +SetEnvVar "CONAN_REVISIONS_ENABLED" "1" +SetEnvVar "CONAN_V2_MODE" "1" + +if [ "$os" == "linux" ]; then + SetEnvVar "PATH" "/home/qt/.local/bin:\$PATH" +elif [ "$os" == "macos" ]; then + SetEnvVar "PATH" "/Users/qt/Library/Python/3.7/bin:\$PATH" +fi diff --git a/coin/provisioning/common/unix/install-ffmpeg-android.sh b/coin/provisioning/common/unix/install-ffmpeg-android.sh new file mode 100755 index 00000000..05d0b681 --- /dev/null +++ b/coin/provisioning/common/unix/install-ffmpeg-android.sh @@ -0,0 +1,106 @@ +#!/usr/bin/env bash +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# This script will build and install FFmpeg static libs +set -ex +os="$1" + +# shellcheck source=../unix/InstallFromCompressedFileFromURL.sh +source "${BASH_SOURCE%/*}/../unix/InstallFromCompressedFileFromURL.sh" +# shellcheck source=../unix/SetEnvVar.sh +source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" + +version="n6.1.1" +url_public="https://github.com/FFmpeg/FFmpeg/archive/refs/tags/$version.tar.gz" +sha1="59e0c3c4cc48e9c60073495f8c045329bb21f446" +url_cached="http://ci-files01-hki.ci.qt.io/input/ffmpeg/$version.tar.gz" +ffmpeg_name="FFmpeg-$version" + +target_dir="$HOME" +app_prefix="" +ffmpeg_source_dir="$target_dir/$ffmpeg_name" + +if [ ! -d "$ffmpeg_source_dir" ]; +then + InstallFromCompressedFileFromURL "$url_cached" "$url_public" "$sha1" "$target_dir" "$app_prefix" +fi + +build_ffmpeg_android() { + + target_arch=$1 + target_dir=$2 + + sudo mkdir -p "$target_dir" + + openssl_include="$OPENSSL_ANDROID_HOME_DEFAULT/include" + openssl_libs="" + if [ "$target_arch" == "x86_64" ]; then + target_toolchain_arch="x86_64-linux-android" + target_arch=x86_64 + target_cpu=x86-64 + openssl_libs="$OPENSSL_ANDROID_HOME_DEFAULT/x86_64" + elif [ "$target_arch" == "x86" ]; then + target_toolchain_arch="i686-linux-android" + target_arch=x86 + target_cpu=i686 + openssl_libs="$OPENSSL_ANDROID_HOME_DEFAULT/x86" + elif [ "$target_arch" == "arm64" ]; then + target_toolchain_arch="aarch64-linux-android" + target_arch=aarch64 + target_cpu=armv8-a + openssl_libs="$OPENSSL_ANDROID_HOME_DEFAULT/arm64-v8a" + fi + + api_version=24 + + ndk_root=$ANDROID_NDK_ROOT_DEFAULT + if uname -a |grep -q "Darwin"; then + ndk_host=darwin-x86_64 + else + ndk_host=linux-x86_64 + fi + + toolchain=${ndk_root}/toolchains/llvm/prebuilt/${ndk_host} + toolchain_bin=${toolchain}/bin + sysroot=${toolchain}/sysroot + cxx=${toolchain_bin}/${target_toolchain_arch}${api_version}-clang++ + cc=${toolchain_bin}/${target_toolchain_arch}${api_version}-clang + ar=${toolchain_bin}/llvm-ar + ranlib=${toolchain_bin}/llvm-ranlib + + ffmpeg_config_options=$(cat "${BASH_SOURCE%/*}/../shared/ffmpeg_config_options.txt") + ffmpeg_config_options+=" --enable-cross-compile --target-os=android --enable-jni --enable-mediacodec --enable-openssl --enable-pthreads --enable-neon --disable-asm --disable-indev=android_camera" + ffmpeg_config_options+=" --arch=$target_arch --cpu=${target_cpu} --sysroot=${sysroot} --sysinclude=${sysroot}/usr/include/" + ffmpeg_config_options+=" --cc=${cc} --cxx=${cxx} --ar=${ar} --ranlib=${ranlib}" + ffmpeg_config_options+=" --extra-cflags=-I${openssl_include} --extra-ldflags=-L${openssl_libs}" + + local build_dir="$ffmpeg_source_dir/build/$target_arch" + sudo mkdir -p "$build_dir" + pushd "$build_dir" + + # shellcheck disable=SC2086 + sudo "$ffmpeg_source_dir/configure" $ffmpeg_config_options --prefix="$target_dir" + + sudo make install -j4 + popd +} + +if [ "$os" == "android-x86" ]; then + target_arch=x86 + target_dir="/usr/local/android/ffmpeg-x86" + + SetEnvVar "FFMPEG_DIR_ANDROID_X86" "$target_dir" +elif [ "$os" == "android-x86_64" ]; then + target_arch=x86_64 + target_dir="/usr/local/android/ffmpeg-x86_64" + + SetEnvVar "FFMPEG_DIR_ANDROID_X86_64" "$target_dir" +elif [ "$os" == "android-arm64" ]; then + target_arch=arm64 + target_dir="/usr/local/android/ffmpeg-arm64" + + SetEnvVar "FFMPEG_DIR_ANDROID_ARM64" "$target_dir" +fi + +build_ffmpeg_android "$target_arch" "$target_dir" diff --git a/coin/provisioning/common/unix/install-ffmpeg-ios.sh b/coin/provisioning/common/unix/install-ffmpeg-ios.sh new file mode 100755 index 00000000..e2a401a5 --- /dev/null +++ b/coin/provisioning/common/unix/install-ffmpeg-ios.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# Copyright (C) 2024 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# This script will build and install FFmpeg static libs +set -ex + +# shellcheck source=../unix/InstallFromCompressedFileFromURL.sh +source "${BASH_SOURCE%/*}/../unix/InstallFromCompressedFileFromURL.sh" +# shellcheck source=../unix/SetEnvVar.sh +source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" + +version="n6.1.1" +sha1="59e0c3c4cc48e9c60073495f8c045329bb21f446" +url_public="https://github.com/FFmpeg/FFmpeg/archive/refs/tags/$version.tar.gz" +url_cached="http://ci-files01-hki.ci.qt.io/input/ffmpeg/$version.tar.gz" +ffmpeg_name="FFmpeg-$version" + +target_dir="$HOME" +ffmpeg_source_dir="$target_dir/$ffmpeg_name" +prefix="/usr/local/ios/ffmpeg" + +if [ ! -d "$ffmpeg_source_dir" ]; +then + InstallFromCompressedFileFromURL "$url_cached" "$url_public" "$sha1" "$target_dir" +fi + +ffmpeg_config_options=$(cat "${BASH_SOURCE%/*}/../shared/ffmpeg_config_options.txt") + +build_ffmpeg_ios() { + local target_arch=$1 + + if [ "$target_arch" == "x86_64" ]; then + target_sdk="iphonesimulator" + target_arch="x86_64" + minos="-mios-simulator-version-min=13.0" + else + target_sdk="iphoneos" + target_arch="arm64" + minos="-miphoneos-version-min=13.0" + fi + + local build_dir="$ffmpeg_source_dir/build_ios/$target_arch" + sudo mkdir -p "$build_dir" + pushd "$build_dir" + + # shellcheck disable=SC2086 + sudo "$ffmpeg_source_dir/configure" $ffmpeg_config_options \ + --sysroot="$(xcrun --sdk "$target_sdk" --show-sdk-path)" \ + --enable-cross-compile \ + --enable-optimizations \ + --prefix=$prefix \ + --arch=$target_arch \ + --cc="xcrun --sdk ${target_sdk} clang -arch $target_arch" \ + --cxx="xcrun --sdk ${target_sdk} clang++ -arch $target_arch" \ + --ar="$(xcrun --sdk ${target_sdk} --find ar)" \ + --ranlib="$(xcrun --sdk ${target_sdk} --find ranlib)" \ + --strip="$(xcrun --sdk ${target_sdk} --find strip)" \ + --nm="$(xcrun --sdk ${target_sdk} --find nm)" \ + --target-os=darwin \ + --extra-cflags="$minos" \ + --extra-cxxflags="$minos" \ + --enable-cross-compile \ + --enable-swscale \ + --enable-pthreads \ + --disable-audiotoolbox + + sudo make install DESTDIR="$build_dir/installed" -j + popd +} + +build_ffmpeg_ios "x86_64" +build_ffmpeg_ios "arm64" +sudo "${BASH_SOURCE%/*}/../macos/makeuniversal.sh" "$ffmpeg_source_dir/build_ios/x86_64/installed" "$ffmpeg_source_dir/build_ios/arm64/installed" +SetEnvVar "FFMPEG_DIR_IOS" $prefix + diff --git a/coin/provisioning/common/unix/install-ffmpeg.sh b/coin/provisioning/common/unix/install-ffmpeg.sh new file mode 100755 index 00000000..94d032ed --- /dev/null +++ b/coin/provisioning/common/unix/install-ffmpeg.sh @@ -0,0 +1,113 @@ +#!/usr/bin/env bash +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# This script will build and install FFmpeg static libs +set -ex +os="$1" + +# shellcheck source=../unix/InstallFromCompressedFileFromURL.sh +source "${BASH_SOURCE%/*}/../unix/InstallFromCompressedFileFromURL.sh" +# shellcheck source=../unix/SetEnvVar.sh +source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" + +version="n6.1.1" +url_public="https://github.com/FFmpeg/FFmpeg/archive/$version.tar.gz" +sha1="59e0c3c4cc48e9c60073495f8c045329bb21f446" +url_cached="http://ci-files01-hki.ci.qt.io/input/ffmpeg/$version.tar.gz" +ffmpeg_name="FFmpeg-$version" + +target_dir="$HOME" +app_prefix="" +ffmpeg_source_dir="$target_dir/$ffmpeg_name" + +if [ ! -d "$ffmpeg_source_dir" ] +then + InstallFromCompressedFileFromURL "$url_cached" "$url_public" "$sha1" "$target_dir" "$app_prefix" +fi + +ffmpeg_config_options=$(cat "${BASH_SOURCE%/*}/../shared/ffmpeg_config_options.txt") + +install_ff_nvcodec_headers() { + nv_codec_version="11.1" # use 11.1 to ensure compatibility with 470 nvidia drivers; might be upated to 12.0 + nv_codec_url_public="https://github.com/FFmpeg/nv-codec-headers/archive/refs/heads/sdk/$nv_codec_version.zip" + nv_codec_url_cached="http://ci-files01-hki.ci.qt.io/input/ffmpeg/nv-codec-headers/nv-codec-headers-sdk-$nv_codec_version.zip" + nv_codec_sha1="ceb4966ab01b2e41f02074675a8ac5b331bf603e" + #nv_codec_sha1="4f30539f8dd31945da4c3da32e66022f9ca59c08" // 12.0 + nv_codec_dir="$target_dir/nv-codec-headers-sdk-$nv_codec_version" + if [ ! -d "$nv_codec_dir" ] + then + InstallFromCompressedFileFromURL "$nv_codec_url_cached" "$nv_codec_url_public" "$nv_codec_sha1" "$target_dir" "" + fi + + sudo make -C "$nv_codec_dir" install -j + + # Might be not detected by default on RHEL + export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig" +} + +build_ffmpeg() { + local arch="$1" + local prefix="$2" + local build_dir="$ffmpeg_source_dir/build/$arch" + mkdir -p "$build_dir" + pushd "$build_dir" + + if [ -z "$prefix" ] + then prefix="/usr/local/$ffmpeg_name" + fi + + if [ -n "$arch" ] + then cc="clang -arch $arch" + fi + + # shellcheck disable=SC2086 + if [ -n "$arch" ] + then "$ffmpeg_source_dir/configure" $ffmpeg_config_options --prefix="$prefix" --enable-cross-compile --arch="$arch" --cc="$cc" + else "$ffmpeg_source_dir/configure" $ffmpeg_config_options --prefix="$prefix" + fi + make install DESTDIR="$build_dir/installed" -j4 + popd +} + +if [ "$os" == "linux" ]; then + install_ff_nvcodec_headers + + ffmpeg_config_options+=" --enable-openssl" + build_ffmpeg + sudo mv "$ffmpeg_source_dir/build/installed/usr/local/$ffmpeg_name" "/usr/local" + SetEnvVar "FFMPEG_DIR" "/usr/local/$ffmpeg_name" + +elif [ "$os" == "macos" ] || [ "$os" == "macos-universal" ]; then + ffmpeg_config_options+=" --enable-shared --disable-static" + + brew install yasm + export MACOSX_DEPLOYMENT_TARGET=12 + fix_relative_dependencies="${BASH_SOURCE%/*}/../macos/fix_relative_dependencies.sh" + + xcode_major_version=$(xcodebuild -version | awk 'NR==1 {split($2, a, "."); print a[1]}') + if [ "$xcode_major_version" -ge 15 ]; then + # fix the error: duplicate symbol '_av_ac3_parse_header' + ffmpeg_config_options+=" --extra-ldflags=-Wl,-ld_classic" + fi + + if [ "$os" == "macos" ]; then + build_ffmpeg + install_dir="$ffmpeg_source_dir/build/installed" + "$fix_relative_dependencies" "$install_dir/usr/local/$ffmpeg_name/lib" + sudo mv "$install_dir/usr/local/$ffmpeg_name" "/usr/local" + else + build_ffmpeg "arm64" + build_ffmpeg "x86_64" + + arm64_install_dir="$ffmpeg_source_dir/build/arm64/installed" + x86_64_install_dir="$ffmpeg_source_dir/build/x86_64/installed" + + "$fix_relative_dependencies" "$arm64_install_dir/usr/local/$ffmpeg_name/lib" + "$fix_relative_dependencies" "$x86_64_install_dir/usr/local/$ffmpeg_name/lib" + + sudo "${BASH_SOURCE%/*}/../macos/makeuniversal.sh" "$arm64_install_dir" "$x86_64_install_dir" + fi + + SetEnvVar "FFMPEG_DIR" "/usr/local/$ffmpeg_name" +fi diff --git a/coin/provisioning/common/unix/install-openssl.sh b/coin/provisioning/common/unix/install-openssl.sh index 01a20935..3b3353fb 100755 --- a/coin/provisioning/common/unix/install-openssl.sh +++ b/coin/provisioning/common/unix/install-openssl.sh @@ -1,86 +1,97 @@ #!/usr/bin/env bash - -############################################################################# -## -## Copyright (C) 2019 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # This script install OpenSSL from sources. # Requires GCC and Perl to be in PATH. set -ex os="$1" +SCRIPT_DIR="$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" # shellcheck source=../unix/DownloadURL.sh source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh" # shellcheck source=../unix/SetEnvVar.sh source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" - -version="1.1.1b" +version="3.0.7" officialUrl="https://www.openssl.org/source/openssl-$version.tar.gz" -cachedUrl="http://ci-files01-hki.intra.qt.io/input/openssl/openssl-$version.tar.gz" +cachedUrl="http://ci-files01-hki.ci.qt.io/input/openssl/openssl-$version.tar.gz" targetFile="/tmp/openssl-$version.tar.gz" -sha="e9710abf5e95c48ebf47991b10cbb48c09dae102" +sha="f20736d6aae36bcbfa9aba0d358c71601833bf27" opensslHome="${HOME}/openssl-${version}" opensslSource="${opensslHome}-src" DownloadURL "$cachedUrl" "$officialUrl" "$sha" "$targetFile" -tar -xzf "$targetFile" -C "$HOME" -mv "$opensslHome" "$opensslSource" +mkdir -p "$opensslSource" +tar -xzf "$targetFile" --strip 1 -C "$opensslSource" cd "$opensslSource" pwd if [[ "$os" == "linux" ]]; then - ./Configure --prefix="$opensslHome" shared no-ssl3-method enable-ec_nistp_64_gcc_128 linux-x86_64 "-Wa,--noexecstack" + if [ $(uname -m) = aarch64 ]; then + arch=$(uname -m) + else + arch="x86_64" + fi + ./Configure --prefix="$opensslHome" shared enable-ec_nistp_64_gcc_128 "linux-$arch" "-Wa,--noexecstack" make && make install_sw install_ssldirs SetEnvVar "OPENSSL_HOME" "$opensslHome" - if uname -a |grep -q "Ubuntu"; then - echo "export LD_LIBRARY_PATH=$opensslHome/lib:$LD_LIBRARY_PATH" >> ~/.bash_profile + SetEnvVar "PATH" "\"$opensslHome/bin:\$PATH\"" + if uname -a |grep -q "Debian"; then + SetEnvVar "LD_LIBRARY_PATH" "\"$opensslHome/lib:$LD_LIBRARY_PATH\"" else - echo "export LD_LIBRARY_PATH=$opensslHome/lib:$LD_LIBRARY_PATH" >> ~/.bashrc + SetEnvVar "LD_LIBRARY_PATH" "\"$opensslHome/lib64:$LD_LIBRARY_PATH\"" fi - -elif [ "$os" == "macos" ]; then +elif [ "$os" == "macos" ] || [ "$os" == "macos-universal" ]; then # Below target location has been hard coded into Coin. # QTQAINFRA-1195 - openssl_install_dir=/usr/local/openssl-$version - opensslTargetLocation="/usr/local/opt/openssl" - sudo ./Configure --prefix=$openssl_install_dir shared no-ssl3-method enable-ec_nistp_64_gcc_128 darwin64-x86_64-cc "-Wa,--noexecstack" - echo "Running 'make' for OpenSSL" - # shellcheck disable=SC2024 - sudo make --silent > /tmp/openssl_make.log 2>&1 - echo "Running 'make install' for OpenSSL" - # shellcheck disable=SC2024 - sudo make --silent install > /tmp/openssl_make_install.log 2>&1 + echo "prefix=$prefix" + if [[ -z "$prefix" ]]; then + prefix="/usr/local" + fi + openssl_install_dir="$prefix/openssl-$version" + opensslTargetLocation="$prefix/opt/openssl" + + commonFlags=(no-tests shared no-ssl3-method enable-ec_nistp_64_gcc_128 "-Wa,--noexecstack") + + export MACOSX_DEPLOYMENT_TARGET=12 + + opensslBuild="${opensslHome}-build" + opensslDestdir="${opensslHome}-destdir" + mkdir -p "$opensslBuild" + + if [ "$os" == "macos-universal" ]; then + archs="x86_64 arm64" + else + archs="$(uname -m)" + fi + + for arch in $archs; do + cd "$opensslBuild" + echo "Configuring OpenSSL for $arch" + mkdir -p "$arch" && cd "$arch" + "$opensslSource/Configure" --prefix="$openssl_install_dir" "${commonFlags[@]}" "darwin64-$arch-cc" + + echo "Building OpenSSL for $arch in $PWD" + make >> /tmp/openssl_make.log 2>&1 + + echo "Installing OpenSSL for $arch" + if [ "$os" == "macos-universal" ]; then + destdir="$opensslDestdir/$arch" + else + destdir="" + fi + # shellcheck disable=SC2024 + sudo make install_sw install_ssldirs DESTDIR="$destdir" >> /tmp/openssl_make_install.log 2>&1 + done + + if [ "$os" == "macos-universal" ]; then + echo "Making universal OpenSSL package" + # shellcheck disable=SC2024 + sudo rm -Rf "$openssl_install_dir" + sudo "${SCRIPT_DIR}/../macos/makeuniversal.sh" "$opensslDestdir/x86_64" "$opensslDestdir/arm64" + fi path=$(echo "$opensslTargetLocation" | sed -E 's/(.*)\/.*$/\1/') sudo mkdir -p "$path" - sudo ln -s $openssl_install_dir $opensslTargetLocation + sudo ln -s "$openssl_install_dir" "$opensslTargetLocation" SetEnvVar "PATH" "\"$opensslTargetLocation/bin:\$PATH\"" SetEnvVar "MANPATH" "\"$opensslTargetLocation/share/man:\$MANPATH\"" @@ -89,8 +100,8 @@ elif [ "$os" == "macos" ]; then SetEnvVar "OPENSSL_INCLUDE" "\"$openssl_install_dir/include\"" SetEnvVar "OPENSSL_LIB" "\"$openssl_install_dir/lib\"" - security find-certificate -a -p /Library/Keychains/System.keychain | sudo tee -a $opensslTargetLocation/ssl/cert.pem > /dev/null - security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain | sudo tee -a $opensslTargetLocation/ssl/cert.pem > /dev/null + security find-certificate -a -p /Library/Keychains/System.keychain | sudo tee -a "$opensslTargetLocation/ssl/cert.pem" > /dev/null + security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain | sudo tee -a "$opensslTargetLocation/ssl/cert.pem" > /dev/null fi diff --git a/coin/provisioning/common/unix/install_grpc.sh b/coin/provisioning/common/unix/install_grpc.sh new file mode 100755 index 00000000..3b94816a --- /dev/null +++ b/coin/provisioning/common/unix/install_grpc.sh @@ -0,0 +1,84 @@ +#!/usr/bin/env bash +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# This script installs gRPC from sources. +set -ex + +# shellcheck source=./DownloadURL.sh +source "${BASH_SOURCE%/*}/DownloadURL.sh" +# shellcheck source=./SetEnvVar.sh +source "${BASH_SOURCE%/*}/SetEnvVar.sh" + +# Extract cmake path from the environment +if uname -a |grep -q "Ubuntu"; then + if lsb_release -a |grep -q "Ubuntu 22.04"; then +# shellcheck source=/dev/null + source ~/.bash_profile + else +# shellcheck source=/dev/null + source ~/.profile + fi +else +# shellcheck source=/dev/null + source ~/.bashrc +fi + +version="1.50.1" +sha1="be1b0c3dbfbc9714824921f50dffb7cf044da5ab" +internalUrl="http://ci-files01-hki.ci.qt.io/input/automotive_suite/grpc-all-$version.zip" +externalUrl="" +installPrefix="$HOME/install-grpc-$version" + +targetDir="$HOME/grpc-$version" +targetFile="$targetDir.zip" +DownloadURL "$internalUrl" "$externalUrl" "$sha1" "$targetFile" +unzip -q "$targetFile" -d "$HOME" +sudo rm "$targetFile" + +# devtoolset is needed when running configuration +if uname -a |grep -qv "Darwin"; then + export PATH="/opt/rh/devtoolset-7/root/usr/bin:$PATH" +fi + +if uname -a |grep -q Darwin; then + extraCMakeArgs=("-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=12) + SetEnvVar PATH "\$PATH:$installPrefix/bin" +fi + +# MacOS +if [[ -n "$OPENSSL_DIR" ]]; then + extraOpenSslArg=-DOPENSSL_ROOT_DIR=$OPENSSL_DIR +# Linux +elif [[ -n "$OPENSSL_HOME" ]]; then + extraOpenSslArg=-DOPENSSL_ROOT_DIR=$OPENSSL_HOME +fi + +echo "Configuring and building gRPC" + +buildDir="$HOME/build-grpc-$version" +mkdir -p "$buildDir" +cd "$buildDir" +cmake "$targetDir" -G"Ninja Multi-Config" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_CONFIGURATION_TYPES="Release;Debug;RelWithDebugInfo" \ + -DCMAKE_INSTALL_PREFIX="$installPrefix" \ + "${extraCMakeArgs[@]}" \ + "$extraOpenSslArg" \ + -DgRPC_BUILD_TESTS=OFF \ + -DgRPC_PROTOBUF_PROVIDER="package" \ + -DgRPC_SSL_PROVIDER="package" \ + -DgRPC_ZLIB_PROVIDER="package" +ninja all + +sudo env "PATH=$PATH" ninja install +# Refresh shared library cache if OS isn't macOS +if uname -a |grep -qv "Darwin"; then + sudo ldconfig +fi + +SetEnvVar "gRPC_ROOT" "$installPrefix" +SetEnvVar "absl_ROOT" "$installPrefix" + +sudo rm -rf "$targetDir" +sudo rm -rf "$buildDir" diff --git a/coin/provisioning/common/unix/install_protobuf.sh b/coin/provisioning/common/unix/install_protobuf.sh new file mode 100755 index 00000000..7ace4eae --- /dev/null +++ b/coin/provisioning/common/unix/install_protobuf.sh @@ -0,0 +1,71 @@ +#!/usr/bin/env bash +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# shellcheck source=./DownloadURL.sh +source "${BASH_SOURCE%/*}/DownloadURL.sh" +# shellcheck source=./SetEnvVar.sh +source "${BASH_SOURCE%/*}/SetEnvVar.sh" + +# Extract cmake path from the environment +if uname -a |grep -q "Ubuntu"; then + if lsb_release -a |grep "Ubuntu 22.04"; then + source ~/.bash_profile + else + source ~/.profile + fi +else + source ~/.bashrc +fi + +# This script will install Google's Protocal Buffers + +version="21.9" +sha1="3226a0e49d048759b702ae524da79387c59f05cc" +internalUrl="http://ci-files01-hki.ci.qt.io/input/automotive_suite/protobuf-all-$version.zip" +externalUrl="https://github.com/protocolbuffers/protobuf/releases/download/v$version/protobuf-all-$version.zip" + +targetDir="$HOME/protobuf-$version" +targetFile="$targetDir.zip" +DownloadURL "$internalUrl" "$externalUrl" "$sha1" "$targetFile" +unzip "$targetFile" -d "$HOME" +sudo rm "$targetFile" + +# devtoolset is needed when running configuration +if uname -a |grep -qv "Darwin"; then + export PATH="/opt/rh/devtoolset-7/root/usr/bin:$PATH" +fi + +echo "Configuring and building protobuf" + +installPrefix="/usr/local" +if uname -a |grep -q Darwin; then + extraCMakeArgs=("-DCMAKE_OSX_ARCHITECTURES=x86_64;arm64" -DCMAKE_OSX_DEPLOYMENT_TARGET=12) + SetEnvVar PATH "\$PATH:$installPrefix/bin" +fi + +buildDir="$HOME/build-protobuf-$version" +mkdir "$buildDir" +cd "$buildDir" +cmake "$targetDir" -G"Ninja Multi-Config" \ + -DCMAKE_POSITION_INDEPENDENT_CODE=ON \ + -DCMAKE_INSTALL_PREFIX=$installPrefix \ + "${extraCMakeArgs[@]}" \ + -Dprotobuf_BUILD_TESTS=OFF \ + -Dprotobuf_BUILD_EXAMPLES=OFF \ + -Dprotobuf_BUILD_PROTOC_BINARIES=ON \ + -DBUILD_SHARED_LIBS=OFF \ + -Dprotobuf_WITH_ZLIB=OFF \ + -DCMAKE_CONFIGURATION_TYPES="Release;Debug;RelWithDebugInfo" \ + -DCMAKE_CROSS_CONFIGS=all \ + -DCMAKE_DEFAULT_CONFIGS=all +ninja all:all +sudo env "PATH=$PATH" ninja install:all + +# Refresh shared library cache if OS isn't macOS +if uname -a |grep -qv "Darwin"; then + sudo ldconfig +fi + +sudo rm -r "$targetDir" +sudo rm -r "$buildDir" diff --git a/coin/provisioning/common/unix/install_protobuff.sh b/coin/provisioning/common/unix/install_protobuff.sh deleted file mode 100755 index a9b2cfd0..00000000 --- a/coin/provisioning/common/unix/install_protobuff.sh +++ /dev/null @@ -1,75 +0,0 @@ -#!/usr/bin/env bash - -############################################################################# -## -## Copyright (C) 2018 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# - -# shellcheck source=./DownloadURL.sh -source "${BASH_SOURCE%/*}/DownloadURL.sh" -# shellcheck source=./SetEnvVar.sh -source "${BASH_SOURCE%/*}/SetEnvVar.sh" - -# This script will install Google's Protocal Buffers which is needed by Automotive Suite - -version="3.6.1" -sha1="44b8ba225f3b4dc45fb56d5881ec6a91329802b6" -internalUrl="http://ci-files01-hki.intra.qt.io/input/automotive_suite/protobuf-all-$version.zip" -externalUrl="https://github.com/protocolbuffers/protobuf/releases/download/v$version/protobuf-all-$version.zip" - -targetDir="$HOME/protobuf-$version" -targetFile="$targetDir.zip" -DownloadURL "$internalUrl" "$externalUrl" "$sha1" "$targetFile" -unzip "$targetFile" -d "$HOME" -sudo rm "$targetFile" - -# devtoolset is needed when running configuration -if uname -a |grep -qv "Darwin"; then - export PATH="/opt/rh/devtoolset-4/root/usr/bin:$PATH" -fi - -echo "Configuring and building protobuf" -cd "$targetDir" -if uname -a |grep -q Darwin; then - ./configure --prefix "$(xcrun --sdk macosx --show-sdk-path)/usr/local" - SetEnvVar PATH "\$PATH:$(xcrun --sdk macosx --show-sdk-path)/usr/local/bin" -else - ./configure -fi -make -j5 -sudo make install - -# Refresh shared library cache if OS isn't macOS -if uname -a |grep -qv "Darwin"; then - sudo ldconfig -fi - -sudo rm -r "$targetDir" diff --git a/coin/provisioning/common/unix/libclang-v100-dyn.sh b/coin/provisioning/common/unix/libclang-v100-dyn.sh new file mode 100755 index 00000000..14194f55 --- /dev/null +++ b/coin/provisioning/common/unix/libclang-v100-dyn.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Copyright (C) 2017 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# PySide versions following 5.6 use a C++ parser based on Clang (http://clang.org/). +# The Clang library (C-bindings), version 3.9 or higher is required for building. + +# This same script is used to provision libclang to Linux and macOS. +# In case of Linux, we expect to get the values as args +set -e + +# shellcheck source=./check_and_set_proxy.sh +source "${BASH_SOURCE%/*}/check_and_set_proxy.sh" +# shellcheck source=./SetEnvVar.sh +source "${BASH_SOURCE%/*}/SetEnvVar.sh" +# shellcheck source=./DownloadURL.sh +source "${BASH_SOURCE%/*}/DownloadURL.sh" + +libclang_version=10.0 + +if uname -a |grep -q Darwin; then + version=$libclang_version + url="https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_${version//\./}-based-mac.7z" + sha1="0fe1fa50b1b469d2c05acc3a3468bc93a66f1e5a" + url_cached="http://ci-files01-hki.ci.qt.io/input/libclang/dynamic/libclang-release_${version//\./}-based-mac.7z" +elif test -f /etc/redhat-release || /etc/centos-release; then + version=$libclang_version + url="https://download.qt.io/development_releases/prebuilt/libclang/libclang-release_${version//\./}-based-linux-Rhel7.6-gcc5.3-x86_64.7z" + sha1="1d2e265502fc0832a854f989d757105833fbd179" + url_cached="http://ci-files01-hki.ci.qt.io/input/libclang/dynamic/libclang-release_${version//\./}-based-linux-Rhel7.6-gcc5.3-x86_64.7z" +else + version=$libclang_version + url="https://download.qt.io/development_releases/prebuilt/libclang/dynamic/libclang-release_${version//\./}-based-linux-Ubuntu18.04-gcc9.2-x86_64.7z" + sha1="c1580acb3a82e193acf86f18afb52427c5e67de8" + url_cached="http://ci-files01-hki.ci.qt.io/input/libclang/libclang-release_${version//\./}-based-linux-Ubuntu18.04-gcc9.2-x86_64.7z" +fi + +zip="/tmp/libclang.7z" +destination="/usr/local/libclang-dynlibs-$version" + +DownloadURL "$url_cached" "$url" "$sha1" "$zip" +if command -v 7zr &> /dev/null; then + sudo 7zr x $zip -o/usr/local/ +else + sudo 7z x $zip -o/usr/local/ +fi +sudo mv /usr/local/libclang "$destination" +rm -rf $zip + + +SetEnvVar "LLVM_DYNAMIC_LIBS_100" "$destination" +echo "libClang for QtForPython= $version" >> ~/versions.txt diff --git a/coin/provisioning/common/unix/libclang.sh b/coin/provisioning/common/unix/libclang.sh index a9d1cc49..5f75d7e4 100755 --- a/coin/provisioning/common/unix/libclang.sh +++ b/coin/provisioning/common/unix/libclang.sh @@ -1,37 +1,6 @@ #!/usr/bin/env bash - -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2022 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # PySide versions following 5.6 use a C++ parser based on Clang (http://clang.org/). # The Clang library (C-bindings), version 3.9 or higher is required for building. @@ -47,32 +16,51 @@ source "${BASH_SOURCE%/*}/SetEnvVar.sh" # shellcheck source=./DownloadURL.sh source "${BASH_SOURCE%/*}/DownloadURL.sh" -libclang_version=6.0 +PROVISIONING_DIR="$(dirname "$0")/../../" +# shellcheck source=./common.sourced.sh +source "$PROVISIONING_DIR"/common/unix/common.sourced.sh + +libclang_version="15.0.0" if uname -a |grep -q Darwin; then version=$libclang_version - url="https://download.qt.io/development_releases/prebuilt/libclang/qt/libclang-release_${version//\./}-mac.7z" - url_cached="http://ci-files01-hki.intra.qt.io/input/libclang/qt/libclang-release_${version//\./}-mac.7z" - sha1="0af8ab8c1174faf4b721d079587190fc32ea8364" + url="https://download.qt.io/development_releases/prebuilt/libclang/qt/libclang-release_${version}-based-mac.7z" + url_cached="http://ci-files01-hki.ci.qt.io/input/libclang/qt/libclang-release_${version}-based-mac.7z" + sha1="6d916a17459c81551dde47580ae3f071e93338a5" +elif test -f /etc/redhat-release && grep "Red Hat" /etc/redhat-release | grep -v "8" ; then + version=$libclang_version + url="https://download.qt.io/development_releases/prebuilt/libclang/qt/libclang-release_${version}-based-linux-Rhel8.4-gcc10.0-x86_64.7z" + url_cached="http://ci-files01-hki.ci.qt.io/input/libclang/qt/libclang-release_${version}-based-linux-Rhel8.4-gcc10.0-x86_64.7z" + sha1="6ca035bb522022d34d61759e0460845832933b5c" +elif [ "$PROVISIONING_OS_ID" = ubuntu ]; then + version=$libclang_version + url="https://download.qt.io/development_releases/prebuilt/libclang/qt/libclang-release_${version}-based-linux-Ubuntu22.04-gcc11.2-x86_64.7z" + url_cached="http://ci-files01-hki.ci.qt.io/input/libclang/qt/libclang-release_${version}-based-linux-Ubuntu22.04-gcc11.2-x86_64.7z" + sha1="dd170ec762a7ec8ac84b4b5cac3a422514e5b030" +elif [ "$PROVISIONING_OS_ID" = debian ]; then + version=17.0.1 + url="https://download.qt.io/development_releases/prebuilt/libclang/qt/libclang-release_${version}-based-linux-Debian11.6-gcc10.0-arm64.7z" + url_cached="http://ci-files01-hki.ci.qt.io/input/libclang/qt/libclang-release_${version}-based-linux-Debian11.6-gcc10.0-arm64.7z" + sha1="43f0210121b889107e3dab631e8104e661a3866b" else version=$libclang_version - url="https://download.qt.io/development_releases/prebuilt/libclang/qt/libclang-release_${version//\./}-linux-Rhel7.2-gcc5.3-x86_64.7z" - url_cached="http://ci-files01-hki.intra.qt.io/input/libclang/qt/libclang-release_${version//\./}-linux-Rhel7.2-gcc5.3-x86_64.7z" - sha1="ef59b699f4fcce2e45108b3ff04cc7471c1c4abe" + url="https://download.qt.io/development_releases/prebuilt/libclang/qt/libclang-release_${version}-based-linux-Ubuntu20.04-gcc9.3-x86_64.7z" + url_cached="http://ci-files01-hki.ci.qt.io/input/libclang/qt/libclang-release_${version}-based-linux-Ubuntu20.04-gcc9.3-x86_64.7z" + sha1="bd6615012b8bdb2720a45ede56e05f6db7191843" fi zip="/tmp/libclang.7z" destination="/usr/local/libclang-$version" DownloadURL $url_cached $url $sha1 $zip -7z x $zip -o/tmp/ +if command -v 7zr &> /dev/null; then + sudo 7zr x $zip -o/usr/local/ +else + sudo 7z x $zip -o/usr/local/ +fi +sudo mv /usr/local/libclang "$destination" rm -rf $zip -sudo mv /tmp/libclang "$destination" -echo "export LLVM_INSTALL_DIR=$destination" >> ~/.bash_profile +SetEnvVar "LLVM_INSTALL_DIR" "$destination" echo "libClang = $version" >> ~/versions.txt - -# This is a hacked static build of libclang which requires special -# handling on the qdoc side. -SetEnvVar "QDOC_USE_STATIC_LIBCLANG" "1" diff --git a/coin/provisioning/common/unix/mqtt_broker.sh b/coin/provisioning/common/unix/mqtt_broker.sh index 37732b31..d3cce755 100644..100755 --- a/coin/provisioning/common/unix/mqtt_broker.sh +++ b/coin/provisioning/common/unix/mqtt_broker.sh @@ -1,37 +1,6 @@ #!/bin/bash - -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# Copyright (C) 2017 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # This script installs paho testing broker @@ -39,10 +8,10 @@ source "${BASH_SOURCE%/*}/InstallFromCompressedFileFromURL.sh" source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" -CommitSHA="20bad2475c27a6e1d24a56d90a9fceb40963261e" -PrimaryUrl="http://ci-files01-hki.intra.qt.io/input/mqtt_broker/paho.mqtt.testing-$CommitSHA.zip" +CommitSHA="2873885d7e840b4e06483f36f170c609eb30527d" +PrimaryUrl="http://ci-files01-hki.ci.qt.io/input/mqtt_broker/paho.mqtt.testing-$CommitSHA.zip" AltUrl="https://github.com/eclipse/paho.mqtt.testing/archive/$CommitSHA.zip" -SHA1="a0ac88715c2aebb9573a113dc13925a90da19233" +SHA1="1fcc4e61b12f11a1421cc8c3f379276d732e62b7" targetFolder="/opt/paho_broker" appPrefix="paho.mqtt.testing-$CommitSHA" diff --git a/coin/provisioning/common/unix/openssl_3_for_android.sh b/coin/provisioning/common/unix/openssl_3_for_android.sh new file mode 100755 index 00000000..0ad79315 --- /dev/null +++ b/coin/provisioning/common/unix/openssl_3_for_android.sh @@ -0,0 +1,76 @@ +#!/usr/bin/env bash +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# This script install prebuilt OpenSSL which was built against Android NDK 25. +# OpenSSL build will fail with Android NDK 22, because it's missing platforms and sysroot directories + +set -ex +# shellcheck source=../unix/DownloadURL.sh +source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh" +# shellcheck source=../unix/SetEnvVar.sh +source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" + +version="3.0.7" +ndkVersionLatest="r26b" +ndkVersionDefault=$ndkVersionLatest +prebuiltOpensslNdkShaLatest="ea925d5a5b696916fb3650403a2eb3189c52b5ce" +prebuiltOpensslNdkShaDefault=$prebuiltOpensslNdkShaLatest + +: <<'EOB' SOURCE BUILD INSTRUCTIONS - Openssl prebuilt was made using Android NDK 25 +# Source built requires GCC and Perl to be in PATH. Rhel "requires yum install perl-IPC-Cmd" +exports_file="/tmp/export.sh" +# source previously made environmental variables. +if uname -a |grep -q "Ubuntu"; then + # shellcheck disable=SC1090 + grep -e "^export" "$HOME/.profile" > $exports_file && source $exports_file + rm -rf "$exports_file" +else + # shellcheck disable=SC1090 + grep -e "^export" "$HOME/.bashrc" > $exports_file && source $exports_file + rm -rf "$exports_file" +fi + +# ANDROID_NDK_ROOT is required during Configure +export ANDROID_NDK_ROOT=/opt/android/android-ndk-r26b + +officialUrl="https://www.openssl.org/source/openssl-$version.tar.gz" +cachedUrl="http://ci-files01-hki.ci.qt.io/input/openssl/openssl-$version.tar.gz" +targetFile="/tmp/openssl-$version.tar.gz" +sha="f20736d6aae36bcbfa9aba0d358c71601833bf27" +opensslHome="${HOME}/openssl/android/openssl-${version}" +DownloadURL "$cachedUrl" "$officialUrl" "$sha" "$targetFile" +mkdir -p "${HOME}/openssl/android/" +tar -xzf "$targetFile" -C "${HOME}/openssl/android/" +if uname -a |grep -q "Darwin"; then + TOOLCHAIN=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/darwin-x86_64/bin +else + TOOLCHAIN=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin +fi +cd "$opensslHome" +PATH=$TOOLCHAIN:$PATH CC=clang ./Configure android-arm +PATH=$TOOLCHAIN:$PATH CC=clang make build_generated +EOB + +function InstallPrebuiltOpenssl() { + + ndkVersion=$1 + sha=$2 + + opensslHome="${HOME}/prebuilt-openssl-${version}-for-android-ndk-${ndkVersion}" + if [[ ! -d ${opensslHome} ]]; then + prebuiltUrl="http://ci-files01-hki.ci.qt.io/input/openssl/prebuilt-openssl-${version}-for-android-ndk-${ndkVersion}.zip" + targetFile="/tmp/prebuilt-openssl-${version}-for-android-ndk-${ndkVersion}.zip" + + DownloadURL "$prebuiltUrl" "$prebuiltUrl" "$sha" "$targetFile" + unzip -o "$targetFile" -d "${HOME}" + sudo rm -f "$targetFile" + fi +} + +InstallPrebuiltOpenssl $ndkVersionDefault $prebuiltOpensslNdkShaDefault +SetEnvVar "OPENSSL_ANDROID_HOME_DEFAULT" "$opensslHome" +InstallPrebuiltOpenssl $ndkVersionLatest $prebuiltOpensslNdkShaLatest +SetEnvVar "OPENSSL_ANDROID_HOME_LATEST" "$opensslHome" + +echo "OpenSSL for Android = $version" >> ~/versions.txt diff --git a/coin/provisioning/common/unix/openssl_for_android.sh b/coin/provisioning/common/unix/openssl_for_android.sh new file mode 100755 index 00000000..d555e0cc --- /dev/null +++ b/coin/provisioning/common/unix/openssl_for_android.sh @@ -0,0 +1,73 @@ +#!/usr/bin/env bash +# Copyright (C) 2023 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# This script install prebuilt OpenSSL which was built against Android NDK 25. +# OpenSSL build will fail with Android NDK 22, because it's missing platforms and sysroot directories + +set -ex +# shellcheck source=../unix/DownloadURL.sh +source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh" +# shellcheck source=../unix/SetEnvVar.sh +source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" + +version="3.0.7" +ndkVersionLatest="r26b" +ndkVersionDefault=$ndkVersionLatest +prebuiltOpensslNdkShaLatest="ea925d5a5b696916fb3650403a2eb3189c52b5ce" +prebuiltOpensslNdkShaDefault=$prebuiltOpensslNdkShaLatest + +: <<'EOB' SOURCE BUILD INSTRUCTIONS - Openssl prebuilt was made using Android NDK r26b +# Source built requires GCC and Perl to be in PATH. Rhel "requires yum install perl-IPC-Cmd" +exports_file="/tmp/export.sh" +# source previously made environmental variables. +if uname -a |grep -q "Ubuntu"; then + # shellcheck disable=SC1090 + grep -e "^export" "$HOME/.profile" > $exports_file && source $exports_file + rm -rf "$exports_file" +else + # shellcheck disable=SC1090 + grep -e "^export" "$HOME/.bashrc" > $exports_file && source $exports_file + rm -rf "$exports_file" +fi + +officialUrl="https://www.openssl.org/source/openssl-$version.tar.gz" +cachedUrl="http://ci-files01-hki.ci.qt.io/input/openssl/openssl-$version.tar.gz" +targetFile="/tmp/openssl-$version.tar.gz" +sha="f20736d6aae36bcbfa9aba0d358c71601833bf27" +opensslHome="${HOME}/openssl/android/openssl-${version}" +DownloadURL "$cachedUrl" "$officialUrl" "$sha" "$targetFile" +mkdir -p "${HOME}/openssl/android/" +tar -xzf "$targetFile" -C "${HOME}/openssl/android/" +if uname -a |grep -q "Darwin"; then + TOOLCHAIN=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/darwin-x86_64/bin +else + TOOLCHAIN=${ANDROID_NDK_ROOT}/toolchains/llvm/prebuilt/linux-x86_64/bin +fi +cd "$opensslHome" +PATH=$TOOLCHAIN:$PATH CC=clang ./Configure android-arm +PATH=$TOOLCHAIN:$PATH CC=clang make build_generated +EOB + +function InstallPrebuiltOpenssl() { + + ndkVersion=$1 + sha=$2 + + opensslHome="${HOME}/prebuilt-openssl-${version}-for-android-ndk-${ndkVersion}" + if [[ ! -d ${opensslHome} ]]; then + prebuiltUrl="http://ci-files01-hki.ci.qt.io/input/openssl/prebuilt-openssl-${version}-for-android-ndk-${ndkVersion}.zip" + targetFile="/tmp/prebuilt-openssl-${version}-for-android-ndk-${ndkVersion}.zip" + + DownloadURL "$prebuiltUrl" "$prebuiltUrl" "$sha" "$targetFile" + unzip -o "$targetFile" -d "${HOME}" + sudo rm -f "$targetFile" + fi +} + +InstallPrebuiltOpenssl $ndkVersionDefault $prebuiltOpensslNdkShaDefault +SetEnvVar "OPENSSL_ANDROID_HOME_DEFAULT" "$opensslHome" +InstallPrebuiltOpenssl $ndkVersionLatest $prebuiltOpensslNdkShaLatest +SetEnvVar "OPENSSL_ANDROID_HOME_LATEST" "$opensslHome" + +echo "OpenSSL for Android = $version" >> ~/versions.txt diff --git a/coin/provisioning/common/unix/pyenv.rb b/coin/provisioning/common/unix/pyenv.rb new file mode 100644 index 00000000..0c2781ff --- /dev/null +++ b/coin/provisioning/common/unix/pyenv.rb @@ -0,0 +1,80 @@ +class Pyenv < Formula + desc "Python version management" + homepage "https://github.com/pyenv/pyenv" + url "https://github.com/pyenv/pyenv/archive/refs/tags/v2.3.15.tar.gz" + sha256 "cf6499e1c8f18fb3473c2afdf5f14826fd42a1c4b051219faea104e38036e4bb" + license "MIT" + version_scheme 1 + head "https://github.com/pyenv/pyenv.git", branch: "master" + + livecheck do + url :stable + regex(/^v?(\d+(?:\.\d+)+(-\d+)?)$/i) + end + + bottle do + sha256 cellar: :any, arm64_ventura: "ff68efd633ee282abb0c0a6ba72f90d5248644f3143f40e15841b6ae7996e3cd" + sha256 cellar: :any, arm64_monterey: "af7621550cc7c005549d96218d2606a521e12595f2efc9ae9d8523cc46d318ba" + sha256 cellar: :any, arm64_big_sur: "69d69ceeea16fe45346d8856bf213c0a0e48220097635cf17d40b98fa8e12f83" + sha256 cellar: :any, ventura: "48fb21656dc11dc0a6ef25eb7cb5e8829485c1e1fac7d1ca596a46771a9ad91d" + sha256 cellar: :any, monterey: "96ba1d1702b7620dd9d0d2fe030af4d31c83504afea1b119910ab2e9c9fbb08c" + sha256 cellar: :any, big_sur: "f96dfcecefb40d4794a8ea3ef5981bdeab6e64c412f18f0c128b1d64fe87d913" + sha256 cellar: :any_skip_relocation, x86_64_linux: "83737a776f4828a7fb5eb289b10418b7cf829cccca3fc634d7dfe7c96aff4e7e" + end + + depends_on "autoconf" + depends_on "openssl@3" + depends_on "pkg-config" + depends_on "readline" + + uses_from_macos "python" => :test + uses_from_macos "bzip2" + uses_from_macos "libffi" + uses_from_macos "ncurses" + uses_from_macos "xz" + uses_from_macos "zlib" + + def install + inreplace "libexec/pyenv", "/usr/local", HOMEBREW_PREFIX + inreplace "libexec/pyenv-rehash", "$(command -v pyenv)", opt_bin/"pyenv" + inreplace "pyenv.d/rehash/source.bash", "$(command -v pyenv)", opt_bin/"pyenv" + + system "src/configure" + system "make", "-C", "src" + + prefix.install Dir["*"] + %w[pyenv-install pyenv-uninstall python-build].each do |cmd| + bin.install_symlink "#{prefix}/plugins/python-build/bin/#{cmd}" + end + + share.install prefix/"man" + + # Do not manually install shell completions. See: + # - pyenv/pyenv#1056#issuecomment-356818337 + # - Homebrew/homebrew-core#22727 + end + + test do + # Create a fake python version and executable. + pyenv_root = Pathname(shell_output("#{bin}/pyenv root").strip) + python_bin = pyenv_root/"versions/1.2.3/bin" + foo_script = python_bin/"foo" + foo_script.write "echo hello" + chmod "+x", foo_script + + # Test versions. + versions = shell_output("eval \"$(#{bin}/pyenv init --path)\" " \ + "&& eval \"$(#{bin}/pyenv init -)\" " \ + "&& #{bin}/pyenv versions").split("\n") + assert_equal 2, versions.length + assert_match(/\* system/, versions[0]) + assert_equal(" 1.2.3", versions[1]) + + # Test rehash. + system bin/"pyenv", "rehash" + refute_match "Cellar", (pyenv_root/"shims/foo").read + assert_equal "hello", shell_output("eval \"$(#{bin}/pyenv init --path)\" " \ + "&& eval \"$(#{bin}/pyenv init -)\" " \ + "&& PYENV_VERSION='1.2.3' foo").chomp + end +end diff --git a/coin/provisioning/common/unix/python_modules.sh b/coin/provisioning/common/unix/python_modules.sh new file mode 100755 index 00000000..00009836 --- /dev/null +++ b/coin/provisioning/common/unix/python_modules.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash +# Copyright (C) 2019 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +# needed by packaging scripts +pip3 install bs4 +pip3 install sh +pip3 install html5lib diff --git a/coin/provisioning/common/unix/sccache.sh b/coin/provisioning/common/unix/sccache.sh new file mode 100755 index 00000000..8a403ba7 --- /dev/null +++ b/coin/provisioning/common/unix/sccache.sh @@ -0,0 +1,35 @@ +#!/usr/bin/env bash +# Copyright (C) 2018 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only + +set -ex + +source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh" +source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh" +## comment fo changin patchset..coin privision issue + +function installSccache { + targetArch=$1 + targetVersion=$2 + sha1=$3 + targetFile=sccache-$targetVersion-$targetArch.tar.gz + primaryUrl=http://ci-files01-hki.ci.qt.io/input/sccache/$targetFile + cacheUrl=https://github.com/mozilla/sccache/releases/download/$targetVersion/$targetFile + DownloadURL "$primaryUrl" "$cacheUrl" "$sha1" "$targetFile" + + sudo mkdir -p /usr/local/sccache + sudo tar -C /usr/local/sccache -x -z --totals --strip-components=1 --file="$targetFile" + + # add sccache __before__ the real compiler + SetEnvVar "PATH" "/usr/local/sccache:\$PATH" + + # disable sccache server from shutting down after being idle + SetEnvVar "SCCACHE_IDLE_TIMEOUT" "0" + + # copy sccache wrapper and place as a first in PATH + mkdir -p "$HOME/sccache_wrapper" + cp "${BASH_SOURCE%/*}/sccache_wrapper" "$HOME/sccache_wrapper/sccache" + chmod 755 "$HOME/sccache_wrapper/sccache" + SetEnvVar "PATH" "$HOME/sccache_wrapper:\$PATH" + +} diff --git a/coin/provisioning/common/unix/sccache_wrapper b/coin/provisioning/common/unix/sccache_wrapper new file mode 100755 index 00000000..52e39513 --- /dev/null +++ b/coin/provisioning/common/unix/sccache_wrapper @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +# Call real sccache with original arguments +# sccache /opt/android/android-ndk-r23b/toolchains/llvm/prebuilt/linux-x86_64/bin/clang --target=aarch64-none ...... +real_sccache=/usr/local/sccache/sccache +$real_sccache "$@" +retval=$? + +if test $retval -ne 0 +then + echo "Sccache command failed, re-try calling build tool directly" + "$@" + retval=$? +fi +exit $retval diff --git a/coin/provisioning/common/unix/squishInstall.sh b/coin/provisioning/common/unix/squishInstall.sh index f1b5e6b5..0195d84a 100755 --- a/coin/provisioning/common/unix/squishInstall.sh +++ b/coin/provisioning/common/unix/squishInstall.sh @@ -1,173 +1,106 @@ #!/usr/bin/env bash +# Copyright (C) 2020 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only -############################################################################# -## -## Copyright (C) 2017 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +# shellcheck source=./DownloadURL.sh +source "${BASH_SOURCE%/*}/DownloadURL.sh" set -ex -# This script will install squish package for Linux and Mac. +# This script will fetch and extract pre-buildt squish package for Linux and Mac. # Squish is need by Release Test Automation (RTA) -version="6.4.3" -# Branch version without dot -qtBranch="512x" -squishFolder="/opt/squish" -squishUrl="ci-files01-hki.intra.qt.io:/hdd/www/input/squish/coin/$qtBranch/" -squishFile="squish-$version-qt$qtBranch-linux64.run" +version="7.2.1" +qtBranch="66x" +installFolder="/opt" +squishFolder="$installFolder/squish" +preBuildCacheUrl="ci-files01-hki.ci.qt.io:/hdd/www/input/squish/jenkins_build/stable" +licenseFile=".squish-license" +licenseBranch="squish_license" +licenseUrl="http://ci-files01-hki.ci.qt.io/input/squish/coin/$licenseBranch/$licenseFile" +licenseSHA="e84b499a2011f9bb1a6eefc7b2338d7ae770927a" +testSuiteUrl="ci-files01-hki.ci.qt.io:/hdd/www/input/squish/coin/suite_test_squish" +testSuiteLocal="/tmp/squish_test_suite" if uname -a |grep -q Darwin; then - squishFile="squish-$version-qt$qtBranch-macx86_64.dmg" + compressedFolder="prebuild-squish-$version-$qtBranch-mac.tar.gz" + sha1="7467c974b65255c86b8fccaeca90e0590d4f7c96" +else + compressedFolder="prebuild-squish-$version-$qtBranch-linux64.tar.gz" + sha1="950a6035c777c8ce0a50a0b3ad468044d07f898b" fi -squishLicenseUrl="ci-files01-hki.intra.qt.io:/hdd/www/input/squish/coin/" -squishLicenseFile=".squish-3-license.tar.gz" - -testSuite="suite_test_squish" -testSuiteUrl="ci-files01-hki.intra.qt.io:/hdd/www/input/squish/coin/" +mountFolder="/tmp/squish" +sudo mkdir "$mountFolder" +sudo mkdir "$testSuiteLocal" -# These checks can be removed when Vanilla OS for all linux and Mac are in -if [ -d "$squishFolder" ]; then - echo "Move old squish to /tmp" - sudo mv "$squishFolder" "/tmp/squish_$(date)" +# Check which platform +if uname -a |grep -q Darwin; then + usersGroup="staff" +elif uname -a |grep -q "el7"; then + usersGroup="qt" +elif uname -a |grep -q "Ubuntu"; then + usersGroup="users" +else + usersGroup="users" fi -if [ -f "/etc/profile.d/squish_env.sh" ]; then - echo "Remove /etc/profile.d/squish_env.sh" - sudo rm -f "/etc/profile.d/squish_env.sh" - export SQUISH_LICENSEKEY_DIR=$HOME +targetFileMount="$mountFolder"/"$compressedFolder" + +echo "Mounting Squish packages from $preBuildCacheUrl to $mountFolder" +echo "Mounting Squish test suite from $testSuiteUrl to $testSuiteLocal" +if uname -a |grep -q Darwin; then + sudo mount -o locallocks "$preBuildCacheUrl" "$mountFolder" + sudo mount -o locallocks "$testSuiteUrl" "$testSuiteLocal" +else + sudo mount "$preBuildCacheUrl" "$mountFolder" + sudo mount "$testSuiteUrl" "$testSuiteLocal" +fi +echo "Create $installFolder if needed" +if [ ! -d "$installFolder" ]; then + sudo mkdir "$installFolder" fi -function MountAndInstall { - url=$1 - targetDirectory=$2 - targetFile=$3 - - # Check which platform - if uname -a |grep -q Darwin; then - usersGroup="staff" - mountFolder="/Volumes" - squishLicenseDir="/Users/qt" - elif uname -a |grep -q "el7"; then - usersGroup="qt" - mountFolder="/tmp" - squishLicenseDir="/root" - elif uname -a |grep -q "Ubuntu"; then - usersGroup="users" - mountFolder="/tmp" - squishLicenseDir="/home/qt" - else - usersGroup="users" - mountFolder="/tmp" - squishLicenseDir="/root" - fi +VerifyHash "$targetFileMount" "$sha1" - function UnMount { - echo "Unmounting $mountFolder" - sudo diskutil unmount force "$mountFolder" || sudo umount -f "$mountFolder" - } +echo "Uncompress $compressedFolder" +sudo tar -xzf "$targetFileMount" --directory "$installFolder" - targetFileMount="$mountFolder"/"$targetFile" +if uname -a |grep -q Darwin; then + sudo xattr -r -c "$squishFolder" +fi - echo "Mounting $url to $mountFolder" - sudo mount "$url" "$mountFolder" - echo "Create $targetDirectory if needed" - if [ ! -d "/opt" ]; then - sudo mkdir "/opt" - fi - if [ ! -d "$targetDirectory" ]; then - sudo mkdir "$targetDirectory" - fi - echo "Uncompress $targetFile" - if [[ $targetFile == *.tar.gz ]]; then - if [[ $targetFile == .squish-3-license.* ]]; then - target="$squishLicenseDir" - # Squish license need to be exists also in users home directory, because squish check it before it starts running tests - sudo tar -xzf "$targetFileMount" --directory "$HOME" - else - target="$targetDirectory" - fi - sudo tar -xzf "$targetFileMount" --directory "$target" - UnMount - elif [[ $targetFile == *.dmg ]]; then - echo "'dmg-file', no need to uncompress" - sudo cp $targetFileMount /tmp - UnMount - sudo hdiutil attach "/tmp/$targetFile" - sudo /Volumes/froglogic\ Squish/Install\ Squish.app/Contents/MacOS/Squish unattended=1 targetdir="$targetDirectory/package" qtpath="$targetDirectory" > /dev/null - mountFolder="/Volumes/froglogic Squish" - UnMount - elif [[ $targetFile == *.run ]]; then - echo "'run-file', no need to uncompress" - sudo cp $targetFileMount $targetDirectory - UnMount - sudo chmod +x $targetDirectory/$targetFile - sudo $targetDirectory/$targetFile unattended=1 targetdir="$targetDirectory/package" qtpath="$targetDirectory" > /dev/null - sudo rm -fr "$targetDirectory/$targetFile" - if uname -a |grep -q "Ubuntu"; then - sudo mkdir /usr/lib/tcl8.6 - sudo cp "$targetDirectory/package/tcl/lib/tcl8.6/init.tcl" /usr/lib/tcl8.6/ - fi - else - exit 1 +if uname -a |grep -q "Ubuntu"; then + if [ ! -e "/usr/lib/tcl8.6" ]; then + sudo mkdir /usr/lib/tcl8.6 + #this needs to be copied only to squish_for_qt65 + sudo cp "$squishFolder/squish_for_qt66/tcl/lib/tcl8.6/init.tcl" /usr/lib/tcl8.6/ fi +fi - echo "Changing ownerships" - sudo chown -R qt:$usersGroup "$targetDirectory" - sudo chown qt:$usersGroup "$HOME/.squish-3-license" -} +echo "Download Squish license" +DownloadURL "$licenseUrl" "$licenseUrl" "$licenseSHA" "$HOME/$licenseFile" -echo "Set commands for environment variables in .bashrc" +echo "Changing ownerships" +sudo chown -R qt:$usersGroup "$squishFolder" +sudo chown qt:$usersGroup "$HOME/$licenseFile" -if uname -a |grep -q "Ubuntu"; then - echo "export SQUISH_PATH=$squishFolder/package" >> ~/.profile - echo "export PATH=\$PATH:$squishFolder/squish-$version/bin" >> ~/.profile -else - echo "export SQUISH_PATH=$squishFolder/package" >> ~/.bashrc - echo "export PATH=\$PATH:$squishFolder/squish-$version/bin" >> ~/.bashrc -fi -echo "Installing squish license to home directory.." -MountAndInstall "$squishLicenseUrl" "$squishFolder" "$squishLicenseFile" +echo "Verifying Squish, available installations:" +ls -la $squishFolder +cd $squishFolder -echo "Installing squish $version.." -MountAndInstall "$squishUrl" "$squishFolder" "$squishFile" +for squishInstallation in */ ; do + if "$squishInstallation/bin/squishrunner" --testsuite "$testSuiteLocal" | grep "Squish test run successfully" ; then + echo "Squish in $squishInstallation tested successfully" + else + echo "Testing Squish in $squishInstallation failed! Squish wasn't installed correctly." + exit 1 + fi +done -echo "Installing provisioning scripts for squish" -MountAndInstall "$testSuiteUrl" "$squishFolder" "$testSuite.tar.gz" +echo "Clean up installation temp dirs" +echo "- Unmounting $mountFolder" +sudo diskutil unmount force "$mountFolder" || sudo umount -f "$mountFolder" || true -echo "Verifying Squish Installation" -if "$squishFolder/package/bin/squishrunner" --testsuite "$squishFolder/$testSuite" | grep "Squish test run successfully" ; then - echo "Squish installation tested successfully" -else - echo "Squish test failed! Package wasn't installed correctly." - exit 1 -fi +echo "- Unmounting $testSuiteLocal" +sudo diskutil unmount force "$testSuiteLocal" || sudo umount -f "$testSuiteLocal" || true diff --git a/coin/provisioning/common/unix/telegraf_install.sh b/coin/provisioning/common/unix/telegraf_install.sh index 1412650e..7e1f8a47 100755 --- a/coin/provisioning/common/unix/telegraf_install.sh +++ b/coin/provisioning/common/unix/telegraf_install.sh @@ -1,37 +1,6 @@ -#!/bin/sh - -############################################################################# -## -## Copyright (C) 2019 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +#!/bin/bash +# Copyright (C) 2019 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only # This script installs telegraf and ioping and our script telegraf-ioping.sh @@ -46,46 +15,56 @@ ######################## BOILERPLATE ########################### set -e - PROVISIONING_DIR="$(dirname "$0")/../../" -. "$PROVISIONING_DIR"/common/unix/common.sourced.sh - -. "$PROVISIONING_DIR"/common/unix/DownloadURL.sh +# shellcheck source=./common.sourced.sh +source "$PROVISIONING_DIR"/common/unix/common.sourced.sh +# shellcheck source=./DownloadURL.sh +source "$PROVISIONING_DIR"/common/unix/DownloadURL.sh -is_script_executed telegraf_install.sh \ +is_script_executed telegraf_install.sh \ || fatal "Script telegraf_install.sh should be executed, not sourced" ################################################################ -[ "$PROVISIONING_OS" = linux ] \ - && ioping_sha256=259abf04bcb84f4126ff97c04b6651e1cf5ea6d8a9ff364c769a26c95b6eeb44 \ - || ioping_sha256=55de6a2f1a5343e0ce8df31d82d47a9e79c7e612edbc6dfb39b5fc6fb358b2e3 -DownloadURL "http://ci-files01-hki.intra.qt.io/input/ioping/ioping.${PROVISIONING_OS}-${PROVISIONING_ARCH}" \ - '' "$ioping_sha256" ioping +if [ "$PROVISIONING_OS" = linux ] +then ioping_sha256=259abf04bcb84f4126ff97c04b6651e1cf5ea6d8a9ff364c769a26c95b6eeb44 +else ioping_sha256=55de6a2f1a5343e0ce8df31d82d47a9e79c7e612edbc6dfb39b5fc6fb358b2e3 +fi + +DownloadURL "http://ci-files01-hki.ci.qt.io/input/ioping/ioping.${PROVISIONING_OS}-${PROVISIONING_ARCH}" \ + '' "$ioping_sha256" ioping $CMD_INSTALL -m 755 ./ioping /usr/bin/ rm -f ioping # 2. Install custom ioping monitoring script -$CMD_INSTALL -m 755 "$PROVISIONING_DIR"/common/shared/telegraf/telegraf-ioping.sh /usr/bin/ +$CMD_INSTALL -m 755 "$PROVISIONING_DIR"/common/shared/telegraf/telegraf-ioping.sh /usr/bin/ # 3. Download and install telegraf -[ x"$PROVISIONING_OS" = xmacos ] && os=darwin || os=linux -[ x"$PROVISIONING_ARCH" = xx86 ] && arch=i386 || arch=amd64 -package_filename=telegraf-1.12.1_${os}_${arch}.tar.gz +if [ "$PROVISIONING_OS" = macos ] +then os=darwin +else os=linux +fi + +if [ "$PROVISIONING_ARCH" = x86 ] +then arch=i386 +else arch=amd64 +fi + +package_filename=telegraf-1.12.6_${os}_${arch}.tar.gz package_sha256_list="$PROVISIONING_DIR"/common/shared/telegraf/telegraf_packages.sha256.txt package_sha256=$(sed -n "s/.*$package_filename *//p" "$package_sha256_list") -DownloadURL \ - http://ci-files01-hki.intra.qt.io/input/telegraf/"$package_filename" \ - https://dl.influxdata.com/telegraf/releases/"$package_filename" \ - "$package_sha256" \ +DownloadURL \ + http://ci-files01-hki.ci.qt.io/input/telegraf/"$package_filename" \ + https://dl.influxdata.com/telegraf/releases/"$package_filename" \ + "$package_sha256" \ telegraf.tar.gz tar -xzf ./telegraf.tar.gz -C /tmp telegraf_binary=$(find /tmp/telegraf* -name telegraf -type f | grep /bin/ | head -1) -$CMD_INSTALL -m 755 "$telegraf_binary" /usr/bin/ +$CMD_INSTALL -m 755 "$telegraf_binary" /usr/bin/ rm -rf /tmp/telegraf* # 4. Edit config file with passwords diff --git a/coin/provisioning/common/unix/telegraf_password.sh b/coin/provisioning/common/unix/telegraf_password.sh index efbed142..24df7054 100755 --- a/coin/provisioning/common/unix/telegraf_password.sh +++ b/coin/provisioning/common/unix/telegraf_password.sh @@ -1,45 +1,14 @@ -#!/bin/sh - -############################################################################# -## -## Copyright (C) 2019 The Qt Company Ltd. -## Contact: http://www.qt.io/licensing/ -## -## This file is part of the provisioning scripts of the Qt Toolkit. -## -## $QT_BEGIN_LICENSE:LGPL21$ -## 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 http://www.qt.io/terms-conditions. For further -## information use the contact form at http://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 2.1 or version 3 as published by the Free -## Software Foundation and appearing in the file LICENSE.LGPLv21 and -## LICENSE.LGPLv3 included in the packaging of this file. Please review the -## following information to ensure the GNU Lesser General Public License -## requirements will be met: https://www.gnu.org/licenses/lgpl.html and -## http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -## -## As a special exception, The Qt Company gives you certain additional -## rights. These rights are described in The Qt Company LGPL Exception -## version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -## -## $QT_END_LICENSE$ -## -############################################################################# +#!/bin/bash +# Copyright (C) 2019 The Qt Company Ltd. +# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only ######################## BOILERPLATE ########################### set -e - PROVISIONING_DIR="$(dirname "$0")/../../" -. "$PROVISIONING_DIR"/common/unix/common.sourced.sh +# shellcheck source=./common.sourced.sh +source "${BASH_SOURCE%/*}/common.sourced.sh" is_script_executed telegraf_password.sh \ || fatal "Script telegraf_password.sh should be executed, not sourced, to avoid leaking secrets in the logs" |