summaryrefslogtreecommitdiff
path: root/src/macos/build-e2e.sh
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-11 15:58:58 -0300
committerGabriel Schneider <[email protected]>2026-08-11 16:26:20 -0300
commit4ca28745d774c232cd31a29c17878f19bbe24cf5 (patch)
treeface852acae5bc347e6bab2bb5cede501e0ce1d3 /src/macos/build-e2e.sh
parentdedfdea43f0d6c7151c541284c81027969d89032 (diff)
parent89d93d5e7348304bc7d8a148f9ad9c1beb200459 (diff)
downloadpardes-4ca28745d774c232cd31a29c17878f19bbe24cf5.tar.gz
pardes-4ca28745d774c232cd31a29c17878f19bbe24cf5.zip
merge the macOS app branch: the AppKit shell, pixel attachments, live theming, and mupdf -Djpx
Three commits off 38e9919 (macos-app@upstream) merged into main's ghostty bump. No textual conflicts, and two things the merge needed: - nested.zig asked libc for fstatat. Darwin has it; on linux std.c declares it `void` (glibc hides it behind a versioned symbol std cannot name), so the tty build stopped at 'type void not a function'. statNoFollow keeps fstatat on darwin and asks statx on linux for the same three fields, which is what this file did before the branch generalized it to both platforms. - .DS_Store rode along with a797a1a. Deleted, and .gitignore now says so. linux: snap 86/86, unit-test, image-harness and mupdf-check green. nested.zig also type-checks for aarch64-macos.
Diffstat (limited to 'src/macos/build-e2e.sh')
-rwxr-xr-xsrc/macos/build-e2e.sh52
1 files changed, 52 insertions, 0 deletions
diff --git a/src/macos/build-e2e.sh b/src/macos/build-e2e.sh
new file mode 100755
index 00000000..c0f9613c
--- /dev/null
+++ b/src/macos/build-e2e.sh
@@ -0,0 +1,52 @@
+#!/bin/sh
+# Link the offscreen end-to-end harness: the app's own Swift shell, plus
+# test/macos_e2e.swift as the entry point, against the same libpardes.a. Run it
+# through `zig build macos-e2e -Dplatform=macos`, or by hand with the install
+# prefix as $1 and the deployment target as $2.
+#
+# A SECOND BINARY rather than a `--e2e` flag on the app, for two reasons.
+#
+# Test scaffolding does not ship inside the product. A flag would put the script
+# interpreter, the /tmp world-builder and the golden differ into the thing a
+# user launches, and would give the app a mode in which it rewrites files under
+# /tmp and calls exit() — none of which anyone should be one argv typo away from.
+#
+# And src/macos/Sources/main.swift holds top-level code, which IS an entry
+# point: a module cannot contain both top-level statements and a @main type, so
+# the harness could not join that link even if the first reason went away. Every
+# other Swift file the app builds from is compiled here, so this link is also
+# what proves the shell still compiles as a library rather than as an app.
+set -eu
+
+root=$(cd "$(dirname "$0")/../.." && pwd)
+out=${1:-"$root/zig-out"}
+# Keep in step with macos_min_version in build.zig, which passes it in. The
+# default is only for a by-hand run. Same string the app's own link uses, and
+# for the same reason: -target is what decides LC_BUILD_VERSION and turns on
+# the availability diagnostics.
+minver=${2:-13.0}
+lib="$out/lib/libpardes.a"
+bin="$out/bin/pardes-macos-e2e"
+
+[ -f "$lib" ] || { echo "missing $lib — run: zig build -Dplatform=macos" >&2; exit 1; }
+command -v swiftc >/dev/null || { echo "swiftc not found (needs macOS + Command Line Tools)" >&2; exit 1; }
+
+mkdir -p "$out/bin"
+
+# -import-objc-header and -lc++ are the app link's, unchanged, and have to stay
+# that way: this link exists to exercise the app's link, so anything that
+# differs here is something the harness cannot vouch for.
+#
+# -O for the same reason. A debug build of the CoreText pass and the effect
+# drain settles on different timings than a user sees, and `stable` waits on
+# exactly those timings.
+swiftc -O -target "$(uname -m)-apple-macos$minver" \
+ -import-objc-header "$root/src/macos/pardes.h" \
+ -o "$bin" \
+ "$root/src/macos/Sources/PardesView.swift" \
+ "$root/src/macos/Sources/AppDelegate.swift" \
+ "$root/test/macos_e2e.swift" \
+ "$lib" -lc++ \
+ -framework AppKit -framework CoreText -framework CoreGraphics
+
+echo "built $bin"