Provisioning: Install vcpkg on Linux

- Building the vcpkg executable
- Cloning an internal mirror of the vcpkg's official repository, and
  setting the VCPKG_ROOT to its path. The mirror is under my personal
  namespace in `git.qt.io` and will be replaced by official qt mirror
  in the future.
- Adding an empty `vcpkg.json` for Linux.
- Setting environment variables for Binary and Asset cache
- Run `install-vcpkg.sh` on all active Linux hosts

Task-number: QTBUG-115715
Change-Id: I9a4249a2fc265e4dc4c3083d1b411dffb84bfdf3
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Amir Masoud Abdol
2023-11-22 09:00:36 +01:00
parent 65e19ca672
commit 9e1b456953
7 changed files with 92 additions and 0 deletions

View File

@@ -0,0 +1,59 @@
#!/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"
# shellcheck source=../unix/DownloadURL.sh
source "${BASH_SOURCE%/*}/../unix/DownloadURL.sh"
# shellcheck source=../unix/InstallFromCompressedFileFromURL.sh
source "${BASH_SOURCE%/*}/../unix/InstallFromCompressedFileFromURL.sh"
vcpkgVersion=$(grep 'vcpkg_version=' "${BASH_SOURCE%/*}/../shared/vcpkg_version.txt" | cut -d '=' -f 2)
vcpkgRoot="$HOME/vcpkg-$vcpkgVersion"
vcpkgRepo=$(head -n 1 "${BASH_SOURCE%/*}/../shared/vcpkg_registry_mirror.txt")
echo "Cloning the vcpkg repo"
git clone "$vcpkgRepo" "$vcpkgRoot"
git -C "$vcpkgRoot" checkout "tags/$vcpkgVersion"
vcpkgToolReleaseTag=$(grep 'vcpkg_tool_release_tag=' "${BASH_SOURCE%/*}/../shared/vcpkg_tool_release_tag.txt" | cut -d '=' -f 2)
nonDottedReleaseTag=${vcpkgVersion//-/}
vcpkgToolOfficialUrl="https://github.com/microsoft/vcpkg-tool/archive/refs/tags/$vcpkgToolReleaseTag.tar.gz"
vcpkgToolCacheUrl="http://ci-files01-hki.ci.qt.io/input/vcpkg/vcpkg-tool-$nonDottedReleaseTag.tar.gz"
vcpkgToolSHA1="c6029714fca0304779f10c9c1cbe4b061a2fd945"
vcpkgToolSourceFolder="$HOME/vcpkg-tool-$vcpkgToolReleaseTag"
vcpkgToolBuildFolder="$HOME/vcpkg-tool-$vcpkgToolReleaseTag/build"
InstallFromCompressedFileFromURL "$vcpkgToolCacheUrl" "$vcpkgToolOfficialUrl" "$vcpkgToolSHA1" "$HOME" ""
cmake -S $vcpkgToolSourceFolder -B $vcpkgToolBuildFolder -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTING=OFF -DVCPKG_DEVELOPMENT_WARNINGS=OFF
cmake --build $vcpkgToolBuildFolder --parallel
cp $vcpkgToolBuildFolder/vcpkg $vcpkgRoot/
rm -rf $vcpkgToolSourceFolder
if [ ! -f "$vcpkgRoot/vcpkg" ]
then
echo "Can't find $vcpkgRoot/vcpkg."
exit 1
fi
chmod 755 "$vcpkgRoot/vcpkg"
touch "$vcpkgRoot/vcpkg.disable-metrics"
# Setting VCPKG_ROOT using Set-EnvVar makes the variable only
# available during build time. In order to make it available during the
# provisioning, we need to directly set it via $env:VCPKG_ROOT as well.
SetEnvVar "VCPKG_ROOT" "$vcpkgRoot"
export VCPKG_ROOT="$vcpkgRoot"
# Set a source for vcpkg Binary and Asset Cache
# The `coin/provisioning/common/linux/mount-vcpkg-cache-drive.sh` script is
# mounting the SMB share located in `vcpkg-server.ci.qt.io/vcpkg` to
# $HOME/vcpkg-cache/
export VCPKG_BINARY_SOURCES="files,$HOME/vcpkg-cache/binaries,readwrite"
export X_VCPKG_ASSET_SOURCES="x-azurl,file:///$HOME/vcpkg-cache/assets,,readwrite"
echo "vcpkg = $vcpkgVersion" >> ~/versions.txt

View File

@@ -0,0 +1,3 @@
{
}

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ex
BASEDIR=$(dirname "$0")
"$BASEDIR/../common/linux/install-vcpkg.sh"

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ex
BASEDIR=$(dirname "$0")
"$BASEDIR/../common/linux/install-vcpkg.sh"

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ex
BASEDIR=$(dirname "$0")
"$BASEDIR/../common/linux/install-vcpkg.sh"

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ex
BASEDIR=$(dirname "$0")
"$BASEDIR/../common/linux/install-vcpkg.sh"

View File

@@ -0,0 +1,6 @@
#!/usr/bin/env bash
set -ex
BASEDIR=$(dirname "$0")
"$BASEDIR/../common/linux/install-vcpkg.sh"