forked from neurocyte/gpm-zig
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.zig
More file actions
40 lines (34 loc) · 1.2 KB
/
build.zig
File metadata and controls
40 lines (34 loc) · 1.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
const std = @import("std");
fn package_dir() []const u8 {
return std.fs.path.dirname(@src().file) orelse ".";
}
const src_path = package_dir() ++ std.fs.path.sep_str ++ "src";
const source_files = [_][]const u8{
"src/tools.c",
// "src/lib/libcurses.c",
"src/lib/libhigh.c",
"src/lib/libxtra.c",
"src/lib/report-lib.c",
};
const flags = [_][]const u8{};
pub fn build(b: *std.Build) void {
const lib = b.addStaticLibrary(.{
.name = "gpm",
.target = b.standardTargetOptions(.{}),
.optimize = b.standardOptimizeOption(.{}),
});
lib.defineCMacro("GPM_ABI_LEV", "2");
lib.defineCMacro("GPM_ABI_AGE", "1");
lib.defineCMacro("GPM_ABI_REV", "0");
lib.defineCMacro("GPM_ABI_FULL", "\"2.1.0\"");
lib.defineCMacro("SBINDIR", "\"/usr/bin\"");
lib.linkLibC();
lib.addIncludePath(b.path("src"));
for (source_files) |file| {
lib.addCSourceFiles(.{ .files = &[_][]const u8{file}, .flags = &flags });
}
if (lib.rootModuleTarget().os.tag == .linux)
lib.addCSourceFiles(.{ .files = &[_][]const u8{"src/lib/liblow.c"}, .flags = &flags });
b.installArtifact(lib);
lib.installHeader(b.path("src/headers/gpm.h"), "gpm.h");
}