Skip to content

Commit bf5f82a

Browse files
vanclueverpluiedev
andcommitted
Update to Zig 0.16.0
This commit represents the majority of the work necessary to upgrade Ghostty to use Zig 0.16.0. At this point, the project builds, tests, and runs under Linux. More work may be necessary for other platforms, and possibly to fix any (currently unknown) upgrade regressions. Co-authored-by: Leah Amelia Chen <hi@pluie.me>
1 parent f9194f9 commit bf5f82a

316 files changed

Lines changed: 7196 additions & 4910 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.clang-format

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,4 +179,3 @@ WhitespaceSensitiveMacros:
179179
- PP_STRINGIZE
180180
- BOOST_PP_STRINGIZE
181181
---
182-

.github/workflows/test.yml

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1196,9 +1196,29 @@ jobs:
11961196
- name: Test GTK Build
11971197
run: nix develop -c zig build -Dapp-runtime=gtk -Demit-docs -Demit-webdata
11981198

1199-
# This relies on the cache being populated by the commands above.
1199+
# NOTE: This used to point to the Zig global cache directory before
1200+
# 0.16.0. Now, the cache directory exclusively stores "minified"
1201+
# archives of each dependency (i.e., only the paths defined in
1202+
# build.zig.zon), and an uncompressed, working copy is stored in
1203+
# PROJECT_ROOT/zig-pkg. The zig-pkg directory is warmed up during the
1204+
# regular fetching process from the global cache directory if
1205+
# possible.
1206+
#
1207+
# Nothing else should change; zon2nix's store path mimics what a
1208+
# zig-pkg directory should look like, so actual build steps should be
1209+
# fine, it's just here where we assume that all dependencies have been
1210+
# downloaded, and we want to test the validity of the package
1211+
# directory, do we need to have it pointing to zig-pkg and not the
1212+
# zon2nix store path.
1213+
#
1214+
# Note that this can also be attempted by running:
1215+
# zig build --fetch=needed
1216+
#
1217+
# Note that --system PKGDIR should not be added to this invocation as
1218+
# it disables fetching altogether (even, seemingly, from the local
1219+
# cache).
12001220
- name: Test System Build
1201-
run: nix develop -c zig build --system ${ZIG_GLOBAL_CACHE_DIR}/p
1221+
run: nix develop -c zig build --system "$(realpath zig-pkg)"
12021222

12031223
test-lib-vt:
12041224
if: github.repository == 'ghostty-org/ghostty' && needs.skip.outputs.skip != 'true'

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
zig-cache/
1111
.zig-cache/
1212
zig-out/
13+
zig-pkg/
1314
build-cmake/
1415
CMakeCache.txt
1516
CMakeFiles/
@@ -29,3 +30,4 @@ glad.zip
2930

3031
vgcore.*
3132

33+
/sprite_face_test*

build.zig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,10 @@ pub fn build(b: *std.Build) !void {
2525
// use that as the version source of truth. Otherwise we fall back
2626
// to what is in the build.zig.zon.
2727
const file_version: ?[]const u8 = if (b.build_root.handle.readFileAlloc(
28-
b.allocator,
28+
b.graph.io,
2929
"VERSION",
30-
128,
30+
b.allocator,
31+
.limited(128),
3132
)) |content| std.mem.trim(
3233
u8,
3334
content,
@@ -298,7 +299,7 @@ pub fn build(b: *std.Build) !void {
298299
// We need to rebuild Ghostty with a baseline CPU target.
299300
const valgrind_exe = exe: {
300301
var valgrind_config = config;
301-
valgrind_config.target = valgrind_config.baselineTarget();
302+
valgrind_config.target = valgrind_config.baselineTarget(b.graph.io);
302303
break :exe try buildpkg.GhosttyExe.init(
303304
b,
304305
&valgrind_config,
@@ -343,7 +344,7 @@ pub fn build(b: *std.Build) !void {
343344
.filters = test_filters,
344345
.root_module = b.createModule(.{
345346
.root_source_file = b.path("src/main.zig"),
346-
.target = config.baselineTarget(),
347+
.target = config.baselineTarget(b.graph.io),
347348
.optimize = .Debug,
348349
.strip = false,
349350
.omit_frame_pointer = false,
@@ -358,7 +359,7 @@ pub fn build(b: *std.Build) !void {
358359
// Verify our internal libghostty header.
359360
const ghostty_h = b.addTranslateC(.{
360361
.root_source_file = b.path("include/ghostty.h"),
361-
.target = config.baselineTarget(),
362+
.target = config.baselineTarget(b.graph.io),
362363
.optimize = .Debug,
363364
});
364365
test_exe.root_module.addImport("ghostty.h", ghostty_h.createModule());

build.zig.zon

Lines changed: 29 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,62 +3,71 @@
33
.version = "1.3.2-dev",
44
.paths = .{""},
55
.fingerprint = 0x64407a2a0b4147e5,
6-
.minimum_zig_version = "0.15.2",
6+
.minimum_zig_version = "0.16.0",
77
.dependencies = .{
8-
// Zig libs
8+
// External translate-c
9+
// NOTE: We might not need to keep this around forever, but we need it
10+
// for at least the 0.16.0 release cycle since we need fixes in
11+
// Aro/translate-c itself.
12+
.translate_c = .{
13+
.lazy = true,
14+
.url = "https://codeberg.org/vancluever/translate-c/archive/a5bc193c925b03f74d44e1a4b29c117822473b91.tar.gz",
15+
.hash = "translate_c-0.0.0-Q_BUWhFXBwBZBr7EnRC97AKPYXbwHkpcc4TASklMqZu9",
16+
},
917

18+
// Zig libs
1019
.libxev = .{
1120
// mitchellh/libxev
12-
.url = "https://deps.files.ghostty.org/libxev-34fa50878aec6e5fa8f532867001ab3c36fae23e.tar.gz",
13-
.hash = "libxev-0.0.0-86vtc4IcEwCqEYxEYoN_3KXmc6A9VLcm22aVImfvecYs",
21+
.url = "https://github.com/mitchellh/libxev/archive/9ce8e8e6ff89e583258a7f8e7adeeeaeae8611bf.tar.gz",
22+
.hash = "libxev-0.0.0-86vtcwIRFADbH4hk-EjROXxlrKIRPQdA41XiTSytYO-F",
1423
.lazy = true,
1524
},
1625
.vaxis = .{
1726
// rockorager/libvaxis
18-
.url = "https://deps.files.ghostty.org/vaxis-7dbb9fd3122e4ffad262dd7c151d80d863b68558.tar.gz",
19-
.hash = "vaxis-0.5.1-BWNV_LosCQAGmCCNOLljCIw6j6-yt53tji6n6rwJ2BhS",
27+
.url = "https://github.com/rockorager/libvaxis/archive/1dbbe575dff4586fe51e3217aa5c3fecdcbb6089.tar.gz",
28+
.hash = "vaxis-0.6.0-BWNV_CrbCQCscGpzsAlR402rYQ_tV3aAl081c2iRRkka",
2029
.lazy = true,
2130
},
2231
.z2d = .{
2332
// vancluever/z2d
24-
.url = "https://deps.files.ghostty.org/z2d-0.10.0-j5P_Hu-6FgBsZNgwphIqh17jDnj8_yPtD8yzjO6PpHRQ.tar.gz",
25-
.hash = "z2d-0.10.0-j5P_Hu-6FgBsZNgwphIqh17jDnj8_yPtD8yzjO6PpHRQ",
33+
.url = "https://github.com/vancluever/z2d/archive/refs/tags/v0.11.0.tar.gz",
34+
.hash = "z2d-0.11.0-j5P_HtLzDwBGyQt49DrT0v4BuVqI_SRs6CXsuj7eBVhR",
2635
.lazy = true,
2736
},
2837
.zig_objc = .{
2938
// mitchellh/zig-objc
30-
.url = "https://deps.files.ghostty.org/zig_objc-f356ed02833f0f1b8e84d50bed9e807bf7cdc0ae.tar.gz",
31-
.hash = "zig_objc-0.0.0-Ir_Sp5gTAQCvxxR7oVIrPXxXwsfKgVP7_wqoOQrZjFeK",
39+
.url = "https://github.com/mitchellh/zig-objc/archive/c8de82ff80281215ad92900866dab7103a8efa8b.tar.gz",
40+
.hash = "zig_objc-0.0.0-Ir_Sp9gsAQCPAJc0oF5xoWePHWP6Y6tCphDeyNUThJoi",
3241
.lazy = true,
3342
},
3443
.zig_js = .{
3544
// mitchellh/zig-js
36-
.url = "https://deps.files.ghostty.org/zig_js-04db83c617da1956ac5adc1cb9ba1e434c1cb6fd.tar.gz",
37-
.hash = "zig_js-0.0.0-rjCAV-6GAADxFug7rDmPH-uM_XcnJ5NmuAMJCAscMjhi",
45+
.url = "https://github.com/mitchellh/zig-js/archive/3c23860e47fdcdc5af805efb7fd0bdac5fd3e9bc.tar.gz",
46+
.hash = "zig_js-0.0.0-rjCAV7-GAADvMTBL7lPMuvDk7xgS9PCMIZWiOUXLZSlj",
3847
.lazy = true,
3948
},
4049
.uucode = .{
4150
// jacobsandlund/uucode
42-
.url = "https://deps.files.ghostty.org/uucode-0.2.0-ZZjBPqZVVABQepOqZHR7vV_NcaN-wats0IB6o-Exj6m9.tar.gz",
43-
.hash = "uucode-0.2.0-ZZjBPqZVVABQepOqZHR7vV_NcaN-wats0IB6o-Exj6m9",
51+
.url = "https://github.com/jacobsandlund/uucode/archive/2826a37a4562284fdacd8fa029d49509cc9bffcd.tar.gz",
52+
.hash = "uucode-0.2.0-ZZjBPlK5VADj7fdoq7G8LIHzD5o6FSkcBXXrRWr4jnrA",
4453
},
4554
.zig_wayland = .{
4655
// codeberg ifreund/zig-wayland
47-
.url = "https://deps.files.ghostty.org/zig_wayland-1b5c038ec10da20ed3a15b0b2a6db1c21383e8ea.tar.gz",
48-
.hash = "wayland-0.5.0-dev-lQa1khrMAQDJDwYFKpdH3HizherB7sHo5dKMECfvxQHe",
56+
.url = "https://codeberg.org/ifreund/zig-wayland/archive/v0.6.0.tar.gz",
57+
.hash = "wayland-0.6.0-lQa1kqz8AQADQmdNJsNhLoNHcnEGEUjrOaPV-dtEnEmX",
4958
.lazy = true,
5059
},
5160
.zf = .{
5261
// natecraddock/zf
53-
.url = "https://deps.files.ghostty.org/zf-3c52637b7e937c5ae61fd679717da3e276765b23.tar.gz",
54-
.hash = "zf-0.10.3-OIRy8RuJAACKA3Lohoumrt85nRbHwbpMcUaLES8vxDnh",
62+
.url = "https://github.com/natecraddock/zf/archive/c35c421f84895193246db06c40683c1a30e616ef.tar.gz",
63+
.hash = "zf-0.11.0-OIRy8X-RAAAwaRXHMYpj2uvBnuGTZWEE_3V7acqHQNtW",
5564
.lazy = true,
5665
},
5766
.gobject = .{
5867
// https://github.com/ghostty-org/zig-gobject based on zig_gobject
5968
// Temporary until we generate them at build time automatically.
60-
.url = "https://deps.files.ghostty.org/gobject-2025-11-08-23-1.tar.zst",
61-
.hash = "gobject-0.3.0-Skun7ANLnwDvEfIpVmohcppXgOvg_I6YOJFmPIsKfXk-",
69+
.url = "https://github.com/ghostty-org/zig-gobject/releases/download/0.8.0-2026-04-23-26-1/ghostty-gobject-0.8.0-2026-04-23-26-1.tar.zst",
70+
.hash = "gobject-0.3.1-Skun7E1KnwBGMX5nslHYG1yWHaSevywxQO8oM7tTOgIp",
6271
.lazy = true,
6372
},
6473

build.zig.zon.json

Lines changed: 44 additions & 34 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)