diff options
| author | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
|---|---|---|
| committer | hibby <d@vehibberd.com> | 2026-10-06 21:24:40 +0100 |
| commit | c25cbdf6fb6d946175f4335fab77bfea601b56db (patch) | |
| tree | 6f7a94b7b81f999e434f61b73d47e337dfd26bf2 /.github/scripts/build-qt-macos.sh | |
| parent | 71f5689252c9f13e70e1c24856904475b2307809 (diff) | |
| parent | 0685fcada9f95fe90f70b387cd7d757da8209624 (diff) | |
Merge tag 'debian/3.2.0_rc1+dfsg-2' into debian/trixie-backportsdebian/trixie-backports
tagging wsjtx 3.2.0~rc1+dfsg-2
Diffstat (limited to '.github/scripts/build-qt-macos.sh')
| -rwxr-xr-x | .github/scripts/build-qt-macos.sh | 168 |
1 files changed, 168 insertions, 0 deletions
diff --git a/.github/scripts/build-qt-macos.sh b/.github/scripts/build-qt-macos.sh new file mode 100755 index 00000000..f60f821e --- /dev/null +++ b/.github/scripts/build-qt-macos.sh @@ -0,0 +1,168 @@ +#!/usr/bin/env bash +set -euo pipefail + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)" +# shellcheck source=macos-qt-cache-key.sh +. "${script_dir}/macos-qt-cache-key.sh" + +usage() { + cat <<'USAGE' +Usage: build-qt-macos.sh --arch ARCH --deployment-target VERSION --prefix PATH + +Builds the pinned dynamic Qt 5 source package for the requested macOS tuple. +USAGE +} + +arch="" +deployment_target="" +prefix="" + +while [ "$#" -gt 0 ]; do + case "$1" in + --arch) + arch="$2" + shift 2 + ;; + --deployment-target) + deployment_target="$2" + shift 2 + ;; + --prefix) + prefix="$2" + shift 2 + ;; + --help|-h) + usage + exit 0 + ;; + *) + echo "Unknown argument: $1" >&2 + usage >&2 + exit 2 + ;; + esac +done + +if [ -z "$arch" ] || [ -z "$deployment_target" ] || [ -z "$prefix" ]; then + usage >&2 + exit 2 +fi + +case "$arch" in + arm64|x86_64) + ;; + *) + echo "Unsupported macOS Qt architecture: $arch" >&2 + exit 2 + ;; +esac + +case "${arch}:${deployment_target}" in + arm64:11.0|x86_64:10.13) + ;; + *) + echo "Unsupported macOS Qt deployment tuple: arch=${arch}, deployment_target=${deployment_target}" >&2 + exit 2 + ;; +esac + +if [ -e "$prefix" ] && [ -n "$(ls -A "$prefix")" ]; then + echo "Qt install prefix already exists and is not empty: $prefix" >&2 + exit 1 +fi + +build_root="${RUNNER_TEMP:-${PWD}}/qt-${QT_VERSION}-${arch}-build" +archive="${build_root}/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz" + +mkdir -p "$build_root" "$prefix" + +echo "Downloading Qt ${QT_VERSION} from ${QT_SOURCE_URL}" +curl -L --fail --retry 5 --retry-delay 10 -o "$archive" "$QT_SOURCE_URL" + +actual_sha256="$(macos_qt_sha256_file "$archive")" +if [ "$actual_sha256" != "$QT_SOURCE_SHA256" ]; then + echo "Qt source SHA-256 mismatch" >&2 + echo "Expected: $QT_SOURCE_SHA256" >&2 + echo "Actual: $actual_sha256" >&2 + exit 1 +fi + +tar -xf "$archive" -C "$build_root" +source_dir="${build_root}/qt-everywhere-src-${QT_VERSION}" +if [ ! -d "$source_dir" ]; then + source_dir="${build_root}/qt-everywhere-opensource-src-${QT_VERSION}" +fi +if [ ! -d "$source_dir" ]; then + echo "Could not locate extracted Qt source directory under $build_root" >&2 + exit 1 +fi +cd "$source_dir" + +export MACOSX_DEPLOYMENT_TARGET="$deployment_target" +export QMAKE_MACOSX_DEPLOYMENT_TARGET="$deployment_target" + +configure_args=( + -opensource + -confirm-license + -release + -shared + -prefix "$prefix" + -nomake examples + -nomake tests + -qt-zlib + -qt-libpng + -qt-libjpeg + -qt-pcre + -qt-harfbuzz + -qt-sqlite + -securetransport + -skip qt3d + -skip qtactiveqt + -skip qtandroidextras + -skip qtcharts + -skip qtconnectivity + -skip qtdatavis3d + -skip qtdeclarative + -skip qtdoc + -skip qtgamepad + -skip qtgraphicaleffects + -skip qtimageformats + -skip qtlocation + -skip qtlottie + -skip qtmacextras + -skip qtnetworkauth + -skip qtpurchasing + -skip qtquick3d + -skip qtquickcontrols + -skip qtquickcontrols2 + -skip qtquicktimeline + -skip qtremoteobjects + -skip qtscript + -skip qtscxml + -skip qtsensors + -skip qtserialbus + -skip qtspeech + -skip qtvirtualkeyboard + -skip qtwayland + -skip qtwebchannel + -skip qtwebengine + -skip qtwebglplugin + -skip qtwebview + -skip qtx11extras + -skip qtxmlpatterns + "QMAKE_MACOSX_DEPLOYMENT_TARGET=${deployment_target}" + "QMAKE_APPLE_DEVICE_ARCHS=${arch}" +) + +echo "Configuring Qt ${QT_VERSION} for ${arch}, deployment target ${deployment_target}" +./configure "${configure_args[@]}" + +jobs="$(sysctl -n hw.ncpu)" +make -j"$jobs" +make install + +"${prefix}/bin/qtpaths" --qt-version | awk -v expected="$QT_VERSION" ' + $0 != expected { + printf "Expected Qt version %s, got %s\n", expected, $0 > "/dev/stderr" + exit 1 + }' |
