Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,9 @@ jobs:
# existing *-mavericks.* tags, so the full history has to be here.
fetch-depth: 0

# shipyard installs itself via its own action (HTTPS via the runner token); consumed thereafter
# via find_package(MavericksShipyard) + the installed ${MavericksShipyard_SCRIPTS}.
# shipyard installs itself via its own action (HTTPS via the runner token): the pkg, which puts
# shipyard-cmake on PATH and exports $SHIPYARD_SCRIPTS. Consumed thereafter via
# find_package(MavericksShipyard) under shipyard-cmake, and via msc.sh in the shell scripts.
- name: Install mavericks-shipyard
uses: ModernMavericks/shipyard/.github/actions/install@v1

Expand Down Expand Up @@ -134,8 +135,8 @@ jobs:
- name: Build SwiftUpdater.app (Cocoa/Sparkle; must NOT link Swift)
run: |
# The Sparkle framework is fetched inside mavericks_add_updater_app (mavericks_fetch_sparkle).
cmake -S . -B build/updater -DCMAKE_OBJC_COMPILER=/usr/bin/clang
cmake --build build/updater --target SwiftUpdater
shipyard-cmake -S . -B build/updater -DCMAKE_OBJC_COMPILER=/usr/bin/clang
shipyard-cmake --build build/updater --target SwiftUpdater
otool -L build/updater/SwiftUpdater.app/Contents/MacOS/SwiftUpdater | tee /tmp/o.txt
! grep -q '/usr/lib/swift' /tmp/o.txt || { echo "::error::updater links libswiftCore (self-update circularity)"; exit 1; }

Expand Down
5 changes: 3 additions & 2 deletions build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
# Produces: out/libswiftCore.dylib (+ libswiftSwiftOnoneSupport.dylib), minOS 10.9,
# from Swift 6.3.3 swift.org sources, with NO Apple prebuilt runtime bytes redistributed.
#
# Host: macOS with Xcode Command Line Tools (full Xcode NOT required), cmake + ninja + git.
# Host: macOS with Xcode Command Line Tools (full Xcode NOT required), ninja + git, and the
# shipyard pkg (it provides shipyard-cmake, the only cmake this family configures with).
# Cross-target build (host may be arm64; output is x86_64). ~30-60 min from clean on 8 cores.
#
# Everything is PINNED below. Do not float versions — the stdlib is coupled to its compiler.
Expand Down Expand Up @@ -140,7 +141,7 @@ echo "==> 4. Swift STDLIB-ONLY configure (prebuilt toolchain as native tools)"
# skipped under SWIFT_INCLUDE_TESTS=OFF / SWIFT_INCLUDE_TOOLS=OFF -- so no LLVM source is needed.
# Clang_DIR, LLVM_TABLEGEN and CLANG_TABLEGEN are deliberately absent: CMake reports them
# unused in this configuration, since the branch that would read them is behind SWIFT_INCLUDE_TOOLS.
cmake -G Ninja -S swift -B stdlib-build \
shipyard-cmake -G Ninja -S swift -B stdlib-build \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_C_COMPILER="$TC/bin/clang" -DCMAKE_CXX_COMPILER="$TC/bin/clang++" \
-DLLVM_DIR="$LLVMB/lib/cmake/llvm" \
Expand Down
33 changes: 24 additions & 9 deletions msc.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
# msc.sh -- sourced (with $HERE set to the sourcing script's dir): set $SHIPYARD to the installed
# mavericks-shipyard scripts dir. Prefer $SHIPYARD_SCRIPTS (exported by shipyard's install@v1);
# fall back to the CMake user package registry (a local `cmake --install`), then a sibling checkout
# (a dev box that never installed it). This is the only per-repo part of consuming shipyard's
# shell scripts; the logic itself (clone_pinned.sh, ...) lives in 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="$HERE/../mavericks-shipyard/scripts"
[ -d "$SHIPYARD" ] || { echo "cannot locate mavericks-shipyard scripts (set SHIPYARD_SCRIPTS or run install@v1)" >&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
20 changes: 3 additions & 17 deletions package.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,27 +13,13 @@ DIST="${DIST:-$PWD/dist}"
# from UPSTREAM_VERSION + the shipped tags. Never a committed file.
HERE="$(cd "$(dirname "$0")" && pwd)"
[ -f "$HERE/UPSTREAM_VERSION" ] || sh "$HERE/scripts/derive-upstream-version.sh" >/dev/null
. "$HERE/msc.sh" # -> $SHIPYARD (shipyard scripts dir)
. "$HERE/msc.sh" # -> $SHIPYARD: resolve-version, stage_updater and set_install_floor
VERSION="$(MAVERICKS_ROOT="$HERE" sh "$SHIPYARD/resolve-version.sh")"
IDENTIFIER="${PKG_IDENTIFIER:-dev.modernmavericks.swift-runtime}"
NAME="swift-runtime-${VERSION}"
mkdir -p "$DIST"
[ -f "$OUT/usr/lib/swift/libswiftCore.dylib" ] || { echo "no build in $OUT; run build.sh" >&2; exit 1; }

# Locate mavericks-shipyard's scripts dir: installed SHIPYARD (find_package registry / --prefix), env
# override, or a sibling checkout. Not vendored -- consumed like the siblings. Both set_install_floor
# and stage_updater come from here.
HELPER=""
for c in \
"${SHIPYARD_SCRIPTS:-}/set_install_floor.sh" \
"${MavericksShipyard_SCRIPTS:-}/set_install_floor.sh" \
"$HOME/.local/share/cmake/MavericksShipyard/scripts/set_install_floor.sh" \
"$PWD/../mavericks-shipyard/scripts/set_install_floor.sh" ; do
[ -n "$c" ] && [ -f "$c" ] && { HELPER="$c"; break; }
done
[ -n "$HELPER" ] || { echo "package: cannot find mavericks-shipyard set_install_floor.sh (install SHIPYARD or set SHIPYARD_SCRIPTS)" >&2; exit 4; }
SHIPYARD="$(cd "$(dirname "$HELPER")" && pwd)"

echo ">> resources (welcome + license shown at install)"
RES="$DIST/resources"; mkdir -p "$RES"
cp scripts/resources/Welcome.html "$RES/"
Expand All @@ -52,7 +38,7 @@ if [ -d "$UPD_APP" ]; then
--scripts-out "$SCR"
set -- --scripts "$SCR"
else
echo " (no updater app at $UPD_APP; packaging runtime only -- build it: cmake --build build/updater)"
echo " (no updater app at $UPD_APP; packaging runtime only -- build it: shipyard-cmake --build build/updater)"
fi

echo ">> flat component pkg (payload -> /usr/lib/swift, /usr/local, /Library/LaunchAgents)"
Expand All @@ -61,7 +47,7 @@ pkgbuild --root "$OUT" --identifier "$IDENTIFIER" --version "$VERSION" \
--install-location / "$DIST/swift-runtime-component.pkg"

echo ">> product archive with 10.9.5 floor (shared helper)"
sh "$HELPER" \
sh "$SHIPYARD/set_install_floor.sh" \
--identifier "$IDENTIFIER" \
--title "Mavericks Swift Runtime — Swift core runtime for OS X 10.9" \
--component "$DIST/swift-runtime-component.pkg" \
Expand Down
15 changes: 3 additions & 12 deletions scripts/guard.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,9 @@
# Usage: scripts/guard.sh <dylib> [<dylib> ...]
set -eu

# Locate the shared guard from mavericks-shipyard: installed SHIPYARD (find_package registry /
# --prefix), an env override, or a sibling checkout. Not vendored -- consumed like trackpad2/dimmit.
SHARED=""
for c in \
"${SHIPYARD_SCRIPTS:-}/assert_binary_compatible.sh" \
"${MavericksShipyard_SCRIPTS:-}/assert_binary_compatible.sh" \
"$HOME/.local/share/cmake/MavericksShipyard/scripts/assert_binary_compatible.sh" \
"$(dirname "$0")/../../mavericks-shipyard/scripts/assert_binary_compatible.sh" ; do
[ -n "$c" ] && [ -f "$c" ] && { SHARED="$c"; break; }
done
[ -n "$SHARED" ] || { echo "guard: cannot find mavericks-shipyard assert_binary_compatible.sh" >&2
echo " install it (cmake --install) or set SHIPYARD_SCRIPTS." >&2; exit 4; }
. "$(dirname "$0")/../msc.sh" # -> $SHIPYARD (shipyard scripts dir)
SHARED="$SHIPYARD/assert_binary_compatible.sh"
[ -f "$SHARED" ] || { echo "guard: shipyard at $SHIPYARD has no assert_binary_compatible.sh" >&2; exit 4; }

# Full post-10.9 os_* family, tolerant of the one/two leading-underscore SPI naming.
export MAVERICKS_POST_10_9_SYMBOLS='__?os_signpost.*|__?os_log.*|_os_system_version_get_current_version|__?os_availability.*'
Expand Down