diff options
| author | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:55 +0200 |
|---|---|---|
| committer | Christoph Berg <myon@debian.org> | 2026-06-22 12:03:55 +0200 |
| commit | de18fc13175a5bf0e2b48a042d2fc06e87c88d24 (patch) | |
| tree | f517074cd603d30eb7ba7e2122d38051e4c1439c /.github | |
| parent | b76e8361909e47f0937d4a64a5a4cb5939f51eb7 (diff) | |
| parent | d83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff) | |
Update upstream source from tag 'upstream/3.0.2+dfsg'
Update to upstream version '3.0.2+dfsg'
with Debian dir 90381fe7be9f5ea84d9b16c9cccf200a3fbe138b
Diffstat (limited to '.github')
| -rw-r--r-- | .github/scripts/audit-staged-dll-imports-windows.sh | 74 | ||||
| -rwxr-xr-x | .github/scripts/build-boost-macos.sh | 37 | ||||
| -rwxr-xr-x | .github/scripts/build-fftw-macos.sh | 25 | ||||
| -rwxr-xr-x | .github/scripts/build-hamlib-macos.sh | 24 | ||||
| -rwxr-xr-x | .github/scripts/build-libusb-macos.sh | 23 | ||||
| -rwxr-xr-x | .github/scripts/build-portaudio-macos.sh | 44 | ||||
| -rwxr-xr-x | .github/scripts/build-qt-macos.sh | 169 | ||||
| -rwxr-xr-x | .github/scripts/install-r-macos-gfortran.sh | 156 | ||||
| -rwxr-xr-x | .github/scripts/install-xpack-gfortran-macos.sh | 194 | ||||
| -rwxr-xr-x | .github/scripts/macos-qt-cache-key.sh | 147 | ||||
| -rwxr-xr-x | .github/scripts/verify-macos-artifacts.sh | 188 | ||||
| -rwxr-xr-x | .github/scripts/verify-macos-static-archives.sh | 211 | ||||
| -rw-r--r-- | .github/workflows/build-linux.yml | 20 | ||||
| -rw-r--r-- | .github/workflows/build-macos.yml | 844 | ||||
| -rw-r--r-- | .github/workflows/build-windows.yml | 36 | ||||
| -rw-r--r-- | .github/workflows/ci.yml | 20 | ||||
| -rw-r--r-- | .github/workflows/prepare-macos-qt.yml | 73 | ||||
| -rw-r--r-- | .github/workflows/release.yml | 60 |
18 files changed, 2216 insertions, 129 deletions
diff --git a/.github/scripts/audit-staged-dll-imports-windows.sh b/.github/scripts/audit-staged-dll-imports-windows.sh new file mode 100644 index 00000000..b16adaca --- /dev/null +++ b/.github/scripts/audit-staged-dll-imports-windows.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash +set -u + +stage_bin="${1:?usage: audit-staged-dll-imports-windows.sh <stage-bin> <exe> [exe...]}" +shift + +if [ ! -d "$stage_bin" ]; then + echo "::error::staged bin directory not found: $stage_bin" + exit 1 +fi + +if [ "$#" -eq 0 ]; then + echo "::error::no executables supplied for DLL import audit" + exit 1 +fi + +fail=0 + +staged_lower=$( + for dll in "$stage_bin"/*.dll "$stage_bin"/*.DLL; do + [ -e "$dll" ] || continue + basename "$dll" | tr '[:upper:]' '[:lower:]' + done | sort -u +) + +echo "staged DLLs in $stage_bin:" +if [ -n "$staged_lower" ]; then + echo "$staged_lower" +else + echo "(none)" +fi + +for exe in "$@"; do + if [ ! -f "$exe" ]; then + echo "::error::executable not found for DLL import audit: $exe" + fail=1 + continue + fi + + echo "::group::DLL imports for $exe" + imports=$( + objdump -p "$exe" | + awk '/DLL Name:/ {print $3}' | + sort -u + ) + + if [ -n "$imports" ]; then + echo "$imports" + else + echo "(none)" + fi + + high_risk=$( + echo "$imports" | + awk '{ lower=tolower($0); if (lower ~ /^(libgomp|libgfortran|libgcc_s|libquadmath|libportaudio|libhamlib|libfftw|qt5.*\.dll)/) print lower }' | + sort -u + ) + + for dll in $high_risk; do + if ! printf '%s\n' "$staged_lower" | awk -v wanted="$dll" '$0 == wanted { found=1 } END { exit found ? 0 : 1 }'; then + echo "::error::$exe imports $dll, but $dll is missing from $stage_bin" + fail=1 + fi + done + echo "::endgroup::" +done + +if [ "$fail" -ne 0 ]; then + echo "::group::staged bin contents" + ls -la "$stage_bin" + echo "::endgroup::" +fi + +exit "$fail" diff --git a/.github/scripts/build-boost-macos.sh b/.github/scripts/build-boost-macos.sh new file mode 100755 index 00000000..06e9de1a --- /dev/null +++ b/.github/scripts/build-boost-macos.sh @@ -0,0 +1,37 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ "$#" -ne 4 ]; then + echo "Usage: build-boost-macos.sh VERSION ARCH DEPLOYMENT_TARGET PREFIX" >&2 + exit 2 +fi + +version="$1" +arch="$2" +deployment_target="$3" +prefix="$4" +version_underscores=${version//./_} +boost_arch=x86 + +if [ "$arch" = "arm64" ]; then + boost_arch=arm +fi + +curl -L --fail --retry 5 --retry-delay 10 -o boost.tar.bz2 "https://archives.boost.io/release/${version}/source/boost_${version_underscores}.tar.bz2" +tar -xjf boost.tar.bz2 +cd "boost_${version_underscores}" + +./bootstrap.sh --prefix="$prefix" --with-libraries=log +./b2 -j"$(sysctl -n hw.ncpu)" \ + toolset=clang \ + variant=release \ + link=shared \ + runtime-link=shared \ + threading=multi \ + cxxstd=11 \ + cflags="-mmacosx-version-min=${deployment_target}" \ + cxxflags="-mmacosx-version-min=${deployment_target}" \ + linkflags="-mmacosx-version-min=${deployment_target}" \ + architecture="$boost_arch" \ + address-model=64 \ + install diff --git a/.github/scripts/build-fftw-macos.sh b/.github/scripts/build-fftw-macos.sh new file mode 100755 index 00000000..6ae1505d --- /dev/null +++ b/.github/scripts/build-fftw-macos.sh @@ -0,0 +1,25 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ "$#" -ne 3 ]; then + echo "Usage: build-fftw-macos.sh VERSION DEPLOYMENT_TARGET PREFIX" >&2 + exit 2 +fi + +version="$1" +deployment_target="$2" +prefix="$3" + +curl -L --fail --retry 5 --retry-delay 10 -o fftw.tar.gz "https://www.fftw.org/fftw-${version}.tar.gz" +tar -xzf fftw.tar.gz +cd "fftw-${version}" + +./configure \ + --prefix="$prefix" \ + --enable-single \ + --enable-threads \ + --enable-shared --disable-static \ + CFLAGS="-mmacosx-version-min=${deployment_target}" \ + LDFLAGS="-mmacosx-version-min=${deployment_target}" +make -j"$(sysctl -n hw.ncpu)" +make install diff --git a/.github/scripts/build-hamlib-macos.sh b/.github/scripts/build-hamlib-macos.sh new file mode 100755 index 00000000..637492e4 --- /dev/null +++ b/.github/scripts/build-hamlib-macos.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ "$#" -ne 3 ]; then + echo "Usage: build-hamlib-macos.sh BRANCH DEPLOYMENT_TARGET PREFIX" >&2 + exit 2 +fi + +branch="$1" +deployment_target="$2" +prefix="$3" + +git clone --depth 1 --branch "$branch" \ + https://github.com/Hamlib/Hamlib.git hamlib-src +cd hamlib-src +./bootstrap +./configure \ + --prefix="$prefix" \ + --disable-shared --enable-static \ + --without-cxx-binding \ + CFLAGS="-mmacosx-version-min=${deployment_target}" \ + LDFLAGS="-mmacosx-version-min=${deployment_target}" +make -j"$(sysctl -n hw.ncpu)" +make install diff --git a/.github/scripts/build-libusb-macos.sh b/.github/scripts/build-libusb-macos.sh new file mode 100755 index 00000000..928962db --- /dev/null +++ b/.github/scripts/build-libusb-macos.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ "$#" -ne 3 ]; then + echo "Usage: build-libusb-macos.sh VERSION DEPLOYMENT_TARGET PREFIX" >&2 + exit 2 +fi + +version="$1" +deployment_target="$2" +prefix="$3" + +curl -L --fail --retry 5 --retry-delay 10 -o libusb.tar.bz2 "https://github.com/libusb/libusb/releases/download/v${version}/libusb-${version}.tar.bz2" +tar -xjf libusb.tar.bz2 +cd "libusb-${version}" + +./configure \ + --prefix="$prefix" \ + --enable-shared --disable-static \ + CFLAGS="-mmacosx-version-min=${deployment_target}" \ + LDFLAGS="-mmacosx-version-min=${deployment_target}" +make -j"$(sysctl -n hw.ncpu)" +make install diff --git a/.github/scripts/build-portaudio-macos.sh b/.github/scripts/build-portaudio-macos.sh new file mode 100755 index 00000000..c3a31b4d --- /dev/null +++ b/.github/scripts/build-portaudio-macos.sh @@ -0,0 +1,44 @@ +#!/usr/bin/env bash +set -euo pipefail + +if [ "$#" -ne 3 ]; then + echo "Usage: build-portaudio-macos.sh VERSION DEPLOYMENT_TARGET PREFIX" >&2 + exit 2 +fi + +version="$1" +deployment_target="$2" +prefix="$3" + +case "$version" in + 19.7.0) + archive_name="pa_stable_v190700_20210406" + source_url="https://files.portaudio.com/archives/${archive_name}.tgz" + source_dir="portaudio" + ;; + *) + echo "Unsupported PortAudio version: $version" >&2 + exit 2 + ;; +esac + +curl -L --fail --retry 5 --retry-delay 10 -o portaudio.tgz "$source_url" +tar -xzf portaudio.tgz +cd "$source_dir" + +# PortAudio 19.7.0's generated configure script overwrites caller CFLAGS on +# macOS, hardcodes a host-derived deployment target, and enables -Werror. +# Patch the generated script so CI controls the deployment target and modern +# Apple Clang warnings do not break a pinned third-party runtime build. +sed \ + -e 's/ -Wno-deprecated -Werror/ -Wno-deprecated/g' \ + -e "s/mac_version_min=\"-mmacosx-version-min=[0-9.]*\"/mac_version_min=\"-mmacosx-version-min=${deployment_target}\"/g" \ + configure > configure.tmp +mv configure.tmp configure +chmod +x configure + +./configure \ + --prefix="$prefix" \ + --enable-shared --disable-static +make -j"$(sysctl -n hw.ncpu)" +make install diff --git a/.github/scripts/build-qt-macos.sh b/.github/scripts/build-qt-macos.sh new file mode 100755 index 00000000..3bc0434b --- /dev/null +++ b/.github/scripts/build-qt-macos.sh @@ -0,0 +1,169 @@ +#!/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/qmake" -query +"${prefix}/bin/qmake" -query QT_VERSION | awk -v expected="$QT_VERSION" ' + $0 != expected { + printf "Expected qmake QT_VERSION %s, got %s\n", expected, $0 > "/dev/stderr" + exit 1 + }' diff --git a/.github/scripts/install-r-macos-gfortran.sh b/.github/scripts/install-r-macos-gfortran.sh new file mode 100755 index 00000000..d6722d4a --- /dev/null +++ b/.github/scripts/install-r-macos-gfortran.sh @@ -0,0 +1,156 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat <<'USAGE' +Usage: install-r-macos-gfortran.sh --target VERSION --arch ARCH --work-dir PATH --prefix PATH [--github-output] + +Downloads the R/macOS GNU Fortran package selected for the requested macOS +build tuple, expands it without using the macOS installer, and prepares a +relocated compiler prefix for CI. +USAGE +} + +target="" +arch="" +work_dir="" +prefix="" +github_output=0 +pkg_url="https://mac.r-project.org/tools/gfortran-14.2-universal.pkg" +pkg_sha256="ec462d465f093eeee0623d2b5d327bd1038313b985034b766462957e36d7aadd" +version="14.2.0" + +while [ "$#" -gt 0 ]; do + case "$1" in + --target) + target="$2" + shift 2 + ;; + --arch) + arch="$2" + shift 2 + ;; + --work-dir) + work_dir="$2" + shift 2 + ;; + --prefix) + prefix="$2" + shift 2 + ;; + --github-output) + github_output=1 + shift + ;; + --help|-h) + usage + exit 0 + ;; + *) + echo "Unknown option: $1" >&2 + usage >&2 + exit 2 + ;; + esac +done + +if [ -z "$target" ] || [ -z "$arch" ] || [ -z "$work_dir" ] || [ -z "$prefix" ]; then + usage >&2 + exit 2 +fi + +case "${arch}:${target}" in + arm64:11.0) + triplet="aarch64-apple-darwin20.0" + ;; + *) + echo "::error::Unsupported R/macOS gfortran tuple: arch=${arch}, target=${target}" + exit 2 + ;; +esac + +pkg="${work_dir}/gfortran-14.2-universal.pkg" +expanded="${work_dir}/gfortran-14.2-expanded" +payload_prefix="${expanded}/gfortran.pkg/Payload/opt/gfortran" +runtime_dir="${prefix}/lib/gcc/${triplet}/${version}" + +mkdir -p "$work_dir" + +echo "R/macOS GNU Fortran install" +echo "Package URL: ${pkg_url}" +echo "Expected SHA-256: ${pkg_sha256}" +echo "Requested tuple: arch=${arch}, target=${target}, triplet=${triplet}" +echo "Install prefix: ${prefix}" + +curl -fsSL --retry 3 --retry-delay 5 -o "$pkg" "$pkg_url" +actual_sha256="$(shasum -a 256 "$pkg" | awk '{print $1}')" +echo "Actual SHA-256: ${actual_sha256}" +if [ "$actual_sha256" != "$pkg_sha256" ]; then + echo "::error::Unexpected R/macOS gfortran package checksum" + exit 1 +fi + +pkgutil --expand-full "$pkg" "$expanded" +if [ ! -d "$payload_prefix" ]; then + echo "::error::Expanded package does not contain expected /opt/gfortran payload" + exit 1 +fi + +mkdir -p "$(dirname "$prefix")" +ditto "$payload_prefix" "$prefix" + +target_compiler="${prefix}/bin/${triplet}-gfortran" +if [ ! -x "$target_compiler" ]; then + echo "::error::Expected target gfortran compiler not found: ${target_compiler}" + exit 1 +fi +compiler="$target_compiler" +if [ ! -d "$runtime_dir" ]; then + echo "::error::Runtime archive directory not found: ${runtime_dir}" + exit 1 +fi + +sdkroot="$(xcrun --sdk macosx --show-sdk-path)" +libgfortran="${runtime_dir}/libgfortran.a" +libquadmath="${runtime_dir}/libquadmath.a" +libgcc="${runtime_dir}/libgcc.a" +libgomp="${runtime_dir}/libgomp.a" + +archives=("$libgfortran" "$libquadmath" "$libgcc" "$libgomp") +for archive in "${archives[@]}"; do + if [ ! -f "$archive" ]; then + echo "::error::Expected runtime archive not found: ${archive}" + exit 1 + fi +done + +"${GITHUB_WORKSPACE:-$(pwd)}/.github/scripts/verify-macos-static-archives.sh" \ + --target "$target" \ + --arch "$arch" \ + --mode error \ + "${archives[@]}" + +echo "Compiler: ${compiler}" +file "$compiler" +otool -L "$compiler" + +runtime_link_flags="${libgfortran} ${libquadmath} ${libgcc}" +fortran_runtime_flags="-static-libgcc -static-libgfortran -static-libquadmath -isysroot ${sdkroot}" +runtime_archives="${archives[*]}" +cache_key="r-macos-gfortran-14.2-universal-${pkg_sha256}" + +if [ "$github_output" -eq 1 ]; then + github_output_file="${GITHUB_OUTPUT:-/dev/stdout}" + { + echo "path=${compiler}" + echo "prefix=${prefix}" + echo "original_prefix=/opt/gfortran" + echo "runtime_lib_dir=${runtime_dir}" + echo "fortran_runtime_flags=${fortran_runtime_flags}" + echo "runtime_link_flags=${runtime_link_flags}" + echo "runtime_archives=${runtime_archives}" + echo "libgomp=${libgomp}" + echo "version=${version}" + echo "cache_key=${cache_key}" + } >> "$github_output_file" +fi diff --git a/.github/scripts/install-xpack-gfortran-macos.sh b/.github/scripts/install-xpack-gfortran-macos.sh new file mode 100755 index 00000000..c500d076 --- /dev/null +++ b/.github/scripts/install-xpack-gfortran-macos.sh @@ -0,0 +1,194 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat <<'USAGE' +Usage: install-xpack-gfortran-macos.sh --target VERSION --arch ARCH --work-dir PATH --prefix PATH [--github-output] + +Downloads the xPack GCC archive selected for the requested macOS build tuple, +verifies it, and prepares a relocated compiler prefix for CI. +USAGE +} + +target="" +arch="" +work_dir="" +prefix="" +github_output=0 + +while [ "$#" -gt 0 ]; do + case "$1" in + --target) + target="$2" + shift 2 + ;; + --arch) + arch="$2" + shift 2 + ;; + --work-dir) + work_dir="$2" + shift 2 + ;; + --prefix) + prefix="$2" + shift 2 + ;; + --github-output) + github_output=1 + shift + ;; + --help|-h) + usage + exit 0 + ;; + *) + echo "Unknown option: $1" >&2 + usage >&2 + exit 2 + ;; + esac +done + +if [ -z "$target" ] || [ -z "$arch" ] || [ -z "$work_dir" ] || [ -z "$prefix" ]; then + usage >&2 + exit 2 +fi + +case "${arch}:${target}" in + x86_64:10.13) + archive_name="xpack-gcc-12.4.0-1-darwin-x64" + package_name="xpack-gcc-12.4.0-1" + package_url="https://github.com/xpack-dev-tools/gcc-xpack/releases/download/v12.4.0-1/${archive_name}.tar.gz" + package_sha256="f194b0fc72c7d6563694707794e350e73f807635c8bdb05168924a56126d871c" + runtime_dir="lib/gcc/x86_64-apple-darwin18.7.0/12.4.0" + version="12.4.0" + ;; + *) + echo "::error::Unsupported xPack gfortran tuple: arch=${arch}, target=${target}" + exit 2 + ;; +esac + +archive="${work_dir}/${archive_name}.tar.gz" +expanded="${work_dir}/expanded" +payload_prefix="${expanded}/${package_name}" + +mkdir -p "$work_dir" + +echo "xPack GCC install" +echo "Package URL: ${package_url}" +echo "Expected SHA-256: ${package_sha256}" +echo "Requested tuple: arch=${arch}, target=${target}" +echo "Install prefix: ${prefix}" + +curl -fsSL --retry 3 --retry-delay 5 -o "$archive" "$package_url" +actual_sha256="$(shasum -a 256 "$archive" | awk '{print $1}')" +echo "Actual SHA-256: ${actual_sha256}" +if [ "$actual_sha256" != "$package_sha256" ]; then + echo "::error::Unexpected xPack GCC archive checksum" + exit 1 +fi + +mkdir -p "$expanded" +tar -xzf "$archive" -C "$expanded" +if [ ! -d "$payload_prefix" ]; then + echo "::error::Expanded archive does not contain expected ${package_name} payload" + exit 1 +fi + +mkdir -p "$(dirname "$prefix")" +ditto "$payload_prefix" "$prefix" + +compiler="${prefix}/bin/gfortran" +if [ ! -x "$compiler" ]; then + echo "::error::Expected gfortran compiler not found: ${compiler}" + exit 1 +fi + +sdkroot="$(xcrun --sdk macosx --show-sdk-path)" +libgfortran="${prefix}/lib/libgfortran.a" +libquadmath="${prefix}/lib/libquadmath.a" +libgcc="${prefix}/${runtime_dir}/libgcc.a" +libgomp="${prefix}/lib/libgomp.a" +libgfortran_spec="${prefix}/lib/libgfortran.spec" + +archives=("$libgfortran" "$libquadmath" "$libgcc" "$libgomp") +for archive_member in "${archives[@]}"; do + if [ ! -f "$archive_member" ]; then + echo "::error::Expected runtime archive not found: ${archive_member}" + exit 1 + fi +done + +if [ ! -f "$libgfortran_spec" ]; then + echo "::error::Expected libgfortran spec not found: ${libgfortran_spec}" + exit 1 +fi + +spec_tmp="${libgfortran_spec}.tmp" +# This xPack Darwin build lacks -static-libquadmath, but its libgfortran spec +# injects -lquadmath. Rewrite that injected library to the verified static +# archive so the compiler driver can still own the Fortran runtime link policy. +sed "s|-lquadmath|${libquadmath}|g" "$libgfortran_spec" > "$spec_tmp" +if cmp -s "$libgfortran_spec" "$spec_tmp"; then + echo "::error::xPack libgfortran spec did not contain the expected libquadmath injection" + exit 1 +fi +mv "$spec_tmp" "$libgfortran_spec" + +"${GITHUB_WORKSPACE:-$(pwd)}/.github/scripts/verify-macos-static-archives.sh" \ + --target "$target" \ + --arch "$arch" \ + --mode error \ + "${archives[@]}" + +echo "Compiler: ${compiler}" +file "$compiler" +otool -L "$compiler" +"$compiler" --version + +runtime_link_flags="" +fortran_runtime_flags="-static-libgcc -static-libgfortran -mmacosx-version-min=${target} -isysroot ${sdkroot}" +runtime_archives="${archives[*]}" +cache_key="${archive_name}-${package_sha256}" + +quadmath_probe="${work_dir}/quadmath-static-probe.f90" +quadmath_probe_exe="${work_dir}/quadmath-static-probe" +{ + echo "program main" + echo " real(16) :: x" + echo " x = sqrt(2.0_16)" + echo " print *, x" + echo "end program main" +} > "$quadmath_probe" + +"$compiler" \ + -static-libgcc \ + -static-libgfortran \ + "-mmacosx-version-min=${target}" \ + -isysroot "$sdkroot" \ + "$quadmath_probe" \ + -o "$quadmath_probe_exe" + +otool -L "$quadmath_probe_exe" +if otool -L "$quadmath_probe_exe" | awk '/libquadmath.*\.dylib/ { found=1; print } END { exit found ? 0 : 1 }'; then + echo "::error::xPack gfortran linked the quadmath probe against dynamic libquadmath" + exit 1 +fi + +if [ "$github_output" -eq 1 ]; then + github_output_file="${GITHUB_OUTPUT:-/dev/stdout}" + { + echo "path=${compiler}" + echo "prefix=${prefix}" + echo "original_prefix=xpack-gcc" + echo "runtime_lib_dir=${prefix}/${runtime_dir}" + echo "fortran_runtime_flags=${fortran_runtime_flags}" + echo "runtime_link_flags=${runtime_link_flags}" + echo "runtime_archives=${runtime_archives}" + echo "libgomp=${libgomp}" + echo "version=${version}" + echo "cache_key=${cache_key}" + } >> "$github_output_file" +fi diff --git a/.github/scripts/macos-qt-cache-key.sh b/.github/scripts/macos-qt-cache-key.sh new file mode 100755 index 00000000..06359737 --- /dev/null +++ b/.github/scripts/macos-qt-cache-key.sh @@ -0,0 +1,147 @@ +#!/usr/bin/env bash +set -euo pipefail + +QT_VERSION=5.15.18 +QT_SOURCE_SHA256=cea1fbabf02455f3f0e8eaa839f5d6f45cdb56b62c8a83af5c1d00ac05f912ea +QT_CACHE_EPOCH=1 +QT_SOURCE_URL="https://download.qt.io/archive/qt/5.15/${QT_VERSION}/single/qt-everywhere-opensource-src-${QT_VERSION}.tar.xz" + +macos_qt_script_dir() { + cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 + pwd +} + +macos_qt_sha256_file() { + if command -v shasum >/dev/null 2>&1; then + shasum -a 256 "$1" | awk '{print $1}' + elif command -v sha256sum >/dev/null 2>&1; then + sha256sum "$1" | awk '{print $1}' + else + echo "No SHA-256 tool found; expected shasum or sha256sum" >&2 + return 1 + fi +} + +macos_qt_sha256_stream() { + if command -v shasum >/dev/null 2>&1; then + shasum -a 256 | awk '{print $1}' + elif command -v sha256sum >/dev/null 2>&1; then + sha256sum | awk '{print $1}' + else + echo "No SHA-256 tool found; expected shasum or sha256sum" >&2 + return 1 + fi +} + +macos_qt_script_hash() { + local script_dir + script_dir="$(macos_qt_script_dir)" + + { + for script in build-qt-macos.sh macos-qt-cache-key.sh; do + local path="${script_dir}/${script}" + if [ ! -f "$path" ]; then + echo "Missing Qt cache input script: $path" >&2 + return 1 + fi + printf '%s %s\n' "$(macos_qt_sha256_file "$path")" "$script" + done + } | macos_qt_sha256_stream +} + +macos_qt_cache_key() { + local arch="$1" + local runner="$2" + local deployment_target="$3" + local script_hash + script_hash="$(macos_qt_script_hash)" + + printf 'qt-macos-%s-%s-%s-min%s-epoch%s-%s\n' \ + "$arch" \ + "$runner" \ + "$QT_VERSION" \ + "$deployment_target" \ + "$QT_CACHE_EPOCH" \ + "$script_hash" +} + +usage() { + cat <<'USAGE' +Usage: macos-qt-cache-key.sh --arch ARCH --runner RUNNER --deployment-target VERSION [--github-output] + +Prints the exact GitHub Actions cache key for the pinned macOS Qt build. +USAGE +} + +main() { + local arch="" + local runner="" + local deployment_target="" + local github_output=0 + + while [ "$#" -gt 0 ]; do + case "$1" in + --arch) + arch="$2" + shift 2 + ;; + --runner) + runner="$2" + shift 2 + ;; + --deployment-target) + deployment_target="$2" + shift 2 + ;; + --github-output) + github_output=1 + shift + ;; + --help|-h) + usage + exit 0 + ;; + *) + echo "Unknown argument: $1" >&2 + usage >&2 + exit 2 + ;; + esac + done + + if [ -z "$arch" ] || [ -z "$runner" ] || [ -z "$deployment_target" ]; then + usage >&2 + exit 2 + fi + + case "${arch}:${runner}:${deployment_target}" in + arm64:macos-15:11.0|x86_64:macos-15-intel:10.13) + ;; + *) + echo "Unsupported macOS Qt build tuple: arch=${arch}, runner=${runner}, deployment_target=${deployment_target}" >&2 + exit 2 + ;; + esac + + local key + key="$(macos_qt_cache_key "$arch" "$runner" "$deployment_target")" + printf '%s\n' "$key" + + if [ "$github_output" -eq 1 ]; then + if [ -z "${GITHUB_OUTPUT:-}" ]; then + echo "--github-output requires GITHUB_OUTPUT to be set" >&2 + exit 2 + fi + { + printf 'key=%s\n' "$key" + printf 'version=%s\n' "$QT_VERSION" + printf 'source_url=%s\n' "$QT_SOURCE_URL" + printf 'source_sha256=%s\n' "$QT_SOURCE_SHA256" + printf 'cache_epoch=%s\n' "$QT_CACHE_EPOCH" + } >> "$GITHUB_OUTPUT" + fi +} + +if [[ "${BASH_SOURCE[0]}" == "$0" ]]; then + main "$@" +fi diff --git a/.github/scripts/verify-macos-artifacts.sh b/.github/scripts/verify-macos-artifacts.sh new file mode 100755 index 00000000..954c54e9 --- /dev/null +++ b/.github/scripts/verify-macos-artifacts.sh @@ -0,0 +1,188 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat <<'USAGE' +Usage: verify-macos-artifacts.sh --target VERSION --arch ARCH [--allow-prefix PATH ...] PATH... + +Verifies Mach-O files under PATH for: + * expected architecture + * deployment target not newer than --target + * no package-manager runtime library references + +Package-manager paths are always rejected: + /opt/homebrew, /usr/local/Cellar, /usr/local/opt, /opt/local +USAGE +} + +target="" +arch="" +allow_prefixes=() +paths=() + +while [ "$#" -gt 0 ]; do + case "$1" in + --target) + target="$2" + shift 2 + ;; + --arch) + arch="$2" + shift 2 + ;; + --allow-prefix) + allow_prefixes+=("$2") + shift 2 + ;; + --help|-h) + usage + exit 0 + ;; + --) + shift + while [ "$#" -gt 0 ]; do + paths+=("$1") + shift + done + ;; + -*) + echo "Unknown option: $1" >&2 + usage >&2 + exit 2 + ;; + *) + paths+=("$1") + shift + ;; + esac +done + +if [ -z "$target" ] || [ -z "$arch" ] || [ "${#paths[@]}" -eq 0 ]; then + usage >&2 + exit 2 +fi + +# Validate that all target paths exist before checking +for path in "${paths[@]}"; do + if [ ! -e "$path" ]; then + echo "::error::Path does not exist: $path" >&2 + exit 2 + fi +done + + +version_gt() { + awk -v a="$1" -v b="$2" ' + BEGIN { + split(a, av, ".") + split(b, bv, ".") + for (i = 1; i <= 3; i++) { + ai = av[i] + 0 + bi = bv[i] + 0 + if (ai > bi) exit 0 + if (ai < bi) exit 1 + } + exit 1 + }' +} + +is_macho() { + local file="$1" + file "$file" 2>/dev/null | grep -Eq 'Mach-O|universal binary' +} + +is_allowed_reference() { + local ref="$1" + case "$ref" in + @rpath/*|@loader_path/*|@executable_path/*|/usr/lib/*|/System/Library/*) + return 0 + ;; + esac + + local prefix + if [ "${#allow_prefixes[@]}" -gt 0 ]; then + for prefix in "${allow_prefixes[@]}"; do + case "$ref" in + "$prefix"/*) return 0 ;; + esac + done + fi + + return 1 +} + +check_file() { + local file="$1" + local fail=0 + local archs + local minos + local refs + local install_name + + archs=$(lipo -archs "$file" 2>/dev/null || true) + if [ -z "$archs" ]; then + echo "::error file=${file}::Could not determine Mach-O architecture" + return 1 + fi + if ! printf '%s\n' "$archs" | tr ' ' '\n' | grep -qx "$arch"; then + echo "::error file=${file}::Expected architecture ${arch}, found: ${archs}" + return 1 + fi + + minos=$(otool -arch "$arch" -l "$file" 2>/dev/null | awk ' + /LC_BUILD_VERSION/ { in_build = 1; next } + in_build && /minos/ { print $2; exit } + /LC_VERSION_MIN_MACOSX/ { in_old = 1; next } + in_old && /version/ { print $2; exit } + ') + if [ -n "$minos" ] && version_gt "$minos" "$target"; then + echo "::error file=${file}::Requires macOS ${minos}, newer than artifact target ${target}" + fail=1 + fi + + install_name=$(otool -arch "$arch" -D "$file" 2>/dev/null | awk 'NR == 2 { print $1 }' || true) + refs=$(otool -arch "$arch" -L "$file" 2>/dev/null | awk 'NR > 1 { print $1 }' || true) + while IFS= read -r ref; do + [ -n "$ref" ] || continue + if [ "$ref" = "$install_name" ]; then + case "$ref" in + */*) ;; + *) continue ;; + esac + fi + case "$ref" in + /opt/homebrew/*|/usr/local/Cellar/*|/usr/local/opt/*|/opt/local/*) + echo "::error file=${file}::Package-manager runtime reference is not allowed: ${ref}" + fail=1 + continue + ;; + esac + if ! is_allowed_reference "$ref"; then + echo "::error file=${file}::Unexpected runtime reference: ${ref}" + fail=1 + fi + done <<< "$refs" + + return "$fail" +} + +overall=0 +while IFS= read -r file; do + if is_macho "$file"; then + check_file "$file" || overall=1 + fi +done < <( + for path in "${paths[@]}"; do + if [ -d "$path" ]; then + find "$path" -type f \( -perm +111 -o -name "*.dylib" -o -name "*.so" \) + elif [ -f "$path" ]; then + printf '%s\n' "$path" + fi + done +) + +if [ "$overall" -ne 0 ]; then + exit "$overall" +fi + +echo "All checked Mach-O files match arch ${arch}, target macOS ${target}, and approved runtime paths." diff --git a/.github/scripts/verify-macos-static-archives.sh b/.github/scripts/verify-macos-static-archives.sh new file mode 100755 index 00000000..2c20875e --- /dev/null +++ b/.github/scripts/verify-macos-static-archives.sh @@ -0,0 +1,211 @@ +#!/usr/bin/env bash +set -euo pipefail + +usage() { + cat <<'USAGE' +Usage: verify-macos-static-archives.sh --target VERSION --arch ARCH [--mode error|warn] PATH... + +Verifies static archives before they are linked into deployable macOS binaries: + * expected architecture + * object-member deployment targets not newer than --target + +--mode error (default) fails the build on any finding. --mode warn keeps +structural problems (missing archive, wrong architecture) fatal but +downgrades object-member deployment-target findings to warning annotations +and exits 0. Member deployment targets in third-party toolchain archives +are outside this workflow's control, so only that uncertain signal is made +non-blocking; a missing input or wrong-arch archive is broken plumbing and +always fails. +USAGE +} + +target="" +arch="" +mode="error" +archives=() +max_member_errors=25 + +while [ "$#" -gt 0 ]; do + case "$1" in + --target) + target="$2" + shift 2 + ;; + --arch) + arch="$2" + shift 2 + ;; + --mode) + mode="$2" + shift 2 + ;; + --help|-h) + usage + exit 0 + ;; + --) + shift + while [ "$#" -gt 0 ]; do + archives+=("$1") + shift + done + ;; + -*) + echo "Unknown option: $1" >&2 + usage >&2 + exit 2 + ;; + *) + archives+=("$1") + shift + ;; + esac +done + +if [ -z "$target" ] || [ -z "$arch" ] || [ "${#archives[@]}" -eq 0 ]; then + usage >&2 + exit 2 +fi + +case "$mode" in + error|warn) ;; + *) + echo "Invalid --mode: $mode (expected error or warn)" >&2 + exit 2 + ;; +esac + +# Annotation level for findings: errors fail the build, warnings do not. +if [ "$mode" = "warn" ]; then + ann="warning" +else + ann="error" +fi + +version_gt() { + awk -v a="$1" -v b="$2" ' + BEGIN { + split(a, av, ".") + split(b, bv, ".") + for (i = 1; i <= 3; i++) { + ai = av[i] + 0 + bi = bv[i] + 0 + if (ai > bi) exit 0 + if (ai < bi) exit 1 + } + exit 1 + }' +} + +check_archive() { + local archive="$1" + local structural_fail=0 + local target_fail=0 + local archs + local line + local member="" + local in_build=0 + local in_old=0 + local minos + local reported=0 + local suppressed=0 + + if [ ! -f "$archive" ]; then + echo "::error::Static archive does not exist: ${archive}" + return 2 + fi + + archs=$(lipo -archs "$archive" 2>/dev/null || true) + if [ -n "$archs" ] && ! printf '%s\n' "$archs" | tr ' ' '\n' | grep -qx "$arch"; then + echo "::error file=${archive}::Expected architecture ${arch}, found: ${archs}" + structural_fail=1 + fi + + while IFS= read -r line; do + case "$line" in + *".a("*"):") + member="${line%:}" + in_build=0 + in_old=0 + ;; + *"LC_BUILD_VERSION"*) + in_build=1 + in_old=0 + ;; + *"LC_VERSION_MIN_MACOSX"*) + in_build=0 + in_old=1 + ;; + *" minos "*) + if [ "$in_build" -eq 1 ]; then + read -r _ minos _ <<< "$line" + if version_gt "$minos" "$target"; then + if [ "$reported" -lt "$max_member_errors" ]; then + echo "::${ann} file=${archive}::${member} requires macOS ${minos}, newer than archive target ${target}" + else + suppressed=$((suppressed + 1)) + fi + reported=$((reported + 1)) + target_fail=1 + fi + in_build=0 + fi + ;; + *" version "*) + if [ "$in_old" -eq 1 ]; then + read -r _ minos _ <<< "$line" + if version_gt "$minos" "$target"; then + if [ "$reported" -lt "$max_member_errors" ]; then + echo "::${ann} file=${archive}::${member} requires macOS ${minos}, newer than archive target ${target}" + else + suppressed=$((suppressed + 1)) + fi + reported=$((reported + 1)) + target_fail=1 + fi + in_old=0 + fi + ;; + esac + done < <(otool -arch "$arch" -l "$archive" 2>/dev/null || true) + + if [ "$suppressed" -gt 0 ]; then + echo "::${ann} file=${archive}::Suppressed ${suppressed} additional archive member deployment-target findings" + fi + + # 2 = structural problem (always fatal), 1 = deployment-target finding + # (respects --mode), 0 = clean. + if [ "$structural_fail" -ne 0 ]; then + return 2 + fi + if [ "$target_fail" -ne 0 ]; then + return 1 + fi + return 0 +} + +overall_structural=0 +overall_target=0 +for archive in "${archives[@]}"; do + rc=0 + check_archive "$archive" || rc=$? + case "$rc" in + 2) overall_structural=1 ;; + 1) overall_target=1 ;; + esac +done + +if [ "$overall_structural" -ne 0 ]; then + echo "::error::Static archive verification failed: missing archive or wrong architecture is always fatal." + exit 1 +fi + +if [ "$overall_target" -ne 0 ]; then + if [ "$mode" = "error" ]; then + exit 1 + fi + echo "::notice::Static archive verification reported deployment-target findings in warn mode; not failing the build." + exit 0 +fi + +echo "All checked static archives match arch ${arch} and target macOS ${target}." diff --git a/.github/workflows/build-linux.yml b/.github/workflows/build-linux.yml index 38b55845..10c44630 100644 --- a/.github/workflows/build-linux.yml +++ b/.github/workflows/build-linux.yml @@ -17,6 +17,16 @@ on: required: false type: string default: "x86_64" + release_channel: + description: "Build release channel: DEVEL, RC, or GA" + required: false + type: string + default: "DEVEL" + rc_number: + description: "Release candidate number when release_channel is RC" + required: false + type: string + default: "" jobs: build: @@ -33,7 +43,7 @@ jobs: qtbase5-dev qttools5-dev qtmultimedia5-dev libqt5serialport5-dev \ libqt5sql5-sqlite libqt5websockets5-dev \ libqt5multimedia5-plugins \ - libusb-1.0-0-dev libudev-dev libreadline-dev \ + libusb-1.0-0-dev libudev-dev libreadline-dev portaudio19-dev \ autoconf automake libtool pkg-config \ texinfo \ dpkg-dev fakeroot \ @@ -103,6 +113,8 @@ jobs: -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DWSJT_SKIP_MANPAGES=ON \ -DWSJT_BUILD_TESTS=ON \ + -DWSJT_RELEASE_CHANNEL="${{ inputs.release_channel }}" \ + -DWSJT_RC_NUMBER="${{ inputs.rc_number }}" \ -DPFUNIT_DIR="${{ steps.pfunit.outputs.dir }}" \ -Wno-dev @@ -158,6 +170,8 @@ jobs: ls -lh "$DEB" file "$DEB" dpkg-deb --info "$DEB" | head -20 + dpkg-deb -c "$DEB" | grep -qE '/usr/bin/map65$' + dpkg-deb -f "$DEB" Depends | grep -Eq 'libportaudio|portaudio' - name: Upload .deb uses: actions/upload-artifact@v7 @@ -189,6 +203,8 @@ jobs: # Confirm the core binaries are in the package. rpm -qpl "$RPM" | grep -qE '/bin/wsjtx$' rpm -qpl "$RPM" | grep -qE '/bin/jt9$' + rpm -qpl "$RPM" | grep -qE '/bin/map65$' + rpm -qpR "$RPM" | grep -Eq 'libportaudio|portaudio' - name: Upload RPM uses: actions/upload-artifact@v7 @@ -203,6 +219,7 @@ jobs: # linuxdeploy's desktop/icon integration needs these exact paths. test -x AppDir/usr/bin/wsjtx test -x AppDir/usr/bin/jt9 + test -x AppDir/usr/bin/map65 test -x AppDir/usr/bin/ft8code test -f AppDir/usr/share/applications/wsjtx.desktop test -f AppDir/usr/share/pixmaps/wsjtx_icon.png @@ -254,6 +271,7 @@ jobs: ./"$APPIMAGE" --appimage-extract >/dev/null test -x squashfs-root/usr/bin/wsjtx test -x squashfs-root/usr/bin/jt9 + test -x squashfs-root/usr/bin/map65 test -x squashfs-root/usr/bin/ft8code test -x squashfs-root/usr/bin/wsprd file squashfs-root/usr/bin/wsjtx | grep -q "ELF 64-bit" diff --git a/.github/workflows/build-macos.yml b/.github/workflows/build-macos.yml index 657af14e..295ab743 100644 --- a/.github/workflows/build-macos.yml +++ b/.github/workflows/build-macos.yml @@ -11,7 +11,7 @@ on: description: "Hamlib branch to build" required: false type: string - default: "4.7.0" + default: "4.7.1" arch: description: "Target architecture (arm64 or x86_64)" required: true @@ -24,6 +24,16 @@ on: description: "macOS deployment target version" required: true type: string + release_channel: + description: "Build release channel: DEVEL, RC, or GA" + required: false + type: string + default: "DEVEL" + rc_number: + description: "Release candidate number when release_channel is RC" + required: false + type: string + default: "" jobs: build: @@ -31,6 +41,28 @@ jobs: steps: - uses: actions/checkout@v6 + - name: Resolve source revision + id: source_revision + run: | + source_revision="${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || '' }}" + if [ -z "$source_revision" ]; then + source_revision="$(git rev-parse HEAD)" + fi + echo "sha=${source_revision}" >> "$GITHUB_OUTPUT" + + - name: Verify macOS build tuple + run: | + case "${{ inputs.arch }}:${{ inputs.runner }}:${{ inputs.deployment_target }}" in + arm64:macos-15:11.0|x86_64:macos-15-intel:10.13) + echo "Using supported macOS build tuple: ${{ inputs.arch }} on ${{ inputs.runner }} targeting ${{ inputs.deployment_target }}" + ;; + *) + echo "::error::Unsupported macOS build tuple: arch=${{ inputs.arch }}, runner=${{ inputs.runner }}, deployment_target=${{ inputs.deployment_target }}" + echo "::error::Use arm64:macos-15:11.0 or x86_64:macos-15-intel:10.13. Do not use macos-latest for release artifacts." + exit 1 + ;; + esac + - name: Check signing secrets id: check_secrets env: @@ -47,91 +79,285 @@ jobs: run: echo "HOMEBREW_PREFIX=$(brew --prefix)" >> "$GITHUB_ENV" - name: Install dependencies - run: brew install cmake gcc fftw boost qt@5 libusb dylibbundler autoconf automake libtool asciidoctor + run: brew install cmake autoconf automake libtool asciidoctor - - name: Locate gfortran - id: fc + - name: Compute Qt cache key + id: qt-key run: | - FC="$(brew --prefix gcc)/bin/gfortran" - [ -f "$FC" ] || FC="$(ls $HOMEBREW_PREFIX/bin/gfortran-* 2>/dev/null | sort -V | tail -1)" - echo "Found gfortran: $FC" - echo "path=$FC" >> "$GITHUB_OUTPUT" + .github/scripts/macos-qt-cache-key.sh \ + --arch "${{ inputs.arch }}" \ + --runner "${{ inputs.runner }}" \ + --deployment-target "${{ inputs.deployment_target }}" \ + --github-output + + - name: Restore Qt cache + id: qt-cache + uses: actions/cache/restore@v5 + with: + path: qt-prefix + key: ${{ steps.qt-key.outputs.key }} + fail-on-cache-miss: true - - name: Fix Qt5 keg-only paths + - name: Verify cached Qt deployment target run: | - QT5_PREFIX="$(brew --prefix qt@5)" - [ -e $HOMEBREW_PREFIX/mkspecs ] || sudo ln -s "${QT5_PREFIX}/mkspecs" $HOMEBREW_PREFIX/mkspecs - [ -e $HOMEBREW_PREFIX/plugins ] || sudo ln -s "${QT5_PREFIX}/plugins" $HOMEBREW_PREFIX/plugins - - - name: Cache pFUnit - id: pfunit-cache - uses: actions/cache@v5 - with: - path: pfunit-prefix - key: pfunit-macos-${{ inputs.arch }}-v4.9.0-${{ hashFiles('.github/workflows/build-macos.yml') }} + .github/scripts/verify-macos-artifacts.sh \ + --target "${{ inputs.deployment_target }}" \ + --arch "${{ inputs.arch }}" \ + --allow-prefix "${GITHUB_WORKSPACE}/qt-prefix" \ + "${GITHUB_WORKSPACE}/qt-prefix" + + - name: Install controlled ARM gfortran + id: controlled-arm-fc + if: inputs.arch == 'arm64' + run: | + .github/scripts/install-r-macos-gfortran.sh \ + --target "${{ inputs.deployment_target }}" \ + --arch "${{ inputs.arch }}" \ + --work-dir "${RUNNER_TEMP}/r-macos-gfortran" \ + --prefix "${GITHUB_WORKSPACE}/gfortran-prefix" \ + --github-output + + - name: Install controlled Intel gfortran + id: controlled-intel-fc + if: inputs.arch == 'x86_64' + run: | + .github/scripts/install-xpack-gfortran-macos.sh \ + --target "${{ inputs.deployment_target }}" \ + --arch "${{ inputs.arch }}" \ + --work-dir "${RUNNER_TEMP}/xpack-gfortran" \ + --prefix "${GITHUB_WORKSPACE}/gfortran-prefix" \ + --github-output + + - name: Select gfortran + id: fc + run: | + if [ "${{ inputs.arch }}" = "x86_64" ]; then + echo "Using controlled gfortran: ${{ steps.controlled-intel-fc.outputs.path }}" + { + echo "path=${{ steps.controlled-intel-fc.outputs.path }}" + echo "prefix=${{ steps.controlled-intel-fc.outputs.prefix }}" + echo "original_prefix=${{ steps.controlled-intel-fc.outputs.original_prefix }}" + echo "runtime_lib_dir=${{ steps.controlled-intel-fc.outputs.runtime_lib_dir }}" + echo "libgomp=${{ steps.controlled-intel-fc.outputs.libgomp }}" + echo "fortran_runtime_flags=${{ steps.controlled-intel-fc.outputs.fortran_runtime_flags }}" + echo "runtime_link_flags=${{ steps.controlled-intel-fc.outputs.runtime_link_flags }}" + echo "runtime_archives=${{ steps.controlled-intel-fc.outputs.runtime_archives }}" + echo "version=${{ steps.controlled-intel-fc.outputs.version }}" + echo "cache_key=${{ steps.controlled-intel-fc.outputs.cache_key }}" + } >> "$GITHUB_OUTPUT" + exit 0 + fi - - name: Build pFUnit - if: steps.pfunit-cache.outputs.cache-hit != 'true' + echo "Using controlled gfortran: ${{ steps.controlled-arm-fc.outputs.path }}" + { + echo "path=${{ steps.controlled-arm-fc.outputs.path }}" + echo "prefix=${{ steps.controlled-arm-fc.outputs.prefix }}" + echo "original_prefix=${{ steps.controlled-arm-fc.outputs.original_prefix }}" + echo "runtime_lib_dir=${{ steps.controlled-arm-fc.outputs.runtime_lib_dir }}" + echo "libgomp=${{ steps.controlled-arm-fc.outputs.libgomp }}" + echo "fortran_runtime_flags=${{ steps.controlled-arm-fc.outputs.fortran_runtime_flags }}" + echo "runtime_link_flags=${{ steps.controlled-arm-fc.outputs.runtime_link_flags }}" + echo "runtime_archives=${{ steps.controlled-arm-fc.outputs.runtime_archives }}" + echo "version=${{ steps.controlled-arm-fc.outputs.version }}" + echo "cache_key=${{ steps.controlled-arm-fc.outputs.cache_key }}" + } >> "$GITHUB_OUTPUT" + + - name: Verify static Fortran runtime deployment targets run: | - git clone --depth 1 --branch v4.9.0 --recursive \ - https://github.com/Goddard-Fortran-Ecosystem/pFUnit.git pfunit-src - cmake -S pfunit-src -B pfunit-build \ - -DSKIP_MPI=YES \ - -DSKIP_OPENMP=YES \ - -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ - -DCMAKE_Fortran_COMPILER="${{ steps.fc.outputs.path }}" \ - -DCMAKE_INSTALL_PREFIX="${GITHUB_WORKSPACE}/pfunit-prefix" - cmake --build pfunit-build -j$(sysctl -n hw.ncpu) - cmake --install pfunit-build + .github/scripts/verify-macos-static-archives.sh \ + --target "${{ inputs.deployment_target }}" \ + --arch "${{ inputs.arch }}" \ + --mode error \ + ${{ steps.fc.outputs.runtime_archives }} + + - name: Cache libusb + id: libusb-cache + uses: actions/cache/restore@v5 + with: + path: libusb-prefix + key: libusb-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.0.27-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-libusb-macos.sh') }} - - name: Locate pFUnit config - id: pfunit + - name: Build libusb + if: steps.libusb-cache.outputs.cache-hit != 'true' run: | - CONFIG=$(find "${GITHUB_WORKSPACE}/pfunit-prefix" -name PFUNITConfig.cmake | head -1) - if [ -z "$CONFIG" ]; then - echo "ERROR: PFUNITConfig.cmake not found under pfunit-prefix" - find "${GITHUB_WORKSPACE}/pfunit-prefix" -maxdepth 3 -type d - exit 1 - fi - PFUNIT_DIR="$(dirname "$CONFIG")" - echo "Found PFUNITConfig.cmake at: $CONFIG" - echo "dir=${PFUNIT_DIR}" >> "$GITHUB_OUTPUT" + .github/scripts/build-libusb-macos.sh \ + 1.0.27 \ + "${{ inputs.deployment_target }}" \ + "${GITHUB_WORKSPACE}/libusb-prefix" + + - name: Save libusb cache + if: steps.libusb-cache.outputs.cache-hit != 'true' + continue-on-error: true + uses: actions/cache/save@v5 + with: + path: libusb-prefix + key: libusb-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.0.27-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-libusb-macos.sh') }} - name: Cache Hamlib id: hamlib-cache - uses: actions/cache@v5 + uses: actions/cache/restore@v5 with: path: hamlib-prefix - key: hamlib-macos-${{ inputs.arch }}-${{ inputs.hamlib_branch }}-${{ hashFiles('.github/workflows/build-macos.yml') }} + key: hamlib-macos-${{ inputs.arch }}-${{ inputs.runner }}-${{ inputs.hamlib_branch }}-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-hamlib-macos.sh') }} - name: Build Hamlib if: steps.hamlib-cache.outputs.cache-hit != 'true' + env: + PKG_CONFIG_PATH: ${{ github.workspace }}/libusb-prefix/lib/pkgconfig + run: | + .github/scripts/build-hamlib-macos.sh \ + "${{ inputs.hamlib_branch }}" \ + "${{ inputs.deployment_target }}" \ + "${GITHUB_WORKSPACE}/hamlib-prefix" + + - name: Save Hamlib cache + if: steps.hamlib-cache.outputs.cache-hit != 'true' + continue-on-error: true + uses: actions/cache/save@v5 + with: + path: hamlib-prefix + key: hamlib-macos-${{ inputs.arch }}-${{ inputs.runner }}-${{ inputs.hamlib_branch }}-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-hamlib-macos.sh') }} + + - name: Cache PortAudio + id: portaudio-cache + uses: actions/cache/restore@v5 + with: + path: portaudio-prefix + key: portaudio-macos-${{ inputs.arch }}-${{ inputs.runner }}-19.7.0-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-portaudio-macos.sh') }} + + - name: Build PortAudio + if: steps.portaudio-cache.outputs.cache-hit != 'true' + run: | + .github/scripts/build-portaudio-macos.sh \ + 19.7.0 \ + "${{ inputs.deployment_target }}" \ + "${GITHUB_WORKSPACE}/portaudio-prefix" + + - name: Save PortAudio cache + if: steps.portaudio-cache.outputs.cache-hit != 'true' + continue-on-error: true + uses: actions/cache/save@v5 + with: + path: portaudio-prefix + key: portaudio-macos-${{ inputs.arch }}-${{ inputs.runner }}-19.7.0-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-portaudio-macos.sh') }} + + - name: Cache FFTW + id: fftw-cache + uses: actions/cache/restore@v5 + with: + path: fftw-prefix + key: fftw-macos-${{ inputs.arch }}-${{ inputs.runner }}-3.3.10-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-fftw-macos.sh') }} + + - name: Build FFTW + if: steps.fftw-cache.outputs.cache-hit != 'true' + run: | + .github/scripts/build-fftw-macos.sh \ + 3.3.10 \ + "${{ inputs.deployment_target }}" \ + "${GITHUB_WORKSPACE}/fftw-prefix" + + - name: Save FFTW cache + if: steps.fftw-cache.outputs.cache-hit != 'true' + continue-on-error: true + uses: actions/cache/save@v5 + with: + path: fftw-prefix + key: fftw-macos-${{ inputs.arch }}-${{ inputs.runner }}-3.3.10-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-fftw-macos.sh') }} + + - name: Cache Boost + id: boost-cache + uses: actions/cache/restore@v5 + with: + path: boost-prefix + key: boost-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.85.0-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-boost-macos.sh') }} + + - name: Build Boost + if: steps.boost-cache.outputs.cache-hit != 'true' run: | - git clone --depth 1 --branch "${{ inputs.hamlib_branch }}" \ - https://github.com/Hamlib/Hamlib.git hamlib-src - cd hamlib-src - ./bootstrap - ./configure \ - --prefix="${GITHUB_WORKSPACE}/hamlib-prefix" \ - --disable-shared --enable-static \ - --without-cxx-binding - make -j$(sysctl -n hw.ncpu) - make install + .github/scripts/build-boost-macos.sh \ + 1.85.0 \ + "${{ inputs.arch }}" \ + "${{ inputs.deployment_target }}" \ + "${GITHUB_WORKSPACE}/boost-prefix" + + - name: Save Boost cache + if: steps.boost-cache.outputs.cache-hit != 'true' + continue-on-error: true + uses: actions/cache/save@v5 + with: + path: boost-prefix + key: boost-macos-${{ inputs.arch }}-${{ inputs.runner }}-1.85.0-min${{ inputs.deployment_target }}-${{ hashFiles('.github/scripts/build-boost-macos.sh') }} - name: Configure + env: + PKG_CONFIG_PATH: ${{ github.workspace }}/qt-prefix/lib/pkgconfig:${{ github.workspace }}/boost-prefix/lib/pkgconfig:${{ github.workspace }}/fftw-prefix/lib/pkgconfig:${{ github.workspace }}/libusb-prefix/lib/pkgconfig:${{ github.workspace }}/portaudio-prefix/lib/pkgconfig:${{ github.workspace }}/hamlib-prefix/lib/pkgconfig run: | cmake -S . -B wsjtx-build \ - -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/hamlib-prefix;${GITHUB_WORKSPACE}/pfunit-prefix;$(brew --prefix qt@5);$(brew --prefix libusb);$(brew --prefix fftw);$(brew --prefix boost)" \ + -DCMAKE_PREFIX_PATH="${GITHUB_WORKSPACE}/qt-prefix;${GITHUB_WORKSPACE}/boost-prefix;${GITHUB_WORKSPACE}/fftw-prefix;${GITHUB_WORKSPACE}/libusb-prefix;${GITHUB_WORKSPACE}/portaudio-prefix;${GITHUB_WORKSPACE}/hamlib-prefix" \ -DCMAKE_Fortran_COMPILER="${{ steps.fc.outputs.path }}" \ + -DCMAKE_Fortran_FLAGS="${{ steps.fc.outputs.fortran_runtime_flags }}" \ -DCMAKE_OSX_DEPLOYMENT_TARGET=${{ inputs.deployment_target }} \ + -DCMAKE_EXE_LINKER_FLAGS="-Wl,-headerpad_max_install_names ${{ steps.fc.outputs.runtime_link_flags }}" \ + -DWSJT_MACOS_LIBGOMP_LIBRARY="${{ steps.fc.outputs.libgomp }}" \ + -DWSJT_SOURCE_REVISION="${{ steps.source_revision.outputs.sha }}" \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DWSJT_SKIP_MANPAGES=ON \ + -DWSJT_SKIP_BUNDLE_FIXUP=ON \ -DWSJT_BUILD_TESTS=ON \ - -DPFUNIT_DIR="${{ steps.pfunit.outputs.dir }}" \ + -DWSJT_RELEASE_CHANNEL="${{ inputs.release_channel }}" \ + -DWSJT_RC_NUMBER="${{ inputs.rc_number }}" \ -Wno-dev + - name: Verify resolved dependency prefixes + run: | + CACHE=wsjtx-build/CMakeCache.txt + BAD=$(awk -F= ' + /^(Boost_DIR|Boost_INCLUDE_DIR|Boost_LOG_LIBRARY_RELEASE|Boost_LOG_SETUP_LIBRARY_RELEASE|FFTW3F_LIBRARY|FFTW3F_THREADS_LIBRARY|FFTW3_INCLUDE_DIR|Hamlib_INCLUDE_DIR|Hamlib_LIBRARY|Portaudio_INCLUDE_DIR|Portaudio_LIBRARY|Usb_INCLUDE_DIR|Usb_LIBRARY|Qt5[^:]*_DIR|Qt5[^:]*_EXECUTABLE):/ && $2 ~ /^(\/opt\/homebrew|\/usr\/local\/Cellar|\/usr\/local\/opt|\/opt\/local)/ { + print + } + ' "$CACHE") + if [ -n "$BAD" ]; then + echo "::error::Deployable macOS build resolved bundled dependencies from a package-manager prefix:" + echo "$BAD" + exit 1 + fi + + QT_BAD=$(awk -F= -v prefix="${GITHUB_WORKSPACE}/qt-prefix" ' + /^Qt5[^:]*_(DIR|EXECUTABLE):/ && index($2, prefix) != 1 { + print + } + ' "$CACHE") + if [ -n "$QT_BAD" ]; then + echo "::error::Deployable macOS build did not resolve Qt from the cached qt-prefix:" + echo "$QT_BAD" + exit 1 + fi + + - name: Verify built dependency deployment targets + run: | + .github/scripts/verify-macos-artifacts.sh \ + --target "${{ inputs.deployment_target }}" \ + --arch "${{ inputs.arch }}" \ + --allow-prefix "${GITHUB_WORKSPACE}/boost-prefix" \ + --allow-prefix "${GITHUB_WORKSPACE}/fftw-prefix" \ + --allow-prefix "${GITHUB_WORKSPACE}/libusb-prefix" \ + --allow-prefix "${GITHUB_WORKSPACE}/portaudio-prefix" \ + "${GITHUB_WORKSPACE}/boost-prefix" \ + "${GITHUB_WORKSPACE}/fftw-prefix" \ + "${GITHUB_WORKSPACE}/libusb-prefix" \ + "${GITHUB_WORKSPACE}/portaudio-prefix" + + - name: Verify Hamlib static archive deployment targets + run: | + hamlib_archives=( "${GITHUB_WORKSPACE}/hamlib-prefix/lib/"*.a ) + .github/scripts/verify-macos-static-archives.sh \ + --target "${{ inputs.deployment_target }}" \ + --arch "${{ inputs.arch }}" \ + --mode error \ + "${hamlib_archives[@]}" + - name: Build - run: cmake --build wsjtx-build -j$(sysctl -n hw.ncpu) + run: cmake --build wsjtx-build -j"$(sysctl -n hw.ncpu)" - name: Run tests id: ctest @@ -145,6 +371,7 @@ jobs: - name: Upload test results if: always() && steps.ctest.conclusion != 'skipped' + continue-on-error: true uses: actions/upload-artifact@v7 with: name: ctest-results-macos-${{ inputs.arch }} @@ -156,81 +383,239 @@ jobs: file wsjtx-build/jt9 lipo -archs wsjtx-build/jt9 | grep -q ${{ inputs.arch }} - - name: Collect binaries + - name: Install app bundle and collect CLI assets id: collect run: | BUILD=wsjtx-build STAGE=stage/wsjtx-${{ inputs.version }}-${{ inputs.arch }} ASSETS=assets - mkdir -p "${STAGE}" "${ASSETS}" - - cp -R "${BUILD}/wsjtx.app" "${STAGE}/" + mkdir -p "${ASSETS}" + cmake --install "${BUILD}" --prefix "${STAGE}" - for bin in jt9 wsprd; do - [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${STAGE}/wsjtx.app/Contents/MacOS/" - done + APP="${STAGE}/wsjtx.app" + if [ ! -d "${APP}" ]; then + echo "::error::CMake install did not create ${APP}" + exit 1 + fi + if [ ! -x "${APP}/Contents/MacOS/map65" ]; then + echo "::error::CMake install did not create executable MAP65 companion app binary at ${APP}/Contents/MacOS/map65" + exit 1 + fi for bin in jt9 wsprd wsprcode jt65code jt4code ft8code q65code encode77 fcal hash22calc; do - [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${STAGE}/" && cp "${BUILD}/${bin}" "${ASSETS}/" + [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${ASSETS}/" done for bin in ft4sim jt4sim jt65sim cwsim sfoxsim echosim EchoCallSim; do - [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${STAGE}/" && cp "${BUILD}/${bin}" "${ASSETS}/" + [ -f "${BUILD}/${bin}" ] && cp "${BUILD}/${bin}" "${ASSETS}/" done echo "stage_dir=${STAGE}" >> "$GITHUB_OUTPUT" echo "assets_dir=${ASSETS}" >> "$GITHUB_OUTPUT" + - name: Verify CMake-installed app resources + run: | + APP="${{ steps.collect.outputs.stage_dir }}/wsjtx.app" + DATADIR="${APP}/Contents/Resources/wsjtx" + DOCDIR="${APP}/Contents/Resources/doc/wsjtx" + SOUNDDIR="${APP}/Contents/Resources/sounds" + + for file in cty.dat cty.dat_copyright.txt grid.dat sat.dat eclipse.txt ALLCALL7.TXT JPLEPH; do + if [ ! -f "${DATADIR}/${file}" ]; then + echo "::error::Expected CMake-installed data file is missing: ${DATADIR}/${file}" + exit 1 + fi + done + + set -- "${DOCDIR}/wsjtx-main"*.html + if [ "$#" -lt 1 ] || [ ! -f "$1" ]; then + echo "::error::Expected at least one CMake-installed local user guide in ${DOCDIR}" + printf 'Matched paths:\n' + printf ' %s\n' "$@" + exit 1 + fi + + if [ ! -f "${SOUNDDIR}/Wanted.wav" ]; then + echo "::error::Expected CMake-installed alert sound is missing: ${SOUNDDIR}/Wanted.wav" + exit 1 + fi + if [ ! -x "${APP}/Contents/MacOS/map65" ]; then + echo "::error::Expected CMake-installed MAP65 binary is missing: ${APP}/Contents/MacOS/map65" + exit 1 + fi + + if [ -e "${APP}/Contents/MacOS/sounds" ]; then + echo "::error::Alert sounds must not be installed under Contents/MacOS; codesign treats them as unsigned code." + exit 1 + fi + + echo "Verified CMake-installed data files in ${DATADIR}" + echo "Verified CMake-installed local user guides:" + printf ' %s\n' "$@" + echo "Verified CMake-installed alert sounds in ${SOUNDDIR}" + - name: Bundle dylibs into app run: | + set -Eeuo pipefail STAGE="${{ steps.collect.outputs.stage_dir }}" APP="${STAGE}/wsjtx.app" FRAMEWORKS="${APP}/Contents/Frameworks" - GCC_LIB="$(brew --prefix gcc)/lib/gcc/current" + FORTRAN_PREFIX="${{ steps.fc.outputs.prefix }}" + FORTRAN_ORIGINAL_PREFIX="${{ steps.fc.outputs.original_prefix }}" + GCC_LIB="${{ steps.fc.outputs.runtime_lib_dir }}" mkdir -p "${FRAMEWORKS}" - "$(brew --prefix qt@5)/bin/macdeployqt" "${APP}" -verbose=1 + dump_bundle_context() { + local status="$1" + local line="$2" + local command="$3" + echo "::error::Bundle dylibs into app failed at line ${line} with status ${status}: ${command}" + echo "APP=${APP}" + echo "FRAMEWORKS=${FRAMEWORKS}" + echo "FORTRAN_PREFIX=${FORTRAN_PREFIX}" + echo "FORTRAN_ORIGINAL_PREFIX=${FORTRAN_ORIGINAL_PREFIX}" + echo "GCC_LIB=${GCC_LIB}" + echo "HOMEBREW_PREFIX=${HOMEBREW_PREFIX}" + echo "App executable contents:" + ls -la "${APP}/Contents/MacOS" || true + echo "Framework contents:" + ls -la "${FRAMEWORKS}" || true + echo "External references in app executables:" + find "${APP}/Contents/MacOS" -type f -perm +111 -print -exec otool -L {} \; 2>/dev/null || true + if [ -f macdeployqt.log ]; then + echo "macdeployqt.log:" + cat macdeployqt.log + fi + } + trap 'status=$?; dump_bundle_context "$status" "$LINENO" "$BASH_COMMAND"; exit "$status"' ERR + + run_logged() { + echo "+ $*" + "$@" + } + + echo "Running macdeployqt..." + set +e + "${GITHUB_WORKSPACE}/qt-prefix/bin/macdeployqt" "${APP}" -verbose=2 > macdeployqt.log 2>&1 + status=$? + set -e + if [ "$status" -ne 0 ]; then + echo "::error::macdeployqt failed with status ${status}" + dump_bundle_context "$status" "$LINENO" "macdeployqt" + exit "$status" + fi + cat macdeployqt.log resolve_lib() { local lib="$1" + if [ -n "$FORTRAN_ORIGINAL_PREFIX" ] && [[ "$lib" == "$FORTRAN_ORIGINAL_PREFIX"/* ]]; then + local original_prefix="${FORTRAN_ORIGINAL_PREFIX}/" + local relocated="${FORTRAN_PREFIX}/${lib:${#original_prefix}}" + [ -f "$relocated" ] && echo "$relocated" && return 0 + fi if [[ "$lib" == $HOMEBREW_PREFIX/* ]]; then echo "$lib" + return 0 + elif [[ "$lib" == $GITHUB_WORKSPACE/* ]]; then + echo "$lib" + return 0 elif [[ "$lib" == @rpath/* ]]; then local name="${lib#@rpath/}" - for dir in "$GCC_LIB" "$HOMEBREW_PREFIX/lib"; do + for dir in \ + "$FRAMEWORKS" \ + "$GITHUB_WORKSPACE/boost-prefix/lib" \ + "$GITHUB_WORKSPACE/fftw-prefix/lib" \ + "$GITHUB_WORKSPACE/libusb-prefix/lib" \ + "$GITHUB_WORKSPACE/portaudio-prefix/lib" \ + "$FORTRAN_PREFIX/lib" \ + "$GCC_LIB" \ + "$HOMEBREW_PREFIX/lib" + do [ -f "$dir/$name" ] && echo "$dir/$name" && return done fi + return 0 + } + + should_bundle_ref() { + local ref="$1" + case "$ref" in + *Qt*.framework/*) + return 1 + ;; + "$FORTRAN_ORIGINAL_PREFIX"/*|"$HOMEBREW_PREFIX"/*|"$GITHUB_WORKSPACE"/*|@rpath/*) + return 0 + ;; + *) + return 1 + ;; + esac } bundle_dylib() { local binary="$1" - for lib in $(otool -L "$binary" | awk '{print $1}' | grep -E "($HOMEBREW_PREFIX|@rpath)" | grep -v Qt); do + local lib + while IFS= read -r lib; do + should_bundle_ref "$lib" || continue local resolved resolved=$(resolve_lib "$lib") - [ -z "$resolved" ] && continue - local libname=$(basename "$resolved") + if [ -z "$resolved" ]; then + echo "::error::Could not resolve ${lib} required by ${binary}" + exit 1 + fi + local libname + libname=$(basename "$resolved") + case "$libname" in + libgomp*.dylib) + echo "::error::Refusing to bundle ${resolved}; libgomp must be linked statically for deployable macOS artifacts." + exit 1 + ;; + esac if [ ! -f "${FRAMEWORKS}/${libname}" ]; then echo " Bundling: $resolved -> ${FRAMEWORKS}/${libname}" - cp "$resolved" "${FRAMEWORKS}/${libname}" - chmod 644 "${FRAMEWORKS}/${libname}" - install_name_tool -id "@executable_path/../Frameworks/${libname}" "${FRAMEWORKS}/${libname}" + run_logged cp "$resolved" "${FRAMEWORKS}/${libname}" + run_logged chmod 644 "${FRAMEWORKS}/${libname}" + run_logged install_name_tool -id "@rpath/${libname}" "${FRAMEWORKS}/${libname}" bundle_dylib "${FRAMEWORKS}/${libname}" fi - install_name_tool -change "$lib" "@executable_path/../Frameworks/${libname}" "$binary" 2>/dev/null || true - done + if [ "$lib" != "@rpath/${libname}" ]; then + run_logged install_name_tool -change "$lib" "@rpath/${libname}" "$binary" + fi + done < <(otool -L "$binary" | awk 'NR > 1 {print $1}' || true) + } + + ensure_app_rpath() { + local binary="$1" + local rpath + + while IFS= read -r rpath; do + [ -n "$rpath" ] || continue + case "$rpath" in + "$GITHUB_WORKSPACE"/*|"$HOMEBREW_PREFIX"/*) + run_logged install_name_tool -delete_rpath "$rpath" "$binary" + ;; + esac + done < <(otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' || true) + + if ! otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' | grep -Fxq "@executable_path/../Frameworks"; then + run_logged install_name_tool -add_rpath "@executable_path/../Frameworks" "$binary" + fi } for exe in "${APP}/Contents/MacOS/"*; do [ -f "$exe" ] && [ -x "$exe" ] && { + ensure_app_rpath "$exe" bundle_dylib "$exe" - for fw in $(otool -L "$exe" | awk '{print $1}' | grep '\.framework/'); do + for fw in $(otool -L "$exe" | awk '{print $1}' | grep '\.framework/' || true); do fwname=$(basename "$fw") bundled=$(find "${FRAMEWORKS}" -name "${fwname}" -path "*.framework/*" 2>/dev/null | head -1) if [ -n "$bundled" ]; then - fwrel="${bundled#${APP}/Contents/}" - install_name_tool -change "$fw" "@executable_path/../${fwrel}" "$exe" 2>/dev/null || true + app_contents="${APP}/Contents/" + fwrel="${bundled:${#app_contents}}" + if [ "$fw" != "@executable_path/../${fwrel}" ]; then + run_logged install_name_tool -change "$fw" "@executable_path/../${fwrel}" "$exe" + fi fi done } @@ -240,59 +625,225 @@ jobs: [ -f "$fw" ] && bundle_dylib "$fw" done + for exe in "${APP}/Contents/MacOS/"*; do + [ -f "$exe" ] && [ -x "$exe" ] && bundle_dylib "$exe" + done + echo "Checking for remaining external references..." - REMAINING=$(find "${APP}/Contents/MacOS" -type f -perm +111 -exec otool -L {} \; 2>/dev/null | grep "$HOMEBREW_PREFIX" || true) - if [ -n "$REMAINING" ]; then - echo "WARNING: External paths still present:" - echo "$REMAINING" + remaining_refs="${RUNNER_TEMP:-/tmp}/wsjtx-app-remaining-refs.txt" + : > "$remaining_refs" + while IFS= read -r binary; do + while IFS= read -r ref; do + case "$ref" in + "$FORTRAN_ORIGINAL_PREFIX"/*|"$HOMEBREW_PREFIX"/*|"$GITHUB_WORKSPACE"/*) + echo "${binary}: ${ref}" >> "$remaining_refs" + ;; + esac + done < <(otool -L "$binary" | awk 'NR > 1 {print $1}' || true) + done < <(find "${APP}/Contents/MacOS" -type f -perm +111 -print 2>/dev/null) + if [ -s "$remaining_refs" ]; then + echo "::error::External build-time paths still present:" + cat "$remaining_refs" + exit 1 else echo "All dylibs bundled successfully" fi - name: Bundle dylibs into CLI tools run: | + set -Eeuo pipefail ASSETS="${{ steps.collect.outputs.assets_dir }}" STAGE="${{ steps.collect.outputs.stage_dir }}" LIBDIR="${ASSETS}/lib" + FORTRAN_PREFIX="${{ steps.fc.outputs.prefix }}" + FORTRAN_ORIGINAL_PREFIX="${{ steps.fc.outputs.original_prefix }}" + GCC_LIB="${{ steps.fc.outputs.runtime_lib_dir }}" mkdir -p "${LIBDIR}" - BUNDLE_ARGS="" - for bin in "${ASSETS}"/*; do - [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] && { - BUNDLE_ARGS="$BUNDLE_ARGS -x $bin" - } - done - dylibbundler -od -b $BUNDLE_ARGS -d "${LIBDIR}/" -p @loader_path/lib/ + dump_cli_context() { + local status="$1" + local line="$2" + local command="$3" + echo "::error::Bundle dylibs into CLI tools failed at line ${line} with status ${status}: ${command}" + echo "ASSETS=${ASSETS}" + echo "LIBDIR=${LIBDIR}" + echo "FORTRAN_PREFIX=${FORTRAN_PREFIX}" + echo "FORTRAN_ORIGINAL_PREFIX=${FORTRAN_ORIGINAL_PREFIX}" + echo "GCC_LIB=${GCC_LIB}" + echo "HOMEBREW_PREFIX=${HOMEBREW_PREFIX}" + echo "Asset contents:" + ls -la "${ASSETS}" || true + echo "Library contents:" + ls -la "${LIBDIR}" || true + echo "External references in CLI assets:" + for bin in "${ASSETS}"/*; do + [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] || continue + echo "== $bin ==" + otool -L "$bin" || true + done + } + trap 'status=$?; dump_cli_context "$status" "$LINENO" "$BASH_COMMAND"; exit "$status"' ERR + + run_logged() { + echo "+ $*" + "$@" + } + + resolve_cli_ref() { + local ref="$1" + local name="" suffix="" + + if [ -n "$FORTRAN_ORIGINAL_PREFIX" ] && [[ "$ref" == "$FORTRAN_ORIGINAL_PREFIX"/* ]]; then + local original_prefix="${FORTRAN_ORIGINAL_PREFIX}/" + local relocated="${FORTRAN_PREFIX}/${ref:${#original_prefix}}" + [ -f "$relocated" ] && echo "$relocated" + return 0 + fi + + case "$ref" in + /usr/lib/*|/System/Library/*) + return 0 + ;; + @loader_path/lib/*) + name="${ref#@loader_path/lib/}" + [ -f "${LIBDIR}/${name}" ] && echo "${LIBDIR}/${name}" + return 0 + ;; + @loader_path/*) + name="${ref#@loader_path/}" + [ -f "${LIBDIR}/${name}" ] && echo "${LIBDIR}/${name}" + return 0 + ;; + "$GITHUB_WORKSPACE"/*|"$HOMEBREW_PREFIX"/*) + echo "$ref" + return 0 + ;; + esac + + if [[ "$ref" == @rpath/* ]]; then + suffix="${ref#@rpath/}" + if [[ "$suffix" == *.framework/* ]]; then + for dir in \ + "${STAGE}/wsjtx.app/Contents/Frameworks" \ + "${GITHUB_WORKSPACE}/qt-prefix/lib" + do + [ -f "${dir}/${suffix}" ] && echo "${dir}/${suffix}" && return 0 + done + else + name="${suffix}" + for dir in \ + "${LIBDIR}" \ + "${STAGE}/wsjtx.app/Contents/Frameworks" \ + "${GITHUB_WORKSPACE}/boost-prefix/lib" \ + "${GITHUB_WORKSPACE}/fftw-prefix/lib" \ + "${GITHUB_WORKSPACE}/libusb-prefix/lib" \ + "${GITHUB_WORKSPACE}/portaudio-prefix/lib" \ + "${FORTRAN_PREFIX}/lib" \ + "${GCC_LIB}" \ + "${HOMEBREW_PREFIX}/lib" + do + [ -f "${dir}/${name}" ] && echo "${dir}/${name}" && return 0 + done + fi + fi + + return 0 + } + + bundle_cli_deps() { + local binary="$1" + local change_prefix="$2" + local ref resolved out name target + + while IFS= read -r ref; do + resolved=$(resolve_cli_ref "$ref") + if [ -z "$resolved" ]; then + case "$ref" in + @rpath/*|@loader_path/*|"$GITHUB_WORKSPACE"/*|"$HOMEBREW_PREFIX"/*) + echo "::error::Could not resolve ${ref} required by ${binary}" + exit 1 + ;; + *) + continue + ;; + esac + fi + + name="$(basename "$resolved")" + case "$name" in + libgomp*.dylib) + echo "::error::Refusing to bundle ${resolved}; libgomp must be linked statically for deployable macOS artifacts." + exit 1 + ;; + esac + + out="${LIBDIR}/${name}" + if [ ! -f "$out" ]; then + echo " Bundling: ${resolved} -> ${out}" + run_logged cp "$resolved" "$out" + run_logged chmod 644 "$out" + run_logged install_name_tool -id "@rpath/${name}" "$out" + bundle_cli_deps "$out" "@rpath" + fi + + target="${change_prefix}/${name}" + if [ "$ref" != "$target" ]; then + run_logged install_name_tool -change "$ref" "$target" "$binary" + fi + done < <(otool -L "$binary" | awk 'NR > 1 {print $1}' | grep -E "($HOMEBREW_PREFIX|$GITHUB_WORKSPACE|@rpath|@loader_path)" || true) + } + + ensure_cli_rpath() { + local binary="$1" + local rpath + local bad_rpaths=() + local unique_bad_rpaths=() + + while IFS= read -r rpath; do + [ -n "$rpath" ] || continue + case "$rpath" in + "$GITHUB_WORKSPACE"/*|"$HOMEBREW_PREFIX"/*) + bad_rpaths+=("$rpath") + ;; + esac + done < <(otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' || true) + + # Deduplicate bad rpaths (compatible with macOS Bash 3.2) + if [ "${#bad_rpaths[@]}" -gt 0 ]; then + for rpath in "${bad_rpaths[@]}"; do + local found=0 + local u + if [ "${#unique_bad_rpaths[@]}" -gt 0 ]; then + for u in "${unique_bad_rpaths[@]}"; do + [ "$u" = "$rpath" ] && found=1 && break + done + fi + [ "$found" -eq 0 ] && unique_bad_rpaths+=("$rpath") + done + fi + + if [ "${#unique_bad_rpaths[@]}" -gt 0 ]; then + for rpath in "${unique_bad_rpaths[@]}"; do + run_logged install_name_tool -delete_rpath "$rpath" "$binary" + done + fi + + if ! otool -l "$binary" | awk '/LC_RPATH/{getline; getline; print $2}' | grep -Fxq "@loader_path/lib"; then + run_logged install_name_tool -add_rpath "@loader_path/lib" "$binary" + fi + } - QT5="$(brew --prefix qt@5)/lib" for bin in "${ASSETS}"/*; do [ -f "$bin" ] && [ -x "$bin" ] && [ "$(basename "$bin")" != "lib" ] || continue - for fw in $(otool -L "$bin" | awk '{print $1}' | grep '\.framework/'); do - fwname=$(basename "$fw") - if [ ! -f "${LIBDIR}/${fwname}" ]; then - echo " Bundling framework: ${fwname}" - cp "$fw" "${LIBDIR}/${fwname}" - chmod 644 "${LIBDIR}/${fwname}" - install_name_tool -id "@loader_path/lib/${fwname}" "${LIBDIR}/${fwname}" - dylibbundler -b -x "${LIBDIR}/${fwname}" -d "${LIBDIR}/" -p @loader_path/ 2>/dev/null || true - fi - install_name_tool -change "$fw" "@loader_path/lib/${fwname}" "$bin" - codesign --force --sign - "$bin" - done + ensure_cli_rpath "$bin" + bundle_cli_deps "$bin" "@rpath" + run_logged codesign --force --sign - "$bin" done for lib in "${LIBDIR}"/*; do [ -f "$lib" ] || continue - for dep in $(otool -L "$lib" | awk '{print $1}' | grep '@loader_path/lib/'); do - depname=$(basename "$dep") - install_name_tool -change "$dep" "@loader_path/${depname}" "$lib" 2>/dev/null || true - done - RPATHS=$(otool -l "$lib" | grep -A2 LC_RPATH | grep "path " | awk '{print $2}' | sort | uniq -d) - for rp in $RPATHS; do - install_name_tool -delete_rpath "$rp" "$lib" 2>/dev/null || true - install_name_tool -add_rpath "$rp" "$lib" 2>/dev/null || true - done - codesign --force --sign - "$lib" + bundle_cli_deps "$lib" "@rpath" + run_logged codesign --force --sign - "$lib" done echo "Verifying CLI tools..." @@ -315,6 +866,14 @@ jobs: } done + - name: Verify bundled macOS deployment targets + run: | + STAGE="${{ steps.collect.outputs.stage_dir }}" + .github/scripts/verify-macos-artifacts.sh \ + --target "${{ inputs.deployment_target }}" \ + --arch "${{ inputs.arch }}" \ + "$STAGE" + - name: Import signing certificates if: steps.check_secrets.outputs.signing_enabled == 'true' env: @@ -385,11 +944,13 @@ jobs: # introduced as a workaround for the empty-plist parser bug.) find "${APP}/Contents/Frameworks" -type f \( -name "*.dylib" -o -perm +111 \) \ -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; - find "${APP}/Contents/Frameworks" -name "*.framework" -type d | while read fw; do + find "${APP}/Contents/Frameworks" -name "*.framework" -type d | while read -r fw; do codesign --force --options runtime $TS --sign "$IDENTITY" "$fw" done - find "${APP}/Contents/PlugIns" -type f -name "*.dylib" \ - -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; 2>/dev/null || true + if [ -d "${APP}/Contents/PlugIns" ]; then + find "${APP}/Contents/PlugIns" -type f -name "*.dylib" \ + -exec codesign --force --options runtime $TS --sign "$IDENTITY" {} \; + fi find "${APP}/Contents/MacOS" -type f -perm +111 \ -exec codesign --force --options runtime --entitlements "$ENTITLEMENTS" $TS --sign "$IDENTITY" {} \; @@ -430,7 +991,7 @@ jobs: # cert when secrets are present; produces an unsigned .pkg # otherwise. Either way the artifact is named identically and # satisfies the all-platforms-ready gate in release.yml. - - name: Build installer pkg + - name: Build and verify installer pkg run: | STAGE="${{ steps.collect.outputs.stage_dir }}" PKG_ID="org.k1jt.wsjtx.${{ inputs.arch }}" @@ -463,6 +1024,8 @@ jobs: pkgbuild --analyze --root "${PAYLOAD}" "$RUNNER_TEMP/components.plist" /usr/libexec/PlistBuddy -c "Set :0:BundleIsRelocatable false" "$RUNNER_TEMP/components.plist" 2>/dev/null || true + /usr/libexec/PlistBuddy -c "Set :0:BundleIsVersionChecked false" "$RUNNER_TEMP/components.plist" 2>/dev/null || true + /usr/libexec/PlistBuddy -c "Set :0:BundleOverwriteAction upgrade" "$RUNNER_TEMP/components.plist" 2>/dev/null || true pkgbuild \ --root "${PAYLOAD}" \ @@ -486,6 +1049,51 @@ jobs: "$PKG_OUT" fi + CHECK_PAYLOAD="$RUNNER_TEMP/pkg-check" + rm -rf "$CHECK_PAYLOAD" + pkgutil --expand-full "$PKG_OUT" "$CHECK_PAYLOAD" + [ "$(/usr/libexec/PlistBuddy -c "Print :0:BundleIsRelocatable" "$RUNNER_TEMP/components.plist")" = "false" ] + [ "$(/usr/libexec/PlistBuddy -c "Print :0:BundleIsVersionChecked" "$RUNNER_TEMP/components.plist")" = "false" ] + [ "$(/usr/libexec/PlistBuddy -c "Print :0:BundleOverwriteAction" "$RUNNER_TEMP/components.plist")" = "upgrade" ] + + APP_PAYLOAD="$CHECK_PAYLOAD/wsjtx-component.pkg/Payload/Applications/wsjtx.app" + DATADIR="${APP_PAYLOAD}/Contents/Resources/wsjtx" + DOCDIR="${APP_PAYLOAD}/Contents/Resources/doc/wsjtx" + SOUNDDIR="${APP_PAYLOAD}/Contents/Resources/sounds" + + for file in cty.dat cty.dat_copyright.txt grid.dat sat.dat eclipse.txt ALLCALL7.TXT JPLEPH; do + if [ ! -f "${DATADIR}/${file}" ]; then + echo "::error::Expected packaged data file is missing: ${DATADIR}/${file}" + exit 1 + fi + done + + set -- "${DOCDIR}/wsjtx-main"*.html + if [ "$#" -lt 1 ] || [ ! -f "$1" ]; then + echo "::error::Expected at least one local user guide in the packaged app bundle." + printf 'Matched paths:\n' + printf ' %s\n' "$@" + exit 1 + fi + + if [ ! -f "${SOUNDDIR}/Wanted.wav" ]; then + echo "::error::Expected packaged alert sound is missing: ${SOUNDDIR}/Wanted.wav" + exit 1 + fi + if [ ! -x "${APP_PAYLOAD}/Contents/MacOS/map65" ]; then + echo "::error::Expected packaged MAP65 binary is missing: ${APP_PAYLOAD}/Contents/MacOS/map65" + exit 1 + fi + + if [ -e "${APP_PAYLOAD}/Contents/MacOS/sounds" ]; then + echo "::error::Packaged alert sounds must not be under Contents/MacOS." + exit 1 + fi + + echo "Verified packaged local user guides:" + printf ' %s\n' "$@" + echo "Verified packaged alert sounds in ${SOUNDDIR}" + - name: Notarize pkg if: steps.check_secrets.outputs.signing_enabled == 'true' env: diff --git a/.github/workflows/build-windows.yml b/.github/workflows/build-windows.yml index fd0f14a5..1d6f8ec9 100644 --- a/.github/workflows/build-windows.yml +++ b/.github/workflows/build-windows.yml @@ -12,6 +12,16 @@ on: required: false type: string default: "4.7.0" + release_channel: + description: "Build release channel: DEVEL, RC, or GA" + required: false + type: string + default: "DEVEL" + rc_number: + description: "Release candidate number when release_channel is RC" + required: false + type: string + default: "" jobs: build: @@ -160,11 +170,12 @@ jobs: cmake -G "MSYS Makefiles" -S . -B wsjtx-build \ -DCMAKE_PREFIX_PATH="${WORKSPACE}/hamlib-prefix" \ -DOMNIRIG_TYPE_LIB="${OMNIRIG}" \ - -DWSJT_SKIP_MAP65=ON \ -DCMAKE_Fortran_FLAGS="-fallow-argument-mismatch -std=legacy" \ -DCMAKE_POLICY_VERSION_MINIMUM=3.5 \ -DWSJT_SKIP_MANPAGES=ON \ -DWSJT_BUILD_TESTS=ON \ + -DWSJT_RELEASE_CHANNEL="${{ inputs.release_channel }}" \ + -DWSJT_RC_NUMBER="${{ inputs.rc_number }}" \ -DPFUNIT_DIR="${{ steps.pfunit.outputs.pfunit_dir }}" \ -DGFTL_DIR="${{ steps.pfunit.outputs.gftl_dir }}" \ -DGFTL_SHARED_DIR="${{ steps.pfunit.outputs.gftl_shared_dir }}" \ @@ -195,6 +206,27 @@ jobs: - name: Verify binary run: | file wsjtx-build/jt9.exe + test -x wsjtx-build/map65/map65.exe + + - name: Stage install + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + cmake --install wsjtx-build --prefix "${WORKSPACE}/stage-main" + ls -la "${WORKSPACE}/stage-main/bin" + + - name: Audit staged runtime DLL imports + run: | + WORKSPACE=$(cygpath "${GITHUB_WORKSPACE}") + test -f "${WORKSPACE}/stage-main/bin/map65.exe" + test -f "${WORKSPACE}/stage-main/bin/qmap.exe" + test -f "${WORKSPACE}/stage-main/bin/wsjtx.exe" + test -f "${WORKSPACE}/stage-main/bin/jt9.exe" + bash .github/scripts/audit-staged-dll-imports-windows.sh \ + "${WORKSPACE}/stage-main/bin" \ + "${WORKSPACE}/stage-main/bin/map65.exe" \ + "${WORKSPACE}/stage-main/bin/qmap.exe" \ + "${WORKSPACE}/stage-main/bin/wsjtx.exe" \ + "${WORKSPACE}/stage-main/bin/jt9.exe" # Emit an NSIS installer containing the full CLI tool set # (wsjtx.exe, jt9, wsprd, fmtave, fcal, fmeasure + WSJT_BUILD_UTILS @@ -218,6 +250,7 @@ jobs: -D CPACK_PACKAGE_VERSION="${{ inputs.version }}" \ -D CPACK_PACKAGE_FILE_NAME="wsjtx-${{ inputs.version }}-win64" ls -la *.exe + test -x map65/map65.exe # Self-signed ephemeral signing — the signing step is wired into the # pipeline, but the signature does NOT chain to a trusted root. This @@ -268,5 +301,6 @@ jobs: name: wsjtx-${{ inputs.version }}-windows-x86_64 path: | wsjtx-build/jt9.exe + wsjtx-build/map65/map65.exe wsjtx-build/wsprd.exe wsjtx-build/wsjtx.exe diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 52592fb4..a1bf639a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -28,8 +28,24 @@ jobs: echo "Derived version from CMakeLists.txt: $VERSION" echo "version=$VERSION" >> "$GITHUB_OUTPUT" - macos: + macos-arm64-qt: + needs: prepare + uses: ./.github/workflows/prepare-macos-qt.yml + with: + arch: "arm64" + runner: "macos-15" + deployment_target: "11.0" + + macos-intel-qt: needs: prepare + uses: ./.github/workflows/prepare-macos-qt.yml + with: + arch: "x86_64" + runner: "macos-15-intel" + deployment_target: "10.13" + + macos: + needs: [prepare, macos-arm64-qt] uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} @@ -40,7 +56,7 @@ jobs: secrets: inherit macos-intel: - needs: prepare + needs: [prepare, macos-intel-qt] uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} diff --git a/.github/workflows/prepare-macos-qt.yml b/.github/workflows/prepare-macos-qt.yml new file mode 100644 index 00000000..de9f5fe5 --- /dev/null +++ b/.github/workflows/prepare-macos-qt.yml @@ -0,0 +1,73 @@ +name: Prepare macOS Qt + +on: + workflow_call: + inputs: + arch: + description: "Target architecture (arm64 or x86_64)" + required: true + type: string + runner: + description: "GitHub Actions runner label" + required: true + type: string + deployment_target: + description: "macOS deployment target version" + required: true + type: string + +jobs: + qt-cache-key: + runs-on: ubuntu-latest + outputs: + key: ${{ steps.qt-key.outputs.key }} + steps: + - uses: actions/checkout@v6 + + - name: Compute Qt cache key + id: qt-key + run: | + .github/scripts/macos-qt-cache-key.sh \ + --arch "${{ inputs.arch }}" \ + --runner "${{ inputs.runner }}" \ + --deployment-target "${{ inputs.deployment_target }}" \ + --github-output + + prepare: + needs: qt-cache-key + runs-on: ${{ inputs.runner }} + concurrency: + group: ${{ needs.qt-cache-key.outputs.key }} + cancel-in-progress: false + steps: + - uses: actions/checkout@v6 + + - name: Restore Qt cache + id: qt-cache + uses: actions/cache/restore@v5 + with: + path: qt-prefix + key: ${{ needs.qt-cache-key.outputs.key }} + + - name: Build Qt + if: steps.qt-cache.outputs.cache-hit != 'true' + run: | + .github/scripts/build-qt-macos.sh \ + --arch "${{ inputs.arch }}" \ + --deployment-target "${{ inputs.deployment_target }}" \ + --prefix "${GITHUB_WORKSPACE}/qt-prefix" + + - name: Verify Qt prefix + run: | + .github/scripts/verify-macos-artifacts.sh \ + --target "${{ inputs.deployment_target }}" \ + --arch "${{ inputs.arch }}" \ + --allow-prefix "${GITHUB_WORKSPACE}/qt-prefix" \ + "${GITHUB_WORKSPACE}/qt-prefix" + + - name: Save Qt cache + if: steps.qt-cache.outputs.cache-hit != 'true' + uses: actions/cache/save@v5 + with: + path: qt-prefix + key: ${{ needs.qt-cache-key.outputs.key }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be547624..a8b9bd42 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -15,10 +15,30 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ steps.v.outputs.version }} + release_channel: ${{ steps.v.outputs.release_channel }} + rc_number: ${{ steps.v.outputs.rc_number }} steps: - uses: actions/checkout@v6 - id: v - run: echo "version=${GITHUB_REF_NAME#build/v}" >> "$GITHUB_OUTPUT" + run: | + VERSION="${GITHUB_REF_NAME#build/v}" + if [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + RELEASE_CHANNEL=GA + RC_NUMBER="" + elif [[ "$VERSION" =~ ^[0-9]+\.[0-9]+\.[0-9]+-rc([1-9][0-9]*)$ ]]; then + RELEASE_CHANNEL=RC + RC_NUMBER="${BASH_REMATCH[1]}" + else + echo "::error::Unsupported release tag version: $VERSION" + echo "::error::Supported release tags are build/vX.Y.Z and build/vX.Y.Z-rcN." + exit 1 + fi + + { + echo "version=$VERSION" + echo "release_channel=$RELEASE_CHANNEL" + echo "rc_number=$RC_NUMBER" + } >> "$GITHUB_OUTPUT" # Enforce that the pushed tag's numeric version base # matches CMakeLists.txt:55 VERSION (first 3 components). CMake's @@ -45,8 +65,24 @@ jobs: echo "Parity check PASSED." # ── Build all five platforms ─────────────────────────────────────── - macos: + macos-arm64-qt: + needs: prepare + uses: ./.github/workflows/prepare-macos-qt.yml + with: + arch: "arm64" + runner: "macos-15" + deployment_target: "11.0" + + macos-intel-qt: needs: prepare + uses: ./.github/workflows/prepare-macos-qt.yml + with: + arch: "x86_64" + runner: "macos-15-intel" + deployment_target: "10.13" + + macos: + needs: [prepare, macos-arm64-qt] uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} @@ -54,15 +90,19 @@ jobs: arch: "arm64" runner: "macos-15" deployment_target: "11.0" + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} secrets: inherit macos-intel: - needs: prepare + needs: [prepare, macos-intel-qt] uses: ./.github/workflows/build-macos.yml with: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.1" arch: "x86_64" + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} runner: "macos-15-intel" deployment_target: "10.13" secrets: inherit @@ -74,6 +114,8 @@ jobs: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.1" arch: "x86_64" + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} secrets: inherit linux-arm: @@ -83,6 +125,8 @@ jobs: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.1" arch: "aarch64" + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} secrets: inherit windows: @@ -91,6 +135,8 @@ jobs: with: version: ${{ needs.prepare.outputs.version }} hamlib_branch: "4.7.1" + release_channel: ${{ needs.prepare.outputs.release_channel }} + rc_number: ${{ needs.prepare.outputs.rc_number }} secrets: inherit # ── Publish release + sync to public repo ────────────────────────── @@ -205,7 +251,7 @@ jobs: # that collide on basename across architectures — `gh release # create` uses basenames as asset names and duplicates cause # upload failures. - FILES=$(find artifacts -maxdepth 2 -type f \ + mapfile -t files < <(find artifacts -maxdepth 2 -type f \ \( -name "*.pkg" -o -name "*.AppImage" -o -name "*.deb" \ -o -name "*.exe" -o -name "*.tar.gz" -o -name "*.rpm" \)) # SemVer pre-release tags contain a hyphen after the version @@ -219,7 +265,7 @@ jobs: --title "WSJT-X ${{ needs.prepare.outputs.version }}" \ --generate-notes \ $PRERELEASE_FLAG \ - $FILES + "${files[@]}" # ── Public mirror: GA only ───────────────────────────────────────── # RC/beta tags (any tag carrying a '-' in the version, e.g. @@ -303,11 +349,11 @@ jobs: # Same asset filter as the internal release. Re-find rather than # carrying a list — keeps the all-platforms-ready gate, internal # release, and public release mechanically aligned on one filter. - FILES=$(find artifacts -maxdepth 2 -type f \ + mapfile -t files < <(find artifacts -maxdepth 2 -type f \ \( -name "*.pkg" -o -name "*.AppImage" -o -name "*.deb" \ -o -name "*.exe" -o -name "*.tar.gz" -o -name "*.rpm" \)) gh release create "$PUBLIC_TAG" \ -R WSJTX/wsjtx \ --title "WSJT-X ${VERSION}" \ --generate-notes \ - $FILES + "${files[@]}" |
