-
Notifications
You must be signed in to change notification settings - Fork 24
Expand file tree
/
Copy pathzlib.zig
More file actions
48 lines (44 loc) · 1.13 KB
/
Copy pathzlib.zig
File metadata and controls
48 lines (44 loc) · 1.13 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
41
42
43
44
45
46
47
48
const std = @import("std");
pub fn create(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std.builtin.OptimizeMode, sanitize_c: ?std.zig.SanitizeC) ?*std.Build.Step.Compile {
const module = b.createModule(.{
.target = target,
.optimize = optimize,
.link_libc = true,
.sanitize_c = sanitize_c,
});
const lib = b.addLibrary(.{
.linkage = .static,
.name = "z",
.root_module = module,
});
const zlib_dep = b.lazyDependency("zlib", .{
.target = target,
.optimize = optimize,
}) orelse return null;
inline for (srcs) |s| {
module.addCSourceFile(.{
.file = zlib_dep.path(s),
.flags = &.{"-std=c89"},
});
}
lib.installHeader(zlib_dep.path("zlib.h"), "zlib.h");
lib.installHeader(zlib_dep.path("zconf.h"), "zconf.h");
return lib;
}
const srcs = &.{
"adler32.c",
"compress.c",
"crc32.c",
"deflate.c",
"gzclose.c",
"gzlib.c",
"gzread.c",
"gzwrite.c",
"inflate.c",
"infback.c",
"inftrees.c",
"inffast.c",
"trees.c",
"uncompr.c",
"zutil.c",
};