summaryrefslogtreecommitdiff
path: root/src/macos/build-app.sh
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-08-10 17:23:18 -0300
committerGabriel Schneider <[email protected]>2026-08-11 09:58:59 -0300
commita797a1ab2f648e773f7a1b28d12bf9441b9f13f4 (patch)
tree45db37a3d190425b3ca2453d46c57d2af27cfc93 /src/macos/build-app.sh
parenteb11ab331b4e13e2b9e5a673a4c012d22fdd1d9c (diff)
downloadpardes-a797a1ab2f648e773f7a1b28d12bf9441b9f13f4.tar.gz
pardes-a797a1ab2f648e773f7a1b28d12bf9441b9f13f4.zip
macos: pixel attachments, live theming, and a signed app
The AppKit shell now draws what the core renders, follows the theme without a relaunch, and builds into something you can hand to someone. - Pixel attachments. Surface.images was dropped on the floor here, so a PDF pane showed nothing at all: native_images is now set, pardes_image_s carries the geometry the core already clipped, and PardesView keeps one CGImage per (serial, page, revision) so scrolling costs a draw and not a decode. Image panes get real pixels instead of the petscii fallback. - Themes take hold live. pardes_tick never advanced the chrome animation, so every tagline kept the previous theme's colours until the next launch and the 16 ms re-pump spun for the rest of the session. pardes_theme_bg retires the hand-agreed #121212 and drives the window background and the titlebar appearance; a theme with no background of its own now gets a transparent window over an NSVisualEffectView. - The cell snaps to whole DEVICE pixels rather than whole points. Monaco advances 8.4014pt at 14, so ceiling to 9 spaced every column 7.1% wider than the face was drawn for. - The dial is one notch per 10 degrees instead of 20, and a release keeps turning in proportion to how hard it was thrown -- ramping up from zero at the floor, so a slow twist coasts not a little but not at all. - A file dropped on the grid is a click plus Look, so it opens beside the pane it was dropped on. No drop concept was added to the core. - The titlebar follows the focused pane: proxy icon, filename, and the dirty dot. File.saved_revision is the watermark that last one needed. - Config (SPC f c) prints the resolved startup config path. - build.zig assembles, signs and packages the bundle itself; build-app.sh is gone. -Dmacos-identity= takes a Developer ID, macos-dmg makes the image, and the icon is Glenda.
Diffstat (limited to 'src/macos/build-app.sh')
-rwxr-xr-xsrc/macos/build-app.sh94
1 files changed, 0 insertions, 94 deletions
diff --git a/src/macos/build-app.sh b/src/macos/build-app.sh
deleted file mode 100755
index a54e76b8..00000000
--- a/src/macos/build-app.sh
+++ /dev/null
@@ -1,94 +0,0 @@
-#!/bin/sh
-# Assemble pardes.app from libpardes.a and the Swift sources. Run it through
-# `zig build macos-app -Dplatform=macos`, or by hand with the install prefix as
-# $1, the deployment target as $2 and the Zig optimize mode as $3 once
-# `zig build -Dplatform=macos` has produced the library.
-#
-# There is no Xcode project on purpose. An .app is a directory with a plist and
-# a binary in it, swiftc ships with the Command Line Tools, and a hand-written
-# pbxproj would be a second build system to keep in step for no gain at this
-# stage. What Xcode buys — an xcframework of universal slices, codesigning,
-# notarization, a DMG — is distribution machinery; see docs/macos.md for the
-# upgrade path when that day comes.
-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.
-minver=${2:-13.0}
-# Both swiftc invocations below take the same triple; the note above the app
-# link is why -target is not optional for either of them.
-target="$(uname -m)-apple-macos$minver"
-app="$out/pardes.app"
-lib="$out/lib/libpardes.a"
-# The two halves of this program are compiled by two compilers, and before this
-# only one of them was told anything: swiftc was hardcoded to -O while the Zig
-# core followed -Doptimize, so the ordinary `zig build macos-app` produced an
-# optimized shell around a DEBUG core. It does not read as "I built Debug", it
-# reads as "the mac backend is slow" — measured on this machine, one frame at
-# 190x56 cost 4.5 ms with a Debug core and 0.88 ms with a ReleaseFast one, and
-# 4.1 ms of that 4.5 was pardes_frame alone. So the mode travels, both halves
-# agree, and a slow bundle says why.
-zigmode=${3:-Debug}
-case $zigmode in
-Debug) swiftmode=-Onone ;;
-ReleaseSmall) swiftmode=-Osize ;;
-*) swiftmode=-O ;;
-esac
-
-[ -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; }
-
-rm -rf "$app"
-mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
-cp "$root/src/macos/Info.plist" "$app/Contents/Info.plist"
-# One version, three consumers: the plist's claim is set from the same string
-# the link below enforces, so a bumped deployment target cannot leave a stale
-# LSMinimumSystemVersion behind.
-/usr/libexec/PlistBuddy -c "Set :LSMinimumSystemVersion $minver" "$app/Contents/Info.plist" >/dev/null
-
-# The icon is generated rather than committed. The mark is drawn out of the
-# same palette PardesView.swift renders cells with — #121212 body, the tag bar
-# and the block cursor straight from ansi16 — so a colour that moves there
-# moves here on the next build, instead of a binary blob sitting in the tree
-# quietly disagreeing with the app it ships in. Info.plist's CFBundleIconFile
-# names the pardes.icns this drops into Resources; without both halves the Dock
-# falls back to the generic blank page.
-#
-# The trap covers the compiled generator; the generator clears its own scratch
-# iconset. set -eu means a failure here takes the whole build down, which is
-# the point: a bundle that ships a blank icon should not have built.
-icontmp=$(mktemp -d)
-trap 'rm -rf "$icontmp"' EXIT
-swiftc -O -target "$target" -o "$icontmp/pardes-icon" "$root/src/macos/icon.swift"
-"$icontmp/pardes-icon" "$app/Contents/Resources"
-
-# -import-objc-header rather than a module map: the header is consumed straight
-# from the source tree, so there is nothing to stage and nothing to keep in
-# sync. A module map is what an xcframework needs, and there isn't one.
-#
-# -lc++ because ghostty-vt pulls in simdutf and highway, which are C++. The Zig
-# side bundles compiler_rt/ubsan_rt into the archive (see build.zig), so the
-# C++ runtime is the only thing left for this link to supply.
-# -target is not optional. Without it swiftc uses the host triple, so
-# LC_BUILD_VERSION records whatever macOS built the thing and dyld refuses to
-# launch it on anything older — the Info.plist's LSMinimumSystemVersion is a
-# claim, not the enforcement. It is also what turns on the availability
-# diagnostics that catch a post-13 API before a user does.
-swiftc "$swiftmode" -target "$target" \
- -import-objc-header "$root/src/macos/pardes.h" \
- -o "$app/Contents/MacOS/pardes" \
- "$root"/src/macos/Sources/*.swift \
- "$lib" -lc++ \
- -framework AppKit -framework CoreText -framework CoreGraphics
-
-# An .app whose mtime never moves is an .app Launch Services keeps serving from
-# its cache, icon and plist and all.
-touch "$app"
-
-if [ "$zigmode" = Debug ]; then
- echo "built $app (Debug core — rebuild with -Doptimize=ReleaseFast to use it)"
-else
- echo "built $app"
-fi