diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c5a17e6..978bd38 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -40,8 +40,10 @@ jobs: steps: - uses: actions/checkout@v7 - # shipyard installs itself via its own action (HTTPS via the runner token). It self-registers - # in the user package registry, so find_package resolves it downstream with no CMAKE_PREFIX_PATH. + # shipyard installs itself via its own action (HTTPS via the runner token). The action puts + # shipyard-cmake on PATH and exports SHIPYARD_SCRIPTS; shipyard-cmake is the only cmake that + # configures against shipyard, and it supplies the prefix find_package(MavericksShipyard) + # resolves from, so there is nothing to register and no CMAKE_PREFIX_PATH to set. - name: Install mavericks-shipyard uses: ModernMavericks/shipyard/.github/actions/install@v1 @@ -53,9 +55,9 @@ jobs: # guard runs as a build-time POST_BUILD (static otool check; no Rosetta). - name: Configure + build (x86_64 @ 10.9) — compat guard gates Porthole run: | - cmake --preset cross - cmake --build build-cross + shipyard-cmake --preset cross + shipyard-cmake --build build-cross echo "Porthole slice:"; lipo -info build-cross/porthole/viewer/Porthole.app/Contents/MacOS/Porthole - name: Off-device codec test (Rosetta) - run: ctest --preset cross -R '^protocol$' --output-on-failure + run: shipyard-ctest --preset cross -R '^protocol$' --output-on-failure diff --git a/build/msc.sh b/build/msc.sh index 605ee1e..43c2af0 100644 --- a/build/msc.sh +++ b/build/msc.sh @@ -1,6 +1,25 @@ -# build/msc.sh -- sourced: locate the installed mavericks-shipyard scripts dir as $SHIPYARD. +# usage: . build/msc.sh +# Sourced by a ModernMavericks product's build scripts: locates shipyard's scripts as +# $SHIPYARD and exports SHIPYARD_SCRIPTS. In CI, install@v1 has already exported +# SHIPYARD_SCRIPTS; anywhere else this asks shipyard-cmake -- the only cmake that configures +# against shipyard -- where find_package(MavericksShipyard) lands, so a CMAKE_PREFIX_PATH +# dev override moves the scripts together with the modules. About 2 s, exported so children +# skip it. CANONICAL COPY: shipyard's scripts/templates/msc.sh; conventions check 17 +# requires every product's copy to match it byte for byte, so change it there, not here. SHIPYARD="${SHIPYARD_SCRIPTS:-}" -[ -d "$SHIPYARD" ] || SHIPYARD="$(cat "$HOME/.cmake/packages/MavericksShipyard/"* 2>/dev/null | head -1)/scripts" -[ -d "$SHIPYARD" ] || SHIPYARD="$(cd "$(dirname "$0")/.." && pwd)/../mavericks-shipyard/scripts" -[ -d "$SHIPYARD" ] || { echo "cannot locate mavericks-shipyard scripts (install it, or set SHIPYARD_SCRIPTS)" >&2; return 1 2>/dev/null || exit 1; } -export SHIPYARD +if [ ! -d "$SHIPYARD" ]; then + _msc_probe="$(mktemp -d "${TMPDIR:-/tmp}/shipyard-probe.XXXXXX")" + printf '%s\n' 'cmake_minimum_required(VERSION 3.16)' 'project(shipyard_probe NONE)' \ + 'find_package(MavericksShipyard REQUIRED)' 'message(STATUS "SHIPYARD_DIR=${MavericksShipyard_DIR}")' \ + > "$_msc_probe/CMakeLists.txt" + # platform: appending /scripts to the substitution directly made a failed probe (no + # shipyard-cmake, a refused configure) yield the literal "/scripts" -- an absolute path, + # plausible-looking, and the error below would then complain about the wrong thing. So + # assign the probe's answer first and append only if there was one. + _msc_dir="$(shipyard-cmake -S "$_msc_probe" -B "$_msc_probe/b" 2>/dev/null | sed -n 's/^-- SHIPYARD_DIR=//p')" + if [ -n "$_msc_dir" ]; then SHIPYARD="$_msc_dir/scripts"; fi + rm -rf "$_msc_probe"; unset _msc_probe _msc_dir +fi +[ -d "$SHIPYARD" ] || { echo "msc.sh: cannot locate shipyard -- install the shipyard pkg (it provides shipyard-cmake), or set SHIPYARD_SCRIPTS" >&2; return 1 2>/dev/null || exit 1; } +SHIPYARD_SCRIPTS="$SHIPYARD" +export SHIPYARD SHIPYARD_SCRIPTS