Skip to content

Commit e33b92c

Browse files
committed
Fix build for Zig 0.16.0-dev.1657+985a3565c, drop 0.14.x support
1 parent feedf45 commit e33b92c

File tree

3 files changed

+22
-24
lines changed

3 files changed

+22
-24
lines changed

.github/workflows/ci.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ jobs:
1212
strategy:
1313
fail-fast: false
1414
matrix:
15-
zig-version: [0.15.1]
1615
os: [ubuntu-latest, macos-latest, windows-latest]
1716
runs-on: ${{ matrix.os }}
1817
steps:
@@ -27,8 +26,6 @@ jobs:
2726
2827
- name: Setup Zig
2928
uses: mlugg/setup-zig@v2
30-
with:
31-
version: ${{ matrix.zig-version }}
3229

3330
- name: Check Formatting
3431
run: zig fmt --ast-check --check .

build.zig

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,29 +6,30 @@ pub fn build(b: *std.Build) void {
66
const sanitize_c_type = @typeInfo(@FieldType(std.Build.Module.CreateOptions, "sanitize_c")).optional.child;
77
const sanitize_c = b.option(sanitize_c_type, "sanitize-c", "Detect undefined behavior in C");
88
const harfbuzz_enabled = b.option(bool, "enable-harfbuzz", "Use HarfBuzz to improve text shaping") orelse true;
9-
10-
const upstream = b.dependency("SDL_ttf", .{});
11-
129
const preferred_linkage = b.option(
1310
std.builtin.LinkMode,
1411
"preferred_linkage",
1512
"Prefer building statically or dynamically linked libraries (default: static)",
1613
) orelse .static;
1714

15+
const upstream = b.dependency("SDL_ttf", .{});
16+
17+
const mod = b.createModule(.{
18+
.target = target,
19+
.optimize = optimize,
20+
.link_libc = true,
21+
.sanitize_c = sanitize_c,
22+
});
23+
1824
const lib = b.addLibrary(.{
1925
.name = "SDL3_ttf",
2026
.version = .{ .major = 3, .minor = 2, .patch = 2 },
2127
.linkage = preferred_linkage,
22-
.root_module = b.createModule(.{
23-
.target = target,
24-
.optimize = optimize,
25-
.link_libc = true,
26-
.sanitize_c = sanitize_c,
27-
}),
28+
.root_module = mod,
2829
});
29-
lib.addIncludePath(upstream.path("include"));
30-
lib.addIncludePath(upstream.path("src"));
31-
lib.addCSourceFiles(.{
30+
mod.addIncludePath(upstream.path("include"));
31+
mod.addIncludePath(upstream.path("src"));
32+
mod.addCSourceFiles(.{
3233
.root = upstream.path("src"),
3334
.files = srcs,
3435
});
@@ -38,22 +39,22 @@ pub fn build(b: *std.Build) void {
3839
.target = target,
3940
.optimize = optimize,
4041
});
41-
lib.linkLibrary(harfbuzz_dep.artifact("harfbuzz"));
42-
lib.root_module.addCMacro("TTF_USE_HARFBUZZ", "1");
42+
mod.linkLibrary(harfbuzz_dep.artifact("harfbuzz"));
43+
mod.addCMacro("TTF_USE_HARFBUZZ", "1");
4344
}
4445

4546
const freetype_dep = b.dependency("freetype", .{
4647
.target = target,
4748
.optimize = optimize,
4849
});
49-
lib.linkLibrary(freetype_dep.artifact("freetype"));
50+
mod.linkLibrary(freetype_dep.artifact("freetype"));
5051

5152
const sdl = b.dependency("SDL", .{
5253
.target = target,
5354
.optimize = optimize,
5455
.preferred_linkage = preferred_linkage,
5556
}).artifact("SDL3");
56-
lib.linkLibrary(sdl);
57+
mod.linkLibrary(sdl);
5758

5859
lib.installHeadersDirectory(upstream.path("include"), "", .{});
5960

build.zig.zon

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@
22
.name = .SDL_ttf,
33
.version = "3.2.2",
44
.fingerprint = 0xa98f7681c4b9d53c,
5-
.minimum_zig_version = "0.15.1",
5+
.minimum_zig_version = "0.15.2",
66
.dependencies = .{
77
.harfbuzz = .{
8-
.url = "git+https://github.com/allyourcodebase/harfbuzz#6bb522d22cee0ce1d1446bd59fa5b0417f25303e",
9-
.hash = "harfbuzz-8.5.0-Ip1VAqCZAADRh-K2AVujG0N3VAal-AKwkZrvlYOaloyB",
8+
.url = "git+https://github.com/allyourcodebase/harfbuzz#da947143173370b8123ef93f21353d58ce6e6d65",
9+
.hash = "harfbuzz-12.2.0-Ip1VAuGZAAD2dBKDBtAW50eyC9VhSmXFlupI1vCNTFL4",
1010
},
1111
.freetype = .{
12-
.url = "git+https://github.com/allyourcodebase/freetype#9d847affbd224cf6a7303ad6d98715e3675ef78c",
13-
.hash = "freetype-2.13.3-C3-WdeyJAAD9z8BeYYQ8N3gNlPI9NvHRxg5039S5vhz7",
12+
.url = "git+https://github.com/allyourcodebase/freetype#f2f3f662cfc6cf7be2d39d8373c6e6b91297ced8",
13+
.hash = "freetype-2.14.1-C3-WdWqKAADgPV0BhYffbFweY71Qns18mICAEtclm1a6",
1414
},
1515
.SDL = .{
1616
.url = "git+https://github.com/castholm/SDL?ref=v0.3.3+3.2.28#2cde21ea89c7b67d6e16f7f1e2faaa6f44618ecb",

0 commit comments

Comments
 (0)