Coin: Add golang & upx to Linux/macOS/Windows

Qt Creator will soon start to rely on go for tools and upx for binary compression.

Right now we can't install upx on macOS which we can live with.
Leaving the script in for later re-enabling once brew has been fixed.

Pick-to: 6.7 6.8
Change-Id: I4fdc67e469153e8a0530efd58ff251629dcabdfa
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Marcus Tillmanns 2024-06-21 11:45:27 +02:00
parent 3b9fea6394
commit 337206334e
26 changed files with 282 additions and 0 deletions

View File

@ -0,0 +1,42 @@
#!/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/DownloadURL.sh
source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
# shellcheck source=../unix/SetEnvVar.sh
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
# This script will install go 1.22.4
version="1.22.4"
uname_m="$(uname -m)"
case "$uname_m" in
x86_64|amd64)
sha256="ba79d4526102575196273416239cca418a651e049c2b099f3159db85e7bade7d"
pkgname="go$version.linux-amd64.tar.gz"
dirname="go$version.linux-amd64"
;;
arm64|aarch64)
sha256="a8e177c354d2e4a1b61020aca3562e27ea3e8f8247eca3170e3fa1e0c2f9e771"
pkgname="go$version.linux-arm64.tar.gz"
dirname="go$version.linux-arm64"
;;
*) fatal "Unknown architecture in uname: $uname_m" 43 ;;
esac
internalUrl="http://ci-files01-hki.ci.qt.io/input/go/$pkgname"
externalUrl="https://go.dev/dl/$pkgname"
targetFile="$HOME/$pkgname"
DownloadURL "$internalUrl" "$externalUrl" "$sha256" "$targetFile"
echo "Installing Go"
tar -xzf "$targetFile" -C "$HOME"
rm "$targetFile"
installPrefix="/opt/$dirname"
sudo mv "$HOME/go" "$installPrefix"
SetEnvVar "PATH" "$installPrefix/bin:\$PATH"
echo "Go = $version" >> ~/versions.txt

View File

@ -0,0 +1,42 @@
#!/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/DownloadURL.sh
source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
# shellcheck source=../unix/SetEnvVar.sh
source "${BASH_SOURCE%/*}/../unix/SetEnvVar.sh"
# This script will install UPX 4.2.4
version="4.2.4"
uname_m="$(uname -m)"
case "$uname_m" in
x86_64|amd64)
sha256="75cab4e57ab72fb4585ee45ff36388d280c7afd72aa03e8d4b9c3cbddb474193"
pkgname="upx-$version-amd64_linux.tar.xz"
dirname="upx-$version-amd64_linux"
;;
arm64|aarch64)
sha256="6bfeae6714e34a82e63245289888719c41fd6af29f749a44ae3d3d166ba6a1c9"
pkgname="upx-$version-arm64_linux.tar.xz"
dirname="upx-$version-arm64_linux"
;;
*) fatal "Unknown architecture in uname: $uname_m" 43 ;;
esac
internalUrl="http://ci-files01-hki.ci.qt.io/input/upx/$pkgname"
externalUrl="https://github.com/upx/upx/releases/download/v$version/$pkgname"
targetFile="$HOME/$pkgname"
DownloadURL "$internalUrl" "$externalUrl" "$sha256" "$targetFile"
echo "Installing UPX"
tar -xJf "$targetFile" -C "$HOME"
rm "$targetFile"
installPrefix="/opt/$dirname"
sudo mv "$HOME/$dirname" "$installPrefix"
SetEnvVar "PATH" "$installPrefix:\$PATH"
echo "UPX = $version" >> ~/versions.txt

View File

@ -0,0 +1,24 @@
# 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
. "$PSScriptRoot\helpers.ps1"
# Install Git
$version = "1.22.4"
if (Is64BitWinHost) {
$arch = "amd64"
$sha256 = "3c21105d7b584759b6e266383b777caf6e87142d304a10b539dbc66ab482bb5f"
} else {
$arch = "386"
$sha256 = "5c6446e2ea80bc6a971d2b34446f16e6517e638b0ff8d3ea229228d1931790b0"
}
$goPackage = "C:\Windows\Temp\Go-" + $version + $arch + ".msi"
$url_cache = "\\ci-files01-hki.ci.qt.io\provisioning\windows\Go-" + $version + $arch + ".exe"
$url_official = "https://go.dev/dl/go" + $version + ".windows-" + $arch + ".msi"
Write-Host "Fetching Go $version..."
Download $url_official $url_cache $goPackage
Verify-Checksum $goPackage $sha256 sha256
Write-Host "Installing Go $version..."
Run-Executable "msiexec" "/quiet /i $goPackage"
Write-Output "Go = $version" >> ~\versions.txt

View File

@ -0,0 +1,41 @@
# 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
. "$PSScriptRoot\helpers.ps1"
$majorminorversion = "4.2"
$version = "4.2.4"
$cpu_arch = Get-CpuArchitecture
Write-Host "Installing UPX for architecture $cpu_arch"
switch ($cpu_arch) {
x64 {
$arch = "win64"
$sha1 = "204ae110a84d0046b242222f97b19cf3f5594f4b"
}
default {
throw "Unknown architecture $cpu_arch"
}
}
$filename = "upx-" + $version + "-" + $arch
$filename_zip = $filename + ".zip"
$zip = Get-DownloadLocation ($filename_zip)
$officialurl = "https://github.com/upx/upx/releases/download/v" + $version + "/" + $filename_zip
$cachedurl = "https://ci-files01-hki.ci.qt.io/input/upx/" + $filename_zip
Write-Host "Removing old UPX"
Remove "C:\UPX"
Download $officialurl $cachedurl $zip
Verify-Checksum $zip $sha1
Extract-7Zip $zip C:
$defaultinstallfolder = "C:\" + $filename
Rename-Item $defaultinstallfolder C:\UPX
Add-Path "C:\UPX"
Write-Output "UPX = $version" >> ~\versions.txt

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-golang.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-upx.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-golang.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-upx.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-golang.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-upx.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-golang.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-upx.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-golang.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-upx.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-golang.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
source "${BASH_SOURCE%/*}/../common/linux/install-upx.sh"

View File

@ -0,0 +1,7 @@
#!/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
set -ex
brew install go

View File

@ -0,0 +1,8 @@
#!/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
set -ex
# The package was disabled in brew
#brew install upx

View File

@ -0,0 +1,7 @@
#!/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
set -ex
brew install go

View File

@ -0,0 +1,8 @@
#!/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
set -ex
# The package was disabled in brew
#brew install upx

View File

@ -0,0 +1,7 @@
#!/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
set -ex
brew install go

View File

@ -0,0 +1,8 @@
#!/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
set -ex
# The package was disabled in brew
# brew install upx

View File

@ -0,0 +1 @@
. "$PSScriptRoot\..\common\windows\install-golang.ps1"

View File

@ -0,0 +1 @@
. "$PSScriptRoot\..\common\windows\install-upx.ps1"

View File

@ -0,0 +1 @@
. "$PSScriptRoot\..\common\windows\install-golang.ps1"

View File

@ -0,0 +1 @@
. "$PSScriptRoot\..\common\windows\install-upx.ps1"