Skip to content

Commit 0ea0f2d

Browse files
committed
use zlib from allyourcodebase
See #7 (comment)
1 parent b64a815 commit 0ea0f2d

2 files changed

Lines changed: 12 additions & 14 deletions

File tree

build.zig

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ pub fn build(b: *std.Build) void {
77
const strip = b.option(bool, "strip", "Omit debug information");
88
const sanitize_thread = b.option(bool, "sanitize_thread", "Enable thread sanitizer");
99

10+
const zlib_dep = b.dependency("zlib", .{
11+
.target = target,
12+
.optimize = optimize,
13+
});
14+
15+
const zlib = zlib_dep.artifact("z");
16+
1017
const upstream = b.dependency("nasm", .{});
1118

1219
const have_htole = if (target.result.os.tag != .windows and !target.result.os.tag.isDarwin()) true else null;
@@ -313,25 +320,12 @@ pub fn build(b: *std.Build) void {
313320
b.installArtifact(nasm);
314321
for (include_paths) |path| nasm.root_module.addIncludePath(path);
315322
nasm.root_module.linkLibrary(nasm_common);
316-
nasm.root_module.addIncludePath(upstream.path("zlib"));
323+
nasm.root_module.linkLibrary(zlib);
317324
nasm.root_module.addCSourceFiles(.{
318325
.root = upstream.path("asm"),
319326
.files = nasm_asm_sources,
320327
.flags = flags,
321328
});
322-
nasm.root_module.addCSourceFiles(.{
323-
.root = upstream.path("zlib"),
324-
.files = &.{
325-
"adler32.c",
326-
"crc32.c",
327-
"infback.c",
328-
"inffast.c",
329-
"inflate.c",
330-
"inftrees.c",
331-
"zutil.c",
332-
},
333-
.flags = flags,
334-
});
335329

336330
const ndisasm = b.addExecutable(.{
337331
.name = "ndisasm",

build.zig.zon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88
.url = "https://www.nasm.us/pub/nasm/releasebuilds/3.01/nasm-3.01.tar.gz",
99
.hash = "N-V-__8AAEAMKAFrNesgN6ZM9sxj37fq_i7UJe5nKkLmyRJI",
1010
},
11+
.zlib = .{
12+
.url = "git+https://github.com/allyourcodebase/zlib.git#c5115f4b69ef660f72a835c6638f80508ef284c7",
13+
.hash = "zlib-1.3.1-1-ZZQ7ldENAAA7qJjUXP6E6xnRuV-jDL9dyoJFc_eb3zQ6",
14+
},
1115
},
1216
.paths = .{
1317
"build.zig.zon",

0 commit comments

Comments
 (0)