diff options
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 16 |
1 files changed, 9 insertions, 7 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 })); |
