add build time option to change where we look for the runtime directory

This commit is contained in:
Squibid 2026-03-03 19:36:38 -05:00
parent e3e7ecd7e1
commit edd0956b25
Signed by: squibid
GPG key ID: BECE5684D3C4005D

View file

@ -7,13 +7,6 @@ pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{}); const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{}); const optimize = b.standardOptimizeOption(.{});
// TODO: this will probably change based on the install paths, make this a var
// that can be passed at comptime?
const runtime_path_prefix = switch (builtin.mode) {
.Debug => "runtime/",
else => "/usr/share",
};
// Add protocol xml files // Add protocol xml files
const scanner = Scanner.create(b, .{}); const scanner = Scanner.create(b, .{});
scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml"); scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml");
@ -79,6 +72,7 @@ pub fn build(b: *std.Build) void {
) catch "dev\n"; ) catch "dev\n";
const options = b.addOptions(); const options = b.addOptions();
const runtime_path_prefix = b.option([]const u8, "prefix", "Where mez looks for the runtime dir") orelse "runtime/";
options.addOption([]const u8, "runtime_path_prefix", runtime_path_prefix); options.addOption([]const u8, "runtime_path_prefix", runtime_path_prefix);
options.addOption([]const u8, "version", version); options.addOption([]const u8, "version", version);
mez.root_module.addOptions("config", options); mez.root_module.addOptions("config", options);