diff options
| author | Alex Mohr <mohralexj@gmail.com> | 2021-01-01 12:20:29 -0800 |
|---|---|---|
| committer | Isaac Freund <ifreund@ifreund.xyz> | 2021-01-01 23:23:44 +0100 |
| commit | 75588a553c9eaaa7aa50c96c03cb7b15ffb4955b (patch) | |
| tree | ccb3bfe8f4ec8cf22bb1cc972bd7c78bae837a50 /build.zig | |
| parent | d2e2dad09cf555d48d1175aad8258a0e0548f06b (diff) | |
| download | river-75588a553c9eaaa7aa50c96c03cb7b15ffb4955b.tar.gz river-75588a553c9eaaa7aa50c96c03cb7b15ffb4955b.tar.xz | |
build: derive default config path from install prefix
- Add `default_config_path` build option for the river executable
Diffstat (limited to 'build.zig')
| -rw-r--r-- | build.zig | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -27,13 +27,16 @@ pub fn build(b: *zbs.Builder) !void { const examples = b.option(bool, "examples", "Set to true to build examples") orelse false; - // Sigh, why are the conventions inconsistent like this. const resolved_prefix = try std.fs.path.resolve(b.allocator, &[_][]const u8{b.install_prefix.?}); - if (std.mem.eql(u8, resolved_prefix, "/usr")) { - b.installFile("example/init", "../etc/river/init"); - } else { - b.installFile("example/init", "etc/river/init"); - } + const rel_config_path = if (std.mem.eql(u8, resolved_prefix, "/usr")) + "../etc/river/init" + else + "etc/river/init"; + b.installFile("example/init", rel_config_path); + const default_config_path = try std.fs.path.resolve( + b.allocator, + &[_][]const u8{ resolved_prefix, rel_config_path }, + ); const scanner = ScanProtocolsStep.create(b); scanner.addSystemProtocol("stable/xdg-shell/xdg-shell.xml"); @@ -47,6 +50,7 @@ pub fn build(b: *zbs.Builder) !void { river.setTarget(target); river.setBuildMode(mode); river.addBuildOption(bool, "xwayland", xwayland); + river.addBuildOption([]const u8, "default_config_path", default_config_path); addServerDeps(river, scanner); |
