84 lines
2.9 KiB
Zig
84 lines
2.9 KiB
Zig
|
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" });
|
||
|
|
||
|
const lib = b.addStaticLibrary(.{
|
||
|
.name = "xkbcommon",
|
||
|
.target = target,
|
||
|
.optimize = optimize,
|
||
|
});
|
||
|
lib.root_module.c_std = .C11;
|
||
|
lib.addConfigHeader(config_header);
|
||
|
lib.addCSourceFiles(.{
|
||
|
.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",
|
||
|
},
|
||
|
});
|
||
|
lib.installHeadersDirectoryOptions(.{
|
||
|
.source_dir = .{ .path = "include/xkbcommon" },
|
||
|
.install_dir = .header,
|
||
|
.install_subdir = "xkbcommon",
|
||
|
});
|
||
|
lib.addIncludePath(.{ .path = "src" });
|
||
|
lib.addIncludePath(.{ .path = "include/" });
|
||
|
lib.linkLibC();
|
||
|
b.installArtifact(lib);
|
||
|
}
|