Provisioning: Install OpenSSL via Vcpkg on Linux

- Add a custom triplets for building dynamic android libraries
- Set `ANDROID_NDK_HOME` environment variable, as it is needed when
  vcpkg builds for Android.
- Install `perl-IPC-Cmd` when necessary, requirement for OpenSSL.
- Install openSSL for x64-linux-qt, x86-android-qt, and
  x86_64-android-qt. The latter android triplet has been renamed from
  vcpkg's official `x64-android.cmake` triplet to further clarify the
  android abi.
- Adjusted version.txt to account for the existence of two OpenSSL. The
  system OpenSSL now shows up as `System's OpenSSL` in `version.txt`.

Task-number: QTBUG-115715
Change-Id: I6cf9b808d26bbea97ebeeadac58cef5ede25ee50
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Amir Masoud Abdol 2023-11-30 11:17:48 +01:00
parent a1b278c3a3
commit a5a6393145
18 changed files with 151 additions and 5 deletions

View File

@ -80,6 +80,10 @@ SetEnvVar "ANDROID_NDK_ROOT_DEFAULT" "$targetFolder/android-ndk-$ndkVersionDefau
InstallNdk $ndkVersionLatest $ndkSha1Latest
SetEnvVar "ANDROID_NDK_ROOT_LATEST" "$targetFolder/android-ndk-$ndkVersionLatest"
# To be used by vcpkg
SetEnvVar "ANDROID_NDK_HOME" "$targetFolder/android-ndk-$ndkVersionDefault"
export ANDROID_NDK_HOME="$targetFolder/android-ndk-$ndkVersionDefault"
echo "Changing ownership of Android files."
if uname -a |grep -q "el7"; then
sudo chown -R qt:wheel "$targetFolder"

View File

@ -0,0 +1,24 @@
#!/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
echo "Installing vcpkg android ports"
pushd "${BASH_SOURCE%/*}/vcpkg" || exit
cp "${BASH_SOURCE%/*}/../shared/vcpkg-configuration.json" .
$VCPKG_ROOT/vcpkg install --triplet x86-android-qt --x-install-root x86-android-qt-tmp --debug
$VCPKG_ROOT/vcpkg install --triplet x86_64-android-qt --x-install-root x86_64-android-qt-tmp --debug
mkdir -p $VCPKG_ROOT/installed
cp -R x86-android-qt-tmp/* $VCPKG_ROOT/installed/
cp -R x86_64-android-qt-tmp/* $VCPKG_ROOT/installed/
versions=$(jq -r '.overrides[] | "vcpkg \(.name) for android = \(.version)"' vcpkg.json)
versions="${versions//vcpkg/\\nvcpkg}"
echo $versions >> ~/versions.txt
rm -rf x86-android-qt-tmp
rm -rf x86_64-android-qt-tmp
popd || exit

View File

@ -0,0 +1,21 @@
#!/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
echo "Installing vcpkg ports"
pushd "${BASH_SOURCE%/*}/vcpkg" || exit
cp "${BASH_SOURCE%/*}/../shared/vcpkg-configuration.json" .
$VCPKG_ROOT/vcpkg install --triplet x64-linux-qt --x-install-root x64-linux-qt-tmp --debug
mkdir -p "$VCPKG_ROOT/installed"
cp -R x64-linux-qt-tmp/* $VCPKG_ROOT/installed/
versions=$(jq -r '.overrides[] | "vcpkg \(.name) = \(.version)"' vcpkg.json)
versions="${versions//vcpkg/\\nvcpkg}"
echo $versions >> ~/versions.txt
rm -rf x64-linux-qt-tmp
popd || exit

0
coin/provisioning/common/linux/install-vcpkg.sh Normal file → Executable file
View File

View File

@ -1,3 +1,12 @@
{
"overrides": [
{
"name": "openssl",
"version": "3.0.7",
"port-version": 2
}
],
"dependencies": [
"openssl"
]
}

View File

@ -0,0 +1,13 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
# Default settings of the triplet from the official vcpkg registry
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
# Qt custom per-port customizations
if(PORT MATCHES "openssl")
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_FIXUP_ELF_RPATH ON)
endif()
set(VCPKG_CMAKE_SYSTEM_NAME Linux)

View File

@ -0,0 +1,15 @@
set(VCPKG_TARGET_ARCHITECTURE x86)
# Default settings of the triplet from the official vcpkg registry
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# Qt custom per-port customizations
if(PORT MATCHES "openssl")
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
set(VCPKG_CMAKE_SYSTEM_NAME Android)
set(VCPKG_MAKE_BUILD_TRIPLET "--host=i686-linux-android")
set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DANDROID_ABI=x86)

View File

@ -0,0 +1,15 @@
set(VCPKG_TARGET_ARCHITECTURE x64)
# Default settings of the triplet from the official vcpkg registry
set(VCPKG_CRT_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE static)
# Qt custom per-port customizations
if(PORT MATCHES "openssl")
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE dynamic)
endif()
set(VCPKG_CMAKE_SYSTEM_NAME Android)
set(VCPKG_MAKE_BUILD_TRIPLET "--host=x86_64-linux-android")
set(VCPKG_CMAKE_CONFIGURE_OPTIONS -DANDROID_ABI=x86_64)

View File

@ -143,6 +143,8 @@ installPackages+=(cifs-utils)
installPackages+=(jq)
# zip, needed for vcpkg caching
installPackages+=(zip)
# OpenSSL requirement, built by vcpkg
installPackages+=(perl-IPC-Cmd)
sudo yum -y install "${installPackages[@]}"
@ -163,4 +165,4 @@ sudo /usr/bin/pip3 install wheel
sudo /usr/bin/pip3 install dataclasses
OpenSSLVersion="$(openssl3 version |cut -b 9-14)"
echo "OpenSSL = $OpenSSLVersion" >> ~/versions.txt
echo "System's OpenSSL = $OpenSSLVersion" >> ~/versions.txt

View File

@ -0,0 +1,14 @@
#!/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
echo "Installing vcpkg ports"
echo "VCPKG_ROOT: ${VCPKG_ROOT}"
echo "ANDOID_NDK_HOME: ${ANDROID_NDK_HOME}"
# Installing common ports
BASEDIR=$(dirname "$0")
"$BASEDIR/../common/linux/install-vcpkg-ports.sh"
# Installing platform specific ports
"$BASEDIR/../common/linux/install-vcpkg-ports-android.sh"

View File

@ -150,6 +150,8 @@ installPackages+=(cifs-utils)
installPackages+=(jq)
# zip, needed for vcpkg caching
installPackages+=(zip)
# OpenSSL requirement, built by vcpkg
installPackages+=(perl-IPC-Cmd)
sudo yum -y install "${installPackages[@]}"
@ -174,4 +176,4 @@ sudo /usr/bin/pip3 install wheel
sudo ln -s /usr/bin/python3 /usr/local/bin/python3
OpenSSLVersion="$(openssl version |cut -b 9-14)"
echo "OpenSSL = $OpenSSLVersion" >> ~/versions.txt
echo "System's OpenSSL = $OpenSSLVersion" >> ~/versions.txt

View File

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

View File

@ -107,3 +107,6 @@ sudo zypper -nq install cifs-utils
gccVersion="$(gcc --version |grep gcc |cut -b 17-23)"
echo "GCC = $gccVersion" >> versions.txt
OpenSSLVersion="$(openssl-3 version |cut -b 9-14)"
echo "System's OpenSSL = $OpenSSLVersion" >> ~/versions.txt

View File

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

View File

@ -241,4 +241,4 @@ source "${BASH_SOURCE%/*}/../common/unix/SetEnvVar.sh"
# SetEnvVar "PATH" "/usr/lib/nodejs-mozilla/bin:\$PATH"
OpenSSLVersion="$(openssl version |cut -b 9-14)"
echo "OpenSSL = $OpenSSLVersion" >> ~/versions.txt
echo "System's OpenSSL = $OpenSSLVersion" >> ~/versions.txt

View File

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

View File

@ -82,4 +82,4 @@ gccVersion="$(gcc --version |grep gcc |cut -b 17-23)"
echo "GCC = $gccVersion" >> versions.txt
OpenSSLVersion="$(openssl-3 version |cut -b 9-14)"
echo "OpenSSL = $OpenSSLVersion" >> ~/versions.txt
echo "System's OpenSSL = $OpenSSLVersion" >> ~/versions.txt

View File

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