coin: Provision OpenSSL as universal build for macOS

Fixes: QTBUG-93205
Change-Id: Ic1f4d7709139da06cdd05605613602c1b28306b6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
This commit is contained in:
Tor Arne Vestbø 2021-05-26 20:13:17 +02:00
parent f5dbd9b4f0
commit ab78fc3c52
3 changed files with 98 additions and 9 deletions

View File

@ -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

View File

@ -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"

View File

@ -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"