2024-02-21 12:09:51 -07:00
|
|
|
const std = @import("std");
|
|
|
|
|
|
|
|
const VERSION = std.SemanticVersion{ .major = 1, .minor = 6, .patch = 0 };
|
|
|
|
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
|
|
const target = b.standardTargetOptions(.{});
|
|
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
|
|
|
|
// const enable_x11 = b.option(bool, "enable-x11", "Whether to enable x11 compatibility");
|
|
|
|
const xkb_config_root = b.option([]const u8, "xkb-config-root", "Root directory for xkb config") orelse "/usr/share/X11/xkb";
|
|
|
|
const x_locale_root = b.option([]const u8, "x-locale-root", "x locale root") orelse "/usr/share/X11/locale";
|
|
|
|
|
|
|
|
const config_header = b.addConfigHeader(.{}, .{
|
|
|
|
.EXIT_INVALID_USAGE = @as(i64, 2),
|
|
|
|
.LIBXKBCOMMON_VERSION = b.fmt("\"{}\"", .{VERSION}),
|
|
|
|
.DFLT_XKB_CONFIG_ROOT = xkb_config_root,
|
|
|
|
.DFLT_XKB_CONFIG_EXTRA_PATH = b.fmt("\"{s}\"", .{"/usr/share/xkb"}),
|
|
|
|
.XLOCALEDIR = b.fmt("\"{s}\"", .{x_locale_root}),
|
|
|
|
|
|
|
|
.DEFAULT_XKB_RULES = "\"evdev\"",
|
|
|
|
.DEFAULT_XKB_MODEL = "\"pc105\"",
|
|
|
|
.DEFAULT_XKB_LAYOUT = "\"us\"",
|
|
|
|
.DEFAULT_XKB_VARIANT = "NULL",
|
|
|
|
.DEFAULT_XKB_OPTIONS = "NULL",
|
|
|
|
|
|
|
|
.HAVE_STRNDUP = @as(i64, 1),
|
|
|
|
.HAVE_MMAP = @as(i64, 1),
|
|
|
|
});
|
|
|
|
|
|
|
|
// _ = b.run(&.{ "bison", "--defines=src/xkbcomp/parser.h", "-o", "src/xkbcomp/parser.c", "-p", "_xkbcommon_", "src/xkbcomp/parser.y" });
|
|
|
|
|
2024-02-21 12:28:59 -07:00
|
|
|
const xkbcommon = b.addStaticLibrary(.{
|
2024-02-21 12:09:51 -07:00
|
|
|
.name = "xkbcommon",
|
|
|
|
.target = target,
|
|
|
|
.optimize = optimize,
|
|
|
|
});
|
2024-02-21 12:28:59 -07:00
|
|
|
xkbcommon.root_module.c_std = .C11;
|
|
|
|
xkbcommon.addConfigHeader(config_header);
|
|
|
|
xkbcommon.addCSourceFiles(.{
|
2024-02-21 12:09:51 -07:00
|
|
|
.files = &.{
|
|
|
|
"src/compose/parser.c",
|
|
|
|
"src/compose/paths.c",
|
|
|
|
"src/compose/state.c",
|
|
|
|
"src/compose/table.c",
|
|
|
|
"src/xkbcomp/action.c",
|
|
|
|
"src/xkbcomp/ast-build.c",
|
|
|
|
"src/xkbcomp/compat.c",
|
|
|
|
"src/xkbcomp/expr.c",
|
|
|
|
"src/xkbcomp/include.c",
|
|
|
|
"src/xkbcomp/keycodes.c",
|
|
|
|
"src/xkbcomp/keymap.c",
|
|
|
|
"src/xkbcomp/keymap-dump.c",
|
|
|
|
"src/xkbcomp/keywords.c",
|
|
|
|
"src/xkbcomp/parser.c",
|
|
|
|
"src/xkbcomp/rules.c",
|
|
|
|
"src/xkbcomp/scanner.c",
|
|
|
|
"src/xkbcomp/symbols.c",
|
|
|
|
"src/xkbcomp/types.c",
|
|
|
|
"src/xkbcomp/vmod.c",
|
|
|
|
"src/xkbcomp/xkbcomp.c",
|
|
|
|
"src/atom.c",
|
|
|
|
"src/context.c",
|
|
|
|
"src/context-priv.c",
|
|
|
|
"src/keysym.c",
|
|
|
|
"src/keysym-utf.c",
|
|
|
|
"src/keymap.c",
|
|
|
|
"src/keymap-priv.c",
|
|
|
|
"src/state.c",
|
|
|
|
"src/text.c",
|
|
|
|
"src/utf8.c",
|
|
|
|
"src/utils.c",
|
|
|
|
},
|
|
|
|
});
|
2024-02-21 12:28:59 -07:00
|
|
|
xkbcommon.installHeadersDirectoryOptions(.{
|
2024-02-21 12:09:51 -07:00
|
|
|
.source_dir = .{ .path = "include/xkbcommon" },
|
|
|
|
.install_dir = .header,
|
|
|
|
.install_subdir = "xkbcommon",
|
|
|
|
});
|
2024-02-21 12:28:59 -07:00
|
|
|
xkbcommon.addIncludePath(.{ .path = "src" });
|
|
|
|
xkbcommon.addIncludePath(.{ .path = "include/" });
|
|
|
|
xkbcommon.linkLibC();
|
|
|
|
b.installArtifact(xkbcommon);
|
|
|
|
|
|
|
|
const zig_bindings = b.addModule("xkbcommon", .{
|
|
|
|
.root_source_file = .{ .path = "zig/xkbcommon.zig" },
|
|
|
|
});
|
|
|
|
zig_bindings.linkLibrary(xkbcommon);
|
2024-02-21 12:09:51 -07:00
|
|
|
}
|