Skip to content

Commit 7404914

Browse files
committed
update to zig 0.14.0
1 parent 9552134 commit 7404914

File tree

3 files changed

+23
-16
lines changed

3 files changed

+23
-16
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
zig-version: ["0.13.0"]
17+
zig-version: [master]
1818
os: [ubuntu-latest, macos-latest, windows-latest]
1919
include:
20-
- zig-version: "0.12.1"
20+
- zig-version: "0.14.0"
2121
os: ubuntu-latest
2222
runs-on: ${{ matrix.os }}
2323
steps:

build.zig

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pub fn build(b: *std.Build) void {
55
const target = b.standardTargetOptions(.{});
66
const optimize = b.standardOptimizeOption(.{});
77

8+
const linkage = b.option(std.builtin.LinkMode, "linkage", "Link mode") orelse .static;
89
const strip = b.option(bool, "strip", "Omit debug information");
910
const pic = b.option(bool, "pie", "Produce Position Independent Code");
1011

@@ -30,16 +31,19 @@ pub fn build(b: *std.Build) void {
3031
const exclude_compressors_dfast_and_up = b.option(bool, "exclude-compressors-dfast-and-up", "") orelse false;
3132
const exclude_compressors_greedy_and_up = b.option(bool, "exclude-compressors-greedy-and-up", "") orelse false;
3233

33-
const zstd = b.addStaticLibrary(.{
34+
const zstd = b.addLibrary(.{
35+
.linkage = linkage,
3436
.name = "zstd",
35-
.target = target,
36-
.optimize = optimize,
37-
.strip = strip,
38-
.pic = pic,
39-
.link_libc = true,
37+
.root_module = b.createModule(.{
38+
.target = target,
39+
.optimize = optimize,
40+
.strip = strip,
41+
.pic = pic,
42+
.link_libc = true,
43+
}),
4044
});
4145
b.installArtifact(zstd);
42-
zstd.addCSourceFiles(.{ .root = upstream.path("lib"), .files = common_sources });
46+
zstd.root_module.addCSourceFiles(.{ .root = upstream.path("lib"), .files = common_sources });
4347
// zstd does not install into its own subdirectory. :(
4448
zstd.installHeader(upstream.path("lib/zstd.h"), "zstd.h");
4549
zstd.installHeader(upstream.path("lib/zdict.h"), "zdict.h");
@@ -54,7 +58,7 @@ pub fn build(b: *std.Build) void {
5458

5559
if (target.result.cpu.arch == .x86_64) {
5660
if (decompression) {
57-
zstd.addAssemblyFile(upstream.path("lib/decompress/huf_decompress_amd64.S"));
61+
zstd.root_module.addAssemblyFile(upstream.path("lib/decompress/huf_decompress_amd64.S"));
5862
}
5963
} else {
6064
zstd.root_module.addCMacro("ZSTD_DISABLE_ASM", "");
@@ -101,8 +105,10 @@ pub fn build(b: *std.Build) void {
101105
for (examples) |name| {
102106
const exe = b.addExecutable(.{
103107
.name = name,
104-
.target = target,
105-
.optimize = optimize,
108+
.root_module = b.createModule(.{
109+
.target = target,
110+
.optimize = optimize,
111+
}),
106112
});
107113
exe.addCSourceFile(.{ .file = upstream.path(b.fmt("examples/{s}.c", .{name})) });
108114
exe.addIncludePath(upstream.path("examples/common.c"));

build.zig.zon

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
.{
2-
.name = "zstd",
2+
.name = .zstd,
33
.version = "1.5.7",
4-
.minimum_zig_version = "0.12.0",
4+
.minimum_zig_version = "0.14.0",
55
.dependencies = .{
66
.zstd = .{
7-
.url = "git+https://github.com/facebook/zstd#v1.5.7",
8-
.hash = "1220001b05f0bec9e5fda3971462d94de602bb458186e117afdeaed3ea36cb5677ef",
7+
.url = "git+https://github.com/facebook/zstd.git?ref=v1.5.7#f8745da6ff1ad1e7bab384bd1f9d742439278e99",
8+
.hash = "N-V-__8AAGxifwAAGwXwvsnl_aOXFGLZTeYCu0WBhuEXr96u",
99
},
1010
},
1111
.paths = .{
@@ -15,4 +15,5 @@
1515
"LICENSE-ZSTD",
1616
"README.md",
1717
},
18+
.fingerprint = 0x72fd505e902d4228, // Changing this has security and trust implications.
1819
}

0 commit comments

Comments
 (0)