diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-17 14:27:57 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-17 14:29:31 -0300 |
| commit | 4f281f275f6e9b32b2fb5f0ebfc3e9b9338c0dce (patch) | |
| tree | 535ec8433e0ecea988032cd45c2c331cc0b20b5e | |
| parent | dd85d1d636383a735171472c96fd595a91856530 (diff) | |
| download | pardes-4f281f275f6e9b32b2fb5f0ebfc3e9b9338c0dce.tar.gz pardes-4f281f275f6e9b32b2fb5f0ebfc3e9b9338c0dce.zip | |
build: the addon copy follows the binaries' rule (-Dhome-install)
zig build image|pdf|addons copied the addons into
$XDG_DATA_HOME/pardes/addons whatever the platform, unless
-Dhome-install=false, so a gate script that left it out overwrote the
user's installed addons (REORG decision 24). Now the copy is the bare
build's, as the binaries' is: a -Dplatform build copies the addons only
with -Dhome-install=true (and never the binaries, as before); a bare
zig build copies both, -Dhome-install=false neither. The option's
description and docs/typ/building.typ say so.
Gates, with XDG_DATA_HOME and HOME pointed into scratch: the parent
copied image.so and pdf.so for zig build image pdf addons -Dplatform=tui;
now -Dplatform=tui and -Dplatform=gui copy nothing, -Dplatform=tui
-Dhome-install=true copies both, the bare zig build addons copies both,
-Dhome-install=false nothing, and no binary reaches HOME/.local/bin
from these steps. zig build -l byte-identical, whole matrix; -h differs
in the option's description alone; the configuration of the bare and
macos shapes differs in that string alone, the -Dplatform shapes lose
the two UpdateSourceFiles steps. Warm: install addons core-test
shell-test on tui, 0 compiles not cached, binaries cmp-identical.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
| -rw-r--r-- | build.zig | 16 | ||||
| -rw-r--r-- | docs/typ/building.typ | 11 |
2 files changed, 15 insertions, 12 deletions
@@ -42,15 +42,17 @@ pub fn build(b: *std.Build) void { const requested_platform = b.option(Platform, "platform", "which shell to build (tui, gui, macos); absent builds the tui cli and the SDL gui together"); const platform = requested_platform orelse .tui; const also_gui = requested_platform == null; - // A bare `zig build` also copies the binaries into ~/.local/bin. Zig - // 0.17 keeps the prefix in the maker process, out of this script's - // reach, so `--prefix` no longer turns it off: -Dhome-install=false does. - const home_enabled = b.option(bool, "home-install", "install binaries and addons into the user directories (default: true)") orelse true; - const home_bin: ?[]const u8 = if (also_gui and home_enabled) + // A bare `zig build` also copies the binaries into ~/.local/bin, and the + // addon steps theirs into the user's data directory. Zig 0.17 keeps the + // prefix in the maker process, out of this script's reach, so `--prefix` + // no longer turns it off: -Dhome-install=false does. With -Dplatform + // neither is copied, but the addons with -Dhome-install=true. + const home_option = b.option(bool, "home-install", "copy into the user directories: a bare `zig build` the binaries and addons, -Dplatform the addons only when true (default: true for a bare `zig build`)"); + const home_bin: ?[]const u8 = if (also_gui and (home_option orelse true)) if (b.graph.environ_map.get("HOME")) |home| b.pathJoin(&.{ home, ".local", "bin" }) else null else null; - const home_addons: ?[]const u8 = if (!home_enabled) null else if (b.graph.environ_map.get("XDG_DATA_HOME")) |data| + const home_addons: ?[]const u8 = if (!(home_option orelse also_gui)) null else if (b.graph.environ_map.get("XDG_DATA_HOME")) |data| b.pathJoin(&.{ data, "pardes", "addons" }) else if (b.graph.environ_map.get("HOME")) |home| b.pathJoin(&.{ home, ".local", "share", "pardes", "addons" }) @@ -226,7 +228,7 @@ pub fn build(b: *std.Build) void { // The addons, a step each: the default install is the binaries // alone, and `zig build image pdf` (or `addons`) puts the libraries // where the start scan finds them, <prefix>/lib/pardes/addons (and - // $XDG_DATA_HOME/pardes/addons unless -Dhome-install=false). + // $XDG_DATA_HOME/pardes/addons as home_addons says). const addons_step = b.step("addons", "install the image and pdf addons"); for ([_]?*std.Build.Step.Compile{ a.image_addon, a.pdf.lib }, [_][]const u8{ "image", "pdf" }) |lib, name| { const step = b.step(name, b.fmt("install the {s} addon, <prefix>/lib/pardes/addons/{s}.so", .{ name, name })); diff --git a/docs/typ/building.typ b/docs/typ/building.typ index 2b1943c4..0c95914c 100644 --- a/docs/typ/building.typ +++ b/docs/typ/building.typ @@ -41,10 +41,11 @@ system takes the SDK SDL needs with `-Dmacos-sdk=<path>`. A bare `zig build` installs into the prefix (`zig-out`, or `--prefix <dir>`) and copies the binaries into `~/.local/bin`; `-Dhome-install=false` leaves that copy out. Zig 0.17 keeps the prefix from the build script, so -`--prefix` alone no longer stops it. With `-Dplatform` binaries are not copied. The `image`, `pdf` and -`addons` steps also install into `$XDG_DATA_HOME/pardes/addons` (else -`~/.local/share/pardes/addons`); `-Dhome-install=false` skips that copy. -Pass `-Dplatform` and `-Dhome-install=false` while developing. Test, benchmark and run steps build what they need +`--prefix` alone no longer stops it. The `image`, `pdf` and `addons` steps +of a bare `zig build` also install into `$XDG_DATA_HOME/pardes/addons` +(else `~/.local/share/pardes/addons`); `-Dhome-install=false` skips that +copy too. With `-Dplatform` neither is copied, but `-Dhome-install=true` +copies the addons. Test, benchmark and run steps build what they need without installing. `pardes --version` prints `pardes <version>` (from `build.zig.zon`), plus the commit for release builds and the `~/.local` install, and on a second line the build's semantics hash, which a replica @@ -60,7 +61,7 @@ must share with its session; `pardes --help` lists every flag. [`-Djpx`], [bool, `true`: JPEG 2000, and with it scanned PDFs], [`-Dtree-sitter`], [`disabled`, `zig`, `minimal`, `full`; `full`], [`-Dembed-sources`], [bool, `false`: serve the sources under #file("/src")], - [`-Dhome-install`], [bool: a bare `zig build` also copies the binaries into `~/.local/bin`; default true], + [`-Dhome-install`], [bool: a bare `zig build` also copies the binaries into `~/.local/bin` and the addon steps theirs into `$XDG_DATA_HOME/pardes/addons`, default true; with `-Dplatform` only `true` copies, and the addons alone], [`-Dstamp-commit`], [bool: the git commit in `--version` and crash records; on for release builds and the `~/.local` install], [`-Dworkspace-tag`], [bool: draw the workspace tag row; on except for macOS, whose menu bar carries it], [`-Dmacos-sdk`], [path: the macOS SDK SDL's headers and frameworks come from, for a gui built for macOS elsewhere], |
