-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathbuild.zig
60 lines (54 loc) · 1.65 KB
/
build.zig
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
49
50
51
52
53
54
55
56
57
58
59
60
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lib = b.addStaticLibrary(.{
.name = "brotli",
.target = target,
.optimize = optimize,
});
lib.linkLibC();
lib.addIncludePath(b.path("c/include"));
lib.addCSourceFiles(.{ .files = &sources, .flags = &.{} });
lib.installHeadersDirectory(b.path("c/include/brotli"), "brotli", .{});
switch (target.result.os.tag) {
.linux => lib.root_module.addCMacro("OS_LINUX", "1"),
.freebsd => lib.root_module.addCMacro("OS_FREEBSD", "1"),
.macos => lib.root_module.addCMacro("OS_MACOSX", "1"),
else => {},
}
b.installArtifact(lib);
}
const sources = [_][]const u8{
"c/common/constants.c",
"c/common/context.c",
"c/common/dictionary.c",
"c/common/platform.c",
"c/common/shared_dictionary.c",
"c/common/transform.c",
"c/dec/bit_reader.c",
"c/dec/decode.c",
"c/dec/huffman.c",
"c/dec/state.c",
"c/enc/backward_references.c",
"c/enc/backward_references_hq.c",
"c/enc/bit_cost.c",
"c/enc/block_splitter.c",
"c/enc/brotli_bit_stream.c",
"c/enc/cluster.c",
"c/enc/command.c",
"c/enc/compound_dictionary.c",
"c/enc/compress_fragment.c",
"c/enc/compress_fragment_two_pass.c",
"c/enc/dictionary_hash.c",
"c/enc/encode.c",
"c/enc/encoder_dict.c",
"c/enc/entropy_encode.c",
"c/enc/fast_log.c",
"c/enc/histogram.c",
"c/enc/literal_cost.c",
"c/enc/memory.c",
"c/enc/metablock.c",
"c/enc/static_dict.c",
"c/enc/utf8_util.c",
};