@@ -30,10 +30,13 @@ pub fn build(b: *std.Build) void {
3030
3131 // Most of these config options have not been tested.
3232
33- const xkb_legacy_root = b .option ([]const u8 , "xkb-legacy-root" , " [default=$prefix/share/X11/locale]" ) orelse b .pathJoin (&.{ b .install_prefix , "share/X11/xkb" });
34- const xkb_config_root = b .option ([]const u8 , "xkb-config-root" , "The XKB config root [default=$prefix/share/X11/locale]" ) orelse xkb_legacy_root ;
33+ // This should use a lazy path instead: `std.Build.LazyPath{ .relative = .{ .base = .install_prefix } }`.
34+ const install_prefix = b .option ([]const u8 , "install-prefix" , "[default=/usr]" ) orelse "/usr" ;
35+
36+ const xkb_legacy_root = b .option ([]const u8 , "xkb-legacy-root" , " [default=$prefix/share/X11/xkb]" ) orelse b .pathJoin (&.{ install_prefix , "share/X11/xkb" });
37+ const xkb_config_root = b .option ([]const u8 , "xkb-config-root" , "The XKB config root [default=$prefix/share/X11/xkb]" ) orelse xkb_legacy_root ;
3538 const xkb_config_extra_path = b .option ([]const u8 , "xkb-config-extra-path" , "Extra lookup path for system-wide XKB data [default=$sysconfdir/xkb]" ) orelse "/etc/xkb" ;
36- const x_locale_root = b .option ([]const u8 , "x-locale-root" , "The X locale root [default=$prefix/share/X11/locale]" ) orelse b .pathJoin (&.{ b . install_prefix , "share/X11/locale" });
39+ const x_locale_root = b .option ([]const u8 , "x-locale-root" , "The X locale root [default=$prefix/share/X11/locale]" ) orelse b .pathJoin (&.{ install_prefix , "share/X11/locale" });
3740 // const bash_completion_path = b.option([]const u8, "bash-completion-path", "Directory for bash completion scripts");
3841 const default_rules = b .option ([]const u8 , "default-rules" , "Default XKB ruleset" ) orelse "evdev" ;
3942 const default_model = b .option ([]const u8 , "default-model" , "Default XKB model" ) orelse "pc105" ;
@@ -51,7 +54,7 @@ pub fn build(b: *std.Build) void {
5154 const config_header = b .addConfigHeader (.{}, .{
5255 .EXIT_INVALID_USAGE = 2 ,
5356 .LIBXKBCOMMON_VERSION = b .fmt ("{f}" , .{version }),
54- .LIBXKBCOMMON_TOOL_PATH = b .pathJoin (&.{ b . install_prefix , "libexec/xkbcommon" }),
57+ .LIBXKBCOMMON_TOOL_PATH = b .pathJoin (&.{ install_prefix , "libexec/xkbcommon" }),
5558 ._GNU_SOURCE = 1 ,
5659 .DFLT_XKB_LEGACY_ROOT = xkb_legacy_root ,
5760 .DFLT_XKB_CONFIG_ROOT = xkb_config_root ,
@@ -101,8 +104,8 @@ pub fn build(b: *std.Build) void {
101104 update .addCopyFileToSource (generated_parser_c , "parser.c" );
102105 update .addCopyFileToSource (generated_parser_h , "parser.h" );
103106 } else {
104- update_parser .addError ( "unable to find bison in $PATH or search prefixes (--search-prefix)" , .{}) catch {} ;
105- update_parser .addError ( "parser.c and parser.h could not be updated" , .{}) catch {} ;
107+ update_parser .dependOn ( & b . addFail ( "unable to find bison in $PATH or search prefixes (--search-prefix)" ). step ) ;
108+ update_parser .dependOn ( & b . addFail ( "parser.c and parser.h could not be updated" ). step ) ;
106109 }
107110
108111 const use_system_bison = b .systemIntegrationOption ("bison" , .{});
@@ -227,7 +230,7 @@ fn generateParser(
227230
228231 const run_step = std .Build .Step .Run .create (b , "run bison" );
229232 run_step .setCwd (parser_write_files .getDirectory ());
230- run_step .addFileArg (.{ .cwd_relative = b .findProgram (&.{ "bison" , "win_bison" }, &.{ }) catch return null });
233+ run_step .addFileArg (.{ .cwd_relative = b .findProgram (.{ . names = &.{ "bison" , "win_bison" } }) orelse return null });
231234 run_step .addArg ("--defines=parser.h" );
232235 run_step .addArg ("-o" );
233236 const parser_c = run_step .addOutputFileArg ("parser.c" );
@@ -237,7 +240,7 @@ fn generateParser(
237240 const write_header = b .addWriteFiles ();
238241 write_header .step .dependOn (& run_step .step );
239242 const parser_h = write_header .addCopyFile (
240- .{ .generated = .{ .file = & parser_write_files .generated_directory , .sub_path = "parser.h" } },
243+ .{ .generated = .{ .index = parser_write_files .generated_directory , .sub_path = "parser.h" } },
241244 "parser.h" ,
242245 );
243246
0 commit comments