Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,13 @@ jobs:
build:
strategy:
fail-fast: false
matrix:
zig-version: [master, 0.14.0]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Zig
uses: mlugg/setup-zig@v1
with:
version: ${{ matrix.zig-version }}
uses: mlugg/setup-zig@v2

- name: Check Formatting
run: zig fmt --ast-check --check .
Expand Down
29 changes: 7 additions & 22 deletions build.zig
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const std = @import("std");

const version: std.SemanticVersion = .{ .major = 1, .minor = 7, .patch = 0 };
const version: std.SemanticVersion = .{ .major = 1, .minor = 11, .patch = 0 };

pub fn build(b: *std.Build) void {
const upstream = b.dependency("libxkbcommon", .{});
Expand Down Expand Up @@ -87,7 +87,7 @@ pub fn build(b: *std.Build) void {

const generated_parser = generateParser(b, upstream);

const update_parser = b.step("update-parser", "Updated parser.c and parser.h (requires bison or byacc)");
const update_parser = b.step("update-parser", "Updated parser.c and parser.h (requires bison)");
if (generated_parser) |generated| {
const generated_parser_c, const generated_parser_h = generated;

Expand All @@ -96,7 +96,7 @@ pub fn build(b: *std.Build) void {
update.addCopyFileToSource(generated_parser_c, "parser.c");
update.addCopyFileToSource(generated_parser_h, "parser.h");
} else {
update_parser.addError("unable to find bison or byacc in $PATH or search prefixes (--search-prefix)", .{}) catch {};
update_parser.addError("unable to find bison in $PATH or search prefixes (--search-prefix)", .{}) catch {};
update_parser.addError("parser.c and parser.h could not be updated", .{}) catch {};
}

Expand Down Expand Up @@ -217,29 +217,13 @@ fn generateParser(
b: *std.Build,
upstream: *std.Build.Dependency,
) ?struct { std.Build.LazyPath, std.Build.LazyPath } {
const exe, const kind: enum { bison, byacc } = if (b.findProgram(&.{ "bison", "win_bison" }, &.{}) catch null) |bison|
.{ bison, .bison }
else if (b.findProgram(&.{"byacc"}, &.{}) catch null) |byacc|
.{ byacc, .byacc }
else
return null;

const parser_write_files = b.addWriteFiles();
_ = parser_write_files.addCopyFile(upstream.path("src/xkbcomp/parser.y"), "parser.y");

const run_step = std.Build.Step.Run.create(b, b.fmt("run {s}", .{@tagName(kind)}));
const run_step = std.Build.Step.Run.create(b, "run bison");
run_step.setCwd(parser_write_files.getDirectory());
run_step.addFileArg(.{ .cwd_relative = exe });

switch (kind) {
.bison => {
_ = run_step.addArg("--defines=parser.h");
},
.byacc => {
run_step.addArgs(&.{ "-H", "parser.h" });
},
}

run_step.addFileArg(.{ .cwd_relative = b.findProgram(&.{ "bison", "win_bison" }, &.{}) catch return null });
run_step.addArg("--defines=parser.h");
run_step.addArg("-o");
const parser_c = run_step.addOutputFileArg("parser.c");
run_step.addArgs(&.{ "-p", "_xkbcommon_", "--no-lines" });
Expand Down Expand Up @@ -303,6 +287,7 @@ const libxkbcommon_sources: []const []const u8 = &.{
"src/keysym-utf.c",
"src/keymap.c",
"src/keymap-priv.c",
"src/rmlvo.c",
"src/scanner-utils.c",
"src/state.c",
"src/text.c",
Expand Down
7 changes: 3 additions & 4 deletions build.zig.zon
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
.{
.name = .libxkbcommon,
.version = "1.9.2",
.version = "1.11.0",
.minimum_zig_version = "0.14.0",
.dependencies = .{
.libxkbcommon = .{
.url = "git+https://github.com/xkbcommon/libxkbcommon.git?ref=xkbcommon-1.9.2#dd642359f8d43c09968e34ca7f1eb1121b2dfd70",
// alternative: .url = "https://xkbcommon.org/download/libxkbcommon-1.9.2.tar.xz",
.hash = "N-V-__8AAEg7XADqmm_Axa-ISq9_0pDsCLjf9Xd8NIOndVMH",
.url = "git+https://github.com/xkbcommon/libxkbcommon.git?ref=xkbcommon-1.11.0#0f9cefb1fedb23433666fa5d9045e48ff030c006",
.hash = "N-V-__8AAFRAZAD02nId1w02lyWXmN-hvo873BSh9wZDxjSN",
},
.libxml2 = .{
.url = "git+https://github.com/allyourcodebase/libxml2.git?ref=2.14.3#2fe1a209680cffa7f2c8b2f36228c519da26d0f8",
Expand Down
Loading