aboutsummaryrefslogtreecommitdiffstats
path: root/coin
diff options
context:
space:
mode:
authorTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-05-26 20:13:17 +0200
committerTor Arne Vestbø <tor.arne.vestbo@qt.io>2021-06-07 16:08:20 +0200
commitab78fc3c52c610bc6254f0658c94187e92e6885e (patch)
treed75de96fa104407db398ee480d87f7d77e5108db /coin
parentf5dbd9b4f02c3f38c816f74a9a9ee0e7113ded69 (diff)
coin: Provision OpenSSL as universal build for macOS
Fixes: QTBUG-93205 Change-Id: Ic1f4d7709139da06cdd05605613602c1b28306b6 Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'coin')
-rwxr-xr-xcoin/provisioning/common/macos/makeuniversal.sh59
-rwxr-xr-xcoin/provisioning/common/unix/install-openssl.sh46
-rwxr-xr-xcoin/provisioning/qtci-macos-11.0-x86_64/35-openssl.sh2
3 files changed, 98 insertions, 9 deletions
diff --git a/coin/provisioning/common/macos/makeuniversal.sh b/coin/provisioning/common/macos/makeuniversal.sh
new file mode 100755
index 00000000..b0facd72
--- /dev/null
+++ b/coin/provisioning/common/macos/makeuniversal.sh
@@ -0,0 +1,59 @@
+#!/usr/bin/env bash
+
+#############################################################################
+##
+## Copyright (C) 2021 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$
+##
+#############################################################################
+
+# Copies or lipos files from the given DESTDIR dirs to the respective install dir
+
+set -e
+
+for dir in "$@"; do
+ echo "Processing files in $dir ..."
+ pushd $dir >/dev/null
+ find . -type f | while read f; do
+ dst="${f:1}"
+ dstdir=$(dirname $dst)
+ mkdir -p $dstdir
+ if [[ ! -f $dst ]]; then
+ echo "Copying $dir/$f to $dst"
+ cp -c $f $dst
+ elif lipo -info $f >/dev/null 2>&1; then
+ echo "Lipoing $dir/$f into $dst"
+ lipo -create -output $dst $dst $f
+ elif ! diff $f $dst; then
+ echo "Error: File $f in $dir doesn't match destination $dst"
+ exit 1
+ fi
+ done
+ popd >/dev/null
+done
diff --git a/coin/provisioning/common/unix/install-openssl.sh b/coin/provisioning/common/unix/install-openssl.sh
index df82beeb..65aa3ebd 100755
--- a/coin/provisioning/common/unix/install-openssl.sh
+++ b/coin/provisioning/common/unix/install-openssl.sh
@@ -65,18 +65,48 @@ if [[ "$os" == "linux" ]]; then
echo "export LD_LIBRARY_PATH=$opensslHome/lib:$LD_LIBRARY_PATH" >> ~/.bashrc
fi
-elif [ "$os" == "macos" ]; then
+elif [ "$os" == "macos" -o "$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
+
+ commonFlags="no-tests shared no-ssl3-method enable-ec_nistp_64_gcc_128 -Wa,--noexecstack"
+
+ opensslBuild="${opensslHome}-build"
+ opensslDestdir="${opensslHome}-destdir"
+ mkdir -p $opensslBuild
+
+ if [ "$os" == "macos-universal" ]; then
+ archs="x86_64 arm64"
+ else
+ archs="x86_64"
+ fi
+
+ for arch in $archs; do
+ cd $opensslBuild
+ echo "Configuring OpenSSL for $arch"
+ mkdir $arch && cd $arch
+ $opensslSource/Configure --prefix=$openssl_install_dir $commonFlags darwin64-$arch-cc
+
+ echo "Building OpenSSL for $arch"
+ make --silent >> /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 --silent install DESTDIR=$destdir >> /tmp/openssl_make_install.log 2>&1
+ done
+
+ if [ "$os" == "macos-universal" ]; then
+ echo "Making universal OpenSSL package"
+ # shellcheck disable=SC2024
+ sudo ${BASH_SOURCE%/*}/../macos/makeuniversal.sh "$opensslDestdir/x86_64" $opensslDestdir/arm64
+ fi
path=$(echo "$opensslTargetLocation" | sed -E 's/(.*)\/.*$/\1/')
sudo mkdir -p "$path"
diff --git a/coin/provisioning/qtci-macos-11.0-x86_64/35-openssl.sh b/coin/provisioning/qtci-macos-11.0-x86_64/35-openssl.sh
index 57a86c47..24d899a8 100755
--- a/coin/provisioning/qtci-macos-11.0-x86_64/35-openssl.sh
+++ b/coin/provisioning/qtci-macos-11.0-x86_64/35-openssl.sh
@@ -3,5 +3,5 @@
set -ex
# shellcheck source=../common/macos/install_openssl.sh
-source "${BASH_SOURCE%/*}/../common/unix/install-openssl.sh" "macos"
+source "${BASH_SOURCE%/*}/../common/unix/install-openssl.sh" "macos-universal"