Skip to content

Commit 972f7de

Browse files
committed
update to Zig 0.17.0
1 parent 466931e commit 972f7de

3 files changed

Lines changed: 17 additions & 10 deletions

File tree

‎README.md‎

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ const libxkbcommon_dependency = b.dependency("libxkbcommon", .{
2121
.target = target,
2222
.optimize = optimize,
2323
24+
// The system install prefix. Defaults to `/usr` which matches most distributions.
25+
// This does not work on distributions that don't follow the Filesystem Hierarchy Standard (FHS) like NixOS.
26+
// .@"install-prefix" = "/usr/local/",
27+
2428
// Set the XKB config root.
2529
// Will default to "${INSTALL_PREFIX}/share/X11/xkb" i.e. `zig-out/share/X11/xkb`.
2630
// Most distributions will use `/usr/share/X11/xkb`.
@@ -46,4 +50,4 @@ const libxkbcommon_dependency = b.dependency("libxkbcommon", .{
4650
your_exe.linkLibrary(libxkbcommon_dependency.artifact("libxkbcommon"));
4751
```
4852

49-
For more information, please refer to the [User-configuration](https://github.com/xkbcommon/libxkbcommon/blob/master/doc/user-configuration.md) docs of libxkbcommon.
53+
For more information, please refer to the [XKB data locations](https://github.com/xkbcommon/libxkbcommon/blob/master/doc/custom-configuration.md#xkb-data-locations) docs of libxkbcommon.

‎build.zig‎

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

‎build.zig.zon‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.{
22
.name = .libxkbcommon,
33
.version = "1.13.2",
4-
.minimum_zig_version = "0.16.0",
4+
.minimum_zig_version = "0.17.0",
55
.dependencies = .{
66
.libxkbcommon = .{
77
.url = "git+https://github.com/xkbcommon/libxkbcommon.git?ref=xkbcommon-1.13.2#d1442aaa6b635551182e83c3b55037f4c118c962",

0 commit comments

Comments
 (0)