From a30e791c8582c33b5950db2fe40abe6215554e5d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 8 Jun 2024 19:51:44 -0700 Subject: [PATCH 01/13] begin 0.13 update process -- very broken --- build.zig | 2 +- build.zig.zon | 4 ++-- flake.lock | 22 +++++++++++++++++++--- flake.nix | 2 +- pkg/cimgui/build.zig | 10 +++++----- pkg/fontconfig/build.zig | 8 ++++---- pkg/freetype/build.zig | 8 ++++---- pkg/glslang/build.zig | 8 ++++---- pkg/harfbuzz/build.zig | 4 ++-- pkg/highway/build.zig | 4 ++-- pkg/libpng/build.zig | 4 ++-- pkg/libxml2/build.zig | 8 ++++---- pkg/macos/build.zig | 8 ++++---- pkg/oniguruma/build.zig | 4 ++-- pkg/opengl/build.zig | 4 ++-- pkg/pixman/build.zig | 10 +++++----- pkg/simdutf/build.zig | 4 ++-- pkg/spirv-cross/build.zig | 4 ++-- 18 files changed, 67 insertions(+), 51 deletions(-) diff --git a/build.zig b/build.zig index 84a0c5476..26306ae6c 100644 --- a/build.zig +++ b/build.zig @@ -1017,7 +1017,7 @@ fn addDeps( // on x86_64. if (step.rootModuleTarget().os.tag == .linux) { const triple = try step.rootModuleTarget().linuxTriple(b.allocator); - step.addLibraryPath(.{ .path = b.fmt("/usr/lib/{s}", .{triple}) }); + step.addLibraryPath(b.path(b.fmt("/usr/lib/{s}", .{triple}))); } // C files diff --git a/build.zig.zon b/build.zig.zon index 80d9c6fcf..ab4008a30 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,8 +5,8 @@ .dependencies = .{ // Zig libs .libxev = .{ - .url = "https://github.com/mitchellh/libxev/archive/efde8a170836334901ed2d59c98bf832eb48ae3a.tar.gz", - .hash = "1220bf10f4fc109ca0b50520075e2e730900956e220adee616a01f3f91bc8a802695", + .url = "https://github.com/mitchellh/libxev/archive/f6a672a78436d8efee1aa847a43a900ad773618b.tar.gz", + .hash = "12207b7a5b538ffb7fb18f954ae17d2f8490b6e3778a9e30564ad82c58ee8da52361", }, .mach_glfw = .{ .url = "https://github.com/mitchellh/mach-glfw/archive/20c773d86df269722d8926f98bc8af26ebd90999.tar.gz", diff --git a/flake.lock b/flake.lock index 41477c510..5b0570c08 100644 --- a/flake.lock +++ b/flake.lock @@ -16,6 +16,22 @@ "type": "github" } }, + "flake-compat_2": { + "flake": false, + "locked": { + "lastModified": 1673956053, + "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", + "owner": "edolstra", + "repo": "flake-compat", + "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", + "type": "github" + }, + "original": { + "owner": "edolstra", + "repo": "flake-compat", + "type": "github" + } + }, "flake-utils": { "inputs": { "systems": "systems" @@ -197,11 +213,11 @@ ] }, "locked": { - "lastModified": 1719231019, - "narHash": "sha256-ZHU2A+xs7I5rqDagBtnGPc+GyIwhMaa8Za9h+8qTCiw=", + "lastModified": 1717848532, + "narHash": "sha256-d+xIUvSTreHl8pAmU1fnmkfDTGQYCn2Rb/zOwByxS2M=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "1141abbf0c667677569c887bfbb1500039b5295e", + "rev": "02fc5cc555fc14fda40c42d7c3250efa43812b43", "type": "github" }, "original": { diff --git a/flake.nix b/flake.nix index 7fce24dfe..f8a7f57b7 100644 --- a/flake.nix +++ b/flake.nix @@ -39,7 +39,7 @@ inherit (pkgs-unstable) tracy; inherit (zls.packages.${system}) zls; - zig = zig.packages.${system}."0.12.1"; + zig = zig.packages.${system}."0.13.0"; wraptest = pkgs-stable.callPackage ./nix/wraptest.nix {}; }; diff --git a/pkg/cimgui/build.zig b/pkg/cimgui/build.zig index 6a3607cf5..94163ed98 100644 --- a/pkg/cimgui/build.zig +++ b/pkg/cimgui/build.zig @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) !void { const optimize = b.standardOptimizeOption(.{}); const module = b.addModule("cimgui", .{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); @@ -30,7 +30,7 @@ pub fn build(b: *std.Build) !void { } lib.addIncludePath(imgui.path("")); - module.addIncludePath(.{ .path = "vendor" }); + module.addIncludePath(b.path("vendor")); var flags = std.ArrayList([]const u8).init(b.allocator); defer flags.deinit(); @@ -49,7 +49,7 @@ pub fn build(b: *std.Build) !void { }); } - lib.addCSourceFile(.{ .file = .{ .path = "vendor/cimgui.cpp" }, .flags = flags.items }); + lib.addCSourceFile(.{ .file = b.path("vendor/cimgui.cpp"), .flags = flags.items }); lib.addCSourceFile(.{ .file = imgui.path("imgui.cpp"), .flags = flags.items }); lib.addCSourceFile(.{ .file = imgui.path("imgui_draw.cpp"), .flags = flags.items }); lib.addCSourceFile(.{ .file = imgui.path("imgui_demo.cpp"), .flags = flags.items }); @@ -80,7 +80,7 @@ pub fn build(b: *std.Build) !void { } lib.installHeadersDirectory( - .{ .path = "vendor" }, + b.path("vendor"), "", .{ .include_extensions = &.{".h"} }, ); @@ -89,7 +89,7 @@ pub fn build(b: *std.Build) !void { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/pkg/fontconfig/build.zig b/pkg/fontconfig/build.zig index 2882eae96..ed66d61a5 100644 --- a/pkg/fontconfig/build.zig +++ b/pkg/fontconfig/build.zig @@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void { ) orelse (target.result.os.tag != .windows); const freetype_enabled = b.option(bool, "enable-freetype", "Build freetype") orelse true; - const module = b.addModule("fontconfig", .{ .root_source_file = .{ .path = "main.zig" } }); + const module = b.addModule("fontconfig", .{ .root_source_file = b.path("main.zig") }); const upstream = b.dependency("fontconfig", .{}); const lib = b.addStaticLibrary(.{ @@ -39,9 +39,9 @@ pub fn build(b: *std.Build) !void { } lib.addIncludePath(upstream.path("")); - lib.addIncludePath(.{ .path = "override/include" }); + lib.addIncludePath(b.path("override/include")); module.addIncludePath(upstream.path("")); - module.addIncludePath(.{ .path = "override/include" }); + module.addIncludePath(b.path("override/include")); var flags = std.ArrayList([]const u8).init(b.allocator); defer flags.deinit(); @@ -172,7 +172,7 @@ pub fn build(b: *std.Build) !void { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/pkg/freetype/build.zig b/pkg/freetype/build.zig index 9819c5328..f62c6e487 100644 --- a/pkg/freetype/build.zig +++ b/pkg/freetype/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void { const optimize = b.standardOptimizeOption(.{}); const libpng_enabled = b.option(bool, "enable-libpng", "Build libpng") orelse false; - const module = b.addModule("freetype", .{ .root_source_file = .{ .path = "main.zig" } }); + const module = b.addModule("freetype", .{ .root_source_file = b.path("main.zig") }); const upstream = b.dependency("freetype", .{}); const lib = b.addStaticLibrary(.{ @@ -21,7 +21,7 @@ pub fn build(b: *std.Build) !void { } module.addIncludePath(upstream.path("include")); - module.addIncludePath(.{ .path = "" }); + module.addIncludePath(b.path("")); // Dependencies const zlib_dep = b.dependency("zlib", .{ .target = target, .optimize = optimize }); @@ -81,7 +81,7 @@ pub fn build(b: *std.Build) !void { }), } - lib.installHeader(.{ .path = "freetype-zig.h" }, "freetype-zig.h"); + lib.installHeader(b.path("freetype-zig.h"), "freetype-zig.h"); lib.installHeadersDirectory( upstream.path("include"), "", @@ -93,7 +93,7 @@ pub fn build(b: *std.Build) !void { if (target.query.isNative()) { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/pkg/glslang/build.zig b/pkg/glslang/build.zig index e25fd67ee..35cffc01e 100644 --- a/pkg/glslang/build.zig +++ b/pkg/glslang/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void { const optimize = b.standardOptimizeOption(.{}); const module = b.addModule("glslang", .{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) !void { b.installArtifact(lib); module.addIncludePath(upstream.path("")); - module.addIncludePath(.{ .path = "override" }); + module.addIncludePath(b.path("override")); if (target.result.isDarwin()) { const apple_sdk = @import("apple_sdk"); try apple_sdk.addPaths(b, module); @@ -24,7 +24,7 @@ pub fn build(b: *std.Build) !void { if (target.query.isNative()) { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); @@ -52,7 +52,7 @@ fn buildGlslang( lib.linkLibC(); lib.linkLibCpp(); lib.addIncludePath(upstream.path("")); - lib.addIncludePath(.{ .path = "override" }); + lib.addIncludePath(b.path("override")); if (target.result.isDarwin()) { const apple_sdk = @import("apple_sdk"); try apple_sdk.addPaths(b, &lib.root_module); diff --git a/pkg/harfbuzz/build.zig b/pkg/harfbuzz/build.zig index 45d242699..bc44be1a0 100644 --- a/pkg/harfbuzz/build.zig +++ b/pkg/harfbuzz/build.zig @@ -17,7 +17,7 @@ pub fn build(b: *std.Build) !void { const upstream = b.dependency("harfbuzz", .{}); const module = b.addModule("harfbuzz", .{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, .imports = &.{ @@ -91,7 +91,7 @@ pub fn build(b: *std.Build) !void { { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/pkg/highway/build.zig b/pkg/highway/build.zig index 1ef08de79..93d76876b 100644 --- a/pkg/highway/build.zig +++ b/pkg/highway/build.zig @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void { const upstream = b.dependency("highway", .{}); const module = b.addModule("highway", .{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); @@ -95,7 +95,7 @@ pub fn build(b: *std.Build) !void { { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/pkg/libpng/build.zig b/pkg/libpng/build.zig index e5bcf5963..6d3487071 100644 --- a/pkg/libpng/build.zig +++ b/pkg/libpng/build.zig @@ -23,7 +23,7 @@ pub fn build(b: *std.Build) !void { const zlib_dep = b.dependency("zlib", .{ .target = target, .optimize = optimize }); lib.linkLibrary(zlib_dep.artifact("z")); lib.addIncludePath(upstream.path("")); - lib.addIncludePath(.{ .path = "" }); + lib.addIncludePath(b.path("")); var flags = std.ArrayList([]const u8).init(b.allocator); defer flags.deinit(); @@ -40,7 +40,7 @@ pub fn build(b: *std.Build) !void { .flags = flags.items, }); - lib.installHeader(.{ .path = "pnglibconf.h" }, "pnglibconf.h"); + lib.installHeader(b.path("pnglibconf.h"), "pnglibconf.h"); lib.installHeadersDirectory( upstream.path(""), "", diff --git a/pkg/libxml2/build.zig b/pkg/libxml2/build.zig index 430bfdb54..7db637774 100644 --- a/pkg/libxml2/build.zig +++ b/pkg/libxml2/build.zig @@ -14,12 +14,12 @@ pub fn build(b: *std.Build) !void { lib.linkLibC(); lib.addIncludePath(upstream.path("include")); - lib.addIncludePath(.{ .path = "override/include" }); + lib.addIncludePath(b.path("override/include")); if (target.result.os.tag == .windows) { - lib.addIncludePath(.{ .path = "override/config/win32" }); + lib.addIncludePath(b.path("override/config/win32")); lib.linkSystemLibrary("ws2_32"); } else { - lib.addIncludePath(.{ .path = "override/config/posix" }); + lib.addIncludePath(b.path("override/config/posix")); } var flags = std.ArrayList([]const u8).init(b.allocator); @@ -101,7 +101,7 @@ pub fn build(b: *std.Build) !void { }); lib.installHeader( - .{ .path = "override/include/libxml/xmlversion.h" }, + b.path("override/include/libxml/xmlversion.h"), "libxml/xmlversion.h", ); lib.installHeadersDirectory( diff --git a/pkg/macos/build.zig b/pkg/macos/build.zig index a9e3f6913..a154b24fa 100644 --- a/pkg/macos/build.zig +++ b/pkg/macos/build.zig @@ -7,7 +7,7 @@ pub fn build(b: *std.Build) !void { const optimize = b.standardOptimizeOption(.{}); const module = b.addModule("macos", .{ - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); @@ -21,11 +21,11 @@ pub fn build(b: *std.Build) !void { var flags = std.ArrayList([]const u8).init(b.allocator); defer flags.deinit(); lib.addCSourceFile(.{ - .file = .{ .path = "os/log.c" }, + .file = b.path("os/log.c"), .flags = flags.items, }); lib.addCSourceFile(.{ - .file = .{ .path = "text/ext.c" }, + .file = b.path("text/ext.c"), .flags = flags.items, }); lib.linkFramework("CoreFoundation"); @@ -55,7 +55,7 @@ pub fn build(b: *std.Build) !void { { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/pkg/oniguruma/build.zig b/pkg/oniguruma/build.zig index d973c89df..703b0a387 100644 --- a/pkg/oniguruma/build.zig +++ b/pkg/oniguruma/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); - const module = b.addModule("oniguruma", .{ .root_source_file = .{ .path = "main.zig" } }); + const module = b.addModule("oniguruma", .{ .root_source_file = b.path("main.zig") }); const upstream = b.dependency("oniguruma", .{}); const lib = try buildOniguruma(b, upstream, target, optimize); @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) !void { if (target.query.isNative()) { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/pkg/opengl/build.zig b/pkg/opengl/build.zig index 440b96ba0..f472053ed 100644 --- a/pkg/opengl/build.zig +++ b/pkg/opengl/build.zig @@ -1,6 +1,6 @@ const std = @import("std"); pub fn build(b: *std.Build) !void { - const module = b.addModule("opengl", .{ .root_source_file = .{ .path = "main.zig" } }); - module.addIncludePath(.{ .path = "../../vendor/glad/include" }); + const module = b.addModule("opengl", .{ .root_source_file = b.path("main.zig") }); + module.addIncludePath(b.path("../../vendor/glad/include")); } diff --git a/pkg/pixman/build.zig b/pkg/pixman/build.zig index f993ba46f..b1338ed25 100644 --- a/pkg/pixman/build.zig +++ b/pkg/pixman/build.zig @@ -4,7 +4,7 @@ pub fn build(b: *std.Build) !void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); - const module = b.addModule("pixman", .{ .root_source_file = .{ .path = "main.zig" } }); + const module = b.addModule("pixman", .{ .root_source_file = b.path("main.zig") }); const upstream = b.dependency("pixman", .{}); const lib = b.addStaticLibrary(.{ @@ -22,9 +22,9 @@ pub fn build(b: *std.Build) !void { } lib.addIncludePath(upstream.path("")); - lib.addIncludePath(.{ .path = "" }); + lib.addIncludePath(b.path("")); module.addIncludePath(upstream.path("pixman")); - module.addIncludePath(.{ .path = "" }); + module.addIncludePath(b.path("")); var flags = std.ArrayList([]const u8).init(b.allocator); defer flags.deinit(); @@ -62,7 +62,7 @@ pub fn build(b: *std.Build) !void { .flags = flags.items, }); - lib.installHeader(.{ .path = "pixman-version.h" }, "pixman-version.h"); + lib.installHeader(b.path("pixman-version.h"), "pixman-version.h"); lib.installHeadersDirectory( upstream.path("pixman"), "", @@ -74,7 +74,7 @@ pub fn build(b: *std.Build) !void { if (target.query.isNative()) { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); diff --git a/pkg/simdutf/build.zig b/pkg/simdutf/build.zig index bc53b30be..784d7cce1 100644 --- a/pkg/simdutf/build.zig +++ b/pkg/simdutf/build.zig @@ -10,7 +10,7 @@ pub fn build(b: *std.Build) !void { .optimize = optimize, }); lib.linkLibCpp(); - lib.addIncludePath(.{ .path = "vendor" }); + lib.addIncludePath(b.path("vendor")); if (target.result.isDarwin()) { const apple_sdk = @import("apple_sdk"); @@ -28,7 +28,7 @@ pub fn build(b: *std.Build) !void { }, }); lib.installHeadersDirectory( - .{ .path = "vendor" }, + b.path("vendor"), "", .{ .include_extensions = &.{".h"} }, ); diff --git a/pkg/spirv-cross/build.zig b/pkg/spirv-cross/build.zig index be18f3043..8281a5df1 100644 --- a/pkg/spirv-cross/build.zig +++ b/pkg/spirv-cross/build.zig @@ -6,7 +6,7 @@ pub fn build(b: *std.Build) !void { const upstream = b.dependency("spirv_cross", .{}); - const module = b.addModule("spirv_cross", .{ .root_source_file = .{ .path = "main.zig" } }); + const module = b.addModule("spirv_cross", .{ .root_source_file = b.path("main.zig") }); module.addIncludePath(upstream.path("")); const lib = try buildSpirvCross(b, upstream, target, optimize); @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) !void { if (target.query.isNative()) { const test_exe = b.addTest(.{ .name = "test", - .root_source_file = .{ .path = "main.zig" }, + .root_source_file = b.path("main.zig"), .target = target, .optimize = optimize, }); From a3a90504d5d6b2aa32b79679214aba1646a8a6b9 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 8 Jun 2024 19:54:31 -0700 Subject: [PATCH 02/13] update ziglyph --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index ab4008a30..efead111b 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -22,8 +22,8 @@ .hash = "1220df81f0e65cc9ccd3628572c611e6f267a71f1bff1be19d50f4ac49ee2a83c324", }, .ziglyph = .{ - .url = "https://deps.files.ghostty.dev/ziglyph-0e17bd36a4e882b194a87c283bd78562ea215116.tar.gz", - .hash = "12208553f3f47e51494e187f4c0e6f6b3844e3993436cad4a0e8c4db4e99645967b5", + .url = "https://deps.files.ghostty.dev/ziglyph-b89d43d1e3fb01b6074bc1f7fc980324b04d26a5.tar.gz", + .hash = "12207831bce7d4abce57b5a98e8f3635811cfefd160bca022eb91fe905d36a02cf25", }, // C libs From c0e79e05853a3a0f8bec4b5db7cf53f228753f17 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 8 Jun 2024 19:59:17 -0700 Subject: [PATCH 03/13] update a couple more deps --- build.zig.zon | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index efead111b..4fcd6af21 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -14,12 +14,12 @@ .lazy = true, }, .zig_objc = .{ - .url = "https://github.com/mitchellh/zig-objc/archive/9e2174ed9b5a2c11bf1779cf6c819260c8091888.tar.gz", - .hash = "1220014cd3774aa0b18320e6527ed7b3270412c70958ab16a3c55070ffb7f2042f87", + .url = "https://github.com/mitchellh/zig-objc/archive/0d9ad4a9fe9eaaa3be58ab9ab7a03c69e04a2cbd.tar.gz", + .hash = "1220b153ba8c90de9eeccd3f36802e00e2e3b615610a1f0dfe7472255d8d982bed53", }, .zig_js = .{ - .url = "https://github.com/mitchellh/zig-js/archive/d4edb682733aef8dc3933683272bdf7c8b9fe658.tar.gz", - .hash = "1220df81f0e65cc9ccd3628572c611e6f267a71f1bff1be19d50f4ac49ee2a83c324", + .url = "https://github.com/mitchellh/zig-js/archive/d0b8b0a57c52fbc89f9d9fecba75ca29da7dd7d1.tar.gz", + .hash = "12205a66d423259567764fa0fc60c82be35365c21aeb76c5a7dc99698401f4f6fefc", }, .ziglyph = .{ .url = "https://deps.files.ghostty.dev/ziglyph-b89d43d1e3fb01b6074bc1f7fc980324b04d26a5.tar.gz", From a58821ea3417614665ab593e6a867a6513ebe814 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 8 Jun 2024 20:10:16 -0700 Subject: [PATCH 04/13] update mach --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 4fcd6af21..8568e082c 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -9,8 +9,8 @@ .hash = "12207b7a5b538ffb7fb18f954ae17d2f8490b6e3778a9e30564ad82c58ee8da52361", }, .mach_glfw = .{ - .url = "https://github.com/mitchellh/mach-glfw/archive/20c773d86df269722d8926f98bc8af26ebd90999.tar.gz", - .hash = "1220d6df7eb57501616e86ed812854164ff02d2f4a0eaa06b8301f32950d8d3e89df", + .url = "https://github.com/mitchellh/mach-glfw/archive/37c2995f31abcf7e8378fba68ddcf4a3faa02de0.tar.gz", + .hash = "12206ed982e709e565d536ce930701a8c07edfd2cfdce428683f3f2a601d37696a62", .lazy = true, }, .zig_objc = .{ From eadd2dc5b038635dd5efc0cebf8ece461837ab6f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 8 Jun 2024 20:13:08 -0700 Subject: [PATCH 05/13] update deps --- build.zig.zon | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index 8568e082c..d48f1e0e0 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -14,8 +14,8 @@ .lazy = true, }, .zig_objc = .{ - .url = "https://github.com/mitchellh/zig-objc/archive/0d9ad4a9fe9eaaa3be58ab9ab7a03c69e04a2cbd.tar.gz", - .hash = "1220b153ba8c90de9eeccd3f36802e00e2e3b615610a1f0dfe7472255d8d982bed53", + .url = "https://github.com/mitchellh/zig-objc/archive/fe5ac419530cf800294369d996133fe9cd067aec.tar.gz", + .hash = "122034b3e15d582d8d101a7713e5f13c872b8b8eb6d9cb47515b8e34ee75e122630d", }, .zig_js = .{ .url = "https://github.com/mitchellh/zig-js/archive/d0b8b0a57c52fbc89f9d9fecba75ca29da7dd7d1.tar.gz", From 53423f107124d23e7052eb97027008818915867b Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sat, 8 Jun 2024 20:21:00 -0700 Subject: [PATCH 06/13] 0.13 conversions --- build.zig | 2 +- src/terminal/kitty/graphics_image.zig | 15 ++++++++++++--- src/terminal/mouse_shape.zig | 2 +- src/terminal/x11_color.zig | 10 ++++------ src/terminfo/Source.zig | 4 ++-- 5 files changed, 20 insertions(+), 13 deletions(-) diff --git a/build.zig b/build.zig index 26306ae6c..f92754992 100644 --- a/build.zig +++ b/build.zig @@ -1485,7 +1485,7 @@ fn root() []const u8 { } /// ANSI escape codes for colored log output -const color_map = std.ComptimeStringMap([]const u8, .{ +const color_map = std.StaticStringMap([]const u8).initComptime(.{ &.{ "black", "30m" }, &.{ "blue", "34m" }, &.{ "b", "1m" }, diff --git a/src/terminal/kitty/graphics_image.zig b/src/terminal/kitty/graphics_image.zig index 09e9376e2..2cfb59cc1 100644 --- a/src/terminal/kitty/graphics_image.zig +++ b/src/terminal/kitty/graphics_image.zig @@ -622,7 +622,10 @@ test "image load: rgb, not compressed, temporary file" { var tmp_dir = try internal_os.TempDir.init(); defer tmp_dir.deinit(); const data = @embedFile("testdata/image-rgb-none-20x15-2147483647-raw.data"); - try tmp_dir.dir.writeFile("image.data", data); + try tmp_dir.dir.writeFile(.{ + .sub_path = "image.data", + .data = data, + }); var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; const path = try tmp_dir.dir.realpath("image.data", &buf); @@ -656,7 +659,10 @@ test "image load: rgb, not compressed, regular file" { var tmp_dir = try internal_os.TempDir.init(); defer tmp_dir.deinit(); const data = @embedFile("testdata/image-rgb-none-20x15-2147483647-raw.data"); - try tmp_dir.dir.writeFile("image.data", data); + try tmp_dir.dir.writeFile(.{ + .sub_path = "image.data", + .data = data, + }); var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; const path = try tmp_dir.dir.realpath("image.data", &buf); @@ -688,7 +694,10 @@ test "image load: png, not compressed, regular file" { var tmp_dir = try internal_os.TempDir.init(); defer tmp_dir.deinit(); const data = @embedFile("testdata/image-png-none-50x76-2147483647-raw.data"); - try tmp_dir.dir.writeFile("image.data", data); + try tmp_dir.dir.writeFile(.{ + .sub_path = "image.data", + .data = data, + }); var buf: [std.fs.MAX_PATH_BYTES]u8 = undefined; const path = try tmp_dir.dir.realpath("image.data", &buf); diff --git a/src/terminal/mouse_shape.zig b/src/terminal/mouse_shape.zig index cf8f42c4b..aedba2455 100644 --- a/src/terminal/mouse_shape.zig +++ b/src/terminal/mouse_shape.zig @@ -47,7 +47,7 @@ pub const MouseShape = enum(c_int) { } }; -const string_map = std.ComptimeStringMap(MouseShape, .{ +const string_map = std.StaticStringMap(MouseShape).initComptime(.{ // W3C .{ "default", .default }, .{ "context-menu", .context_menu }, diff --git a/src/terminal/x11_color.zig b/src/terminal/x11_color.zig index 9e4eda86b..f6413f96e 100644 --- a/src/terminal/x11_color.zig +++ b/src/terminal/x11_color.zig @@ -5,7 +5,9 @@ const RGB = @import("color.zig").RGB; /// The map of all available X11 colors. pub const map = colorMap() catch @compileError("failed to parse rgb.txt"); -fn colorMap() !type { +pub const ColorMap = std.StaticStringMapWithEql(RGB, std.static_string_map.eqlAsciiIgnoreCase); + +fn colorMap() !ColorMap { @setEvalBranchQuota(100_000); const KV = struct { []const u8, RGB }; @@ -31,11 +33,7 @@ fn colorMap() !type { } assert(i == len); - return std.ComptimeStringMapWithEql( - RGB, - kvs, - std.comptime_string_map.eqlAsciiIgnoreCase, - ); + return ColorMap.initComptime(kvs); } /// This is the rgb.txt file from the X11 project. This was last sourced diff --git a/src/terminfo/Source.zig b/src/terminfo/Source.zig index c61ecc060..8c66d82a5 100644 --- a/src/terminfo/Source.zig +++ b/src/terminfo/Source.zig @@ -68,7 +68,7 @@ pub fn encode(self: Source, writer: anytype) !void { /// Returns a ComptimeStringMap for all of the capabilities in this terminfo. /// The value is the value that should be sent as a response to XTGETTCAP. /// Important: the value is the FULL response included the escape sequences. -pub fn xtgettcapMap(comptime self: Source) type { +pub fn xtgettcapMap(comptime self: Source) std.StaticStringMap([]const u8) { const KV = struct { []const u8, []const u8 }; // We have all of our capabilities plus To, TN, and RGB which aren't @@ -145,7 +145,7 @@ pub fn xtgettcapMap(comptime self: Source) type { } const kvs_final = kvs; - return std.ComptimeStringMap([]const u8, &kvs_final); + return std.StaticStringMap([]const u8).initComptime(&kvs_final); } fn hexencode(comptime input: []const u8) []const u8 { From c967a35abbf8937d3f2d3295089733ab76ef39a0 Mon Sep 17 00:00:00 2001 From: Gordon Cassie Date: Sun, 9 Jun 2024 11:52:05 -0700 Subject: [PATCH 07/13] Fix some basic build errors. --- .gitignore | 1 + src/cli/list_colors.zig | 2 +- src/input/keycodes.zig | 2 +- src/main_ghostty.zig | 4 ++-- src/terminfo/Source.zig | 2 +- 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index 8e7a003ff..c7a2cf20b 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ .direnv/ .flatpak-builder/ zig-cache/ +.zig-cache/ zig-out/ /result* example/*.wasm diff --git a/src/cli/list_colors.zig b/src/cli/list_colors.zig index a275142bc..b9a250519 100644 --- a/src/cli/list_colors.zig +++ b/src/cli/list_colors.zig @@ -31,7 +31,7 @@ pub fn run(alloc: std.mem.Allocator) !u8 { var keys = std.ArrayList([]const u8).init(alloc); defer keys.deinit(); - for (x11_color.map.kvs) |kv| try keys.append(kv.key); + for (x11_color.map.keys()) |key| try keys.append(key); std.mem.sortUnstable([]const u8, keys.items, {}, struct { fn lessThan(_: void, lhs: []const u8, rhs: []const u8) bool { diff --git a/src/input/keycodes.zig b/src/input/keycodes.zig index 47190a841..67ce46daf 100644 --- a/src/input/keycodes.zig +++ b/src/input/keycodes.zig @@ -44,7 +44,7 @@ pub const Entry = struct { /// key value for Entry. const code_to_key = code_to_key: { @setEvalBranchQuota(5000); - break :code_to_key std.ComptimeStringMap(Key, .{ + break :code_to_key std.StaticStringMap(Key).initComptime(.{ .{ "KeyA", .a }, .{ "KeyB", .b }, .{ "KeyC", .c }, diff --git a/src/main_ghostty.zig b/src/main_ghostty.zig index afc0ae791..62b424f62 100644 --- a/src/main_ghostty.zig +++ b/src/main_ghostty.zig @@ -123,8 +123,8 @@ fn logFn( const prefix = if (scope == .default) ": " else "(" ++ @tagName(scope) ++ "): "; // Lock so we are thread-safe - std.debug.getStderrMutex().lock(); - defer std.debug.getStderrMutex().unlock(); + std.debug.lockStdErr(); + defer std.debug.unlockStdErr(); // On Mac, we use unified logging. To view this: // diff --git a/src/terminfo/Source.zig b/src/terminfo/Source.zig index 8c66d82a5..1012cb010 100644 --- a/src/terminfo/Source.zig +++ b/src/terminfo/Source.zig @@ -65,7 +65,7 @@ pub fn encode(self: Source, writer: anytype) !void { } } -/// Returns a ComptimeStringMap for all of the capabilities in this terminfo. +/// Returns a StaticStringMap for all of the capabilities in this terminfo. /// The value is the value that should be sent as a response to XTGETTCAP. /// Important: the value is the FULL response included the escape sequences. pub fn xtgettcapMap(comptime self: Source) std.StaticStringMap([]const u8) { From 2c2a830aa6c9bc1510e0bbdd3aca7480b90d530d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 23 Jun 2024 12:03:09 -0700 Subject: [PATCH 08/13] pkg/oniguruma: call new functions --- pkg/oniguruma/types.zig | 86 ++++++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 43 deletions(-) diff --git a/pkg/oniguruma/types.zig b/pkg/oniguruma/types.zig index 3eafc0e90..a47149ce0 100644 --- a/pkg/oniguruma/types.zig +++ b/pkg/oniguruma/types.zig @@ -2,52 +2,52 @@ const std = @import("std"); const c = @import("c.zig"); pub const Encoding = opaque { - pub const ascii: *Encoding = @ptrCast(c.ONIG_ENCODING_ASCII); - pub const iso_8859_1: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_1); - pub const iso_8859_2: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_2); - pub const iso_8859_3: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_3); - pub const iso_8859_4: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_4); - pub const iso_8859_5: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_5); - pub const iso_8859_6: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_6); - pub const iso_8859_7: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_7); - pub const iso_8859_8: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_8); - pub const iso_8859_9: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_9); - pub const iso_8859_10: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_10); - pub const iso_8859_11: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_11); - pub const iso_8859_13: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_13); - pub const iso_8859_14: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_14); - pub const iso_8859_15: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_15); - pub const iso_8859_16: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_16); - pub const utf8: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF8); - pub const utf16_be: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF16_BE); - pub const utf16_le: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF16_LE); - pub const utf32_be: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF32_BE); - pub const utf32_le: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF32_LE); - pub const euc_jp: *Encoding = @ptrCast(c.ONIG_ENCODING_EUC_JP); - pub const euc_tw: *Encoding = @ptrCast(c.ONIG_ENCODING_EUC_TW); - pub const euc_kr: *Encoding = @ptrCast(c.ONIG_ENCODING_EUC_KR); - pub const euc_cn: *Encoding = @ptrCast(c.ONIG_ENCODING_EUC_CN); - pub const sjis: *Encoding = @ptrCast(c.ONIG_ENCODING_SJIS); - pub const koi8: *Encoding = @ptrCast(c.ONIG_ENCODING_KOI8); - pub const koi8_r: *Encoding = @ptrCast(c.ONIG_ENCODING_KOI8_R); - pub const cp1251: *Encoding = @ptrCast(c.ONIG_ENCODING_CP1251); - pub const big5: *Encoding = @ptrCast(c.ONIG_ENCODING_BIG5); - pub const gb18030: *Encoding = @ptrCast(c.ONIG_ENCODING_GB18030); + pub const ascii: *Encoding = @ptrCast(c.ONIG_ENCODING_ASCII()); + pub const iso_8859_1: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_1()); + pub const iso_8859_2: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_2()); + pub const iso_8859_3: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_3()); + pub const iso_8859_4: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_4()); + pub const iso_8859_5: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_5()); + pub const iso_8859_6: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_6()); + pub const iso_8859_7: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_7()); + pub const iso_8859_8: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_8()); + pub const iso_8859_9: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_9()); + pub const iso_8859_10: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_10()); + pub const iso_8859_11: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_11()); + pub const iso_8859_13: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_13()); + pub const iso_8859_14: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_14()); + pub const iso_8859_15: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_15()); + pub const iso_8859_16: *Encoding = @ptrCast(c.ONIG_ENCODING_ISO_8859_16()); + pub const utf8: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF8()); + pub const utf16_be: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF16_BE()); + pub const utf16_le: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF16_LE()); + pub const utf32_be: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF32_BE()); + pub const utf32_le: *Encoding = @ptrCast(c.ONIG_ENCODING_UTF32_LE()); + pub const euc_jp: *Encoding = @ptrCast(c.ONIG_ENCODING_EUC_JP()); + pub const euc_tw: *Encoding = @ptrCast(c.ONIG_ENCODING_EUC_TW()); + pub const euc_kr: *Encoding = @ptrCast(c.ONIG_ENCODING_EUC_KR()); + pub const euc_cn: *Encoding = @ptrCast(c.ONIG_ENCODING_EUC_CN()); + pub const sjis: *Encoding = @ptrCast(c.ONIG_ENCODING_SJIS()); + pub const koi8: *Encoding = @ptrCast(c.ONIG_ENCODING_KOI8()); + pub const koi8_r: *Encoding = @ptrCast(c.ONIG_ENCODING_KOI8_R()); + pub const cp1251: *Encoding = @ptrCast(c.ONIG_ENCODING_CP1251()); + pub const big5: *Encoding = @ptrCast(c.ONIG_ENCODING_BIG5()); + pub const gb18030: *Encoding = @ptrCast(c.ONIG_ENCODING_GB18030()); }; pub const Syntax = opaque { - pub const default: *Syntax = @ptrCast(c.ONIG_SYNTAX_ONIGURUMA); - pub const asis: *Syntax = @ptrCast(c.ONIG_SYNTAX_ASIS); - pub const posix_basic: *Syntax = @ptrCast(c.ONIG_SYNTAX_POSIX_BASIC); - pub const posix_extended: *Syntax = @ptrCast(c.ONIG_SYNTAX_POSIX_EXTENDED); - pub const emacs: *Syntax = @ptrCast(c.ONIG_SYNTAX_EMACS); - pub const grep: *Syntax = @ptrCast(c.ONIG_SYNTAX_GREP); - pub const gnu_regex: *Syntax = @ptrCast(c.ONIG_SYNTAX_GNU_REGEX); - pub const java: *Syntax = @ptrCast(c.ONIG_SYNTAX_JAVA); - pub const perl: *Syntax = @ptrCast(c.ONIG_SYNTAX_PERL); - pub const perl_ng: *Syntax = @ptrCast(c.ONIG_SYNTAX_PERL_NG); - pub const ruby: *Syntax = @ptrCast(c.ONIG_SYNTAX_RUBY); - pub const oniguruma: *Syntax = @ptrCast(c.ONIG_SYNTAX_ONIGURUMA); + pub const default: *Syntax = @ptrCast(c.ONIG_SYNTAX_ONIGURUMA()); + pub const asis: *Syntax = @ptrCast(c.ONIG_SYNTAX_ASIS()); + pub const posix_basic: *Syntax = @ptrCast(c.ONIG_SYNTAX_POSIX_BASIC()); + pub const posix_extended: *Syntax = @ptrCast(c.ONIG_SYNTAX_POSIX_EXTENDED()); + pub const emacs: *Syntax = @ptrCast(c.ONIG_SYNTAX_EMACS()); + pub const grep: *Syntax = @ptrCast(c.ONIG_SYNTAX_GREP()); + pub const gnu_regex: *Syntax = @ptrCast(c.ONIG_SYNTAX_GNU_REGEX()); + pub const java: *Syntax = @ptrCast(c.ONIG_SYNTAX_JAVA()); + pub const perl: *Syntax = @ptrCast(c.ONIG_SYNTAX_PERL()); + pub const perl_ng: *Syntax = @ptrCast(c.ONIG_SYNTAX_PERL_NG()); + pub const ruby: *Syntax = @ptrCast(c.ONIG_SYNTAX_RUBY()); + pub const oniguruma: *Syntax = @ptrCast(c.ONIG_SYNTAX_ONIGURUMA()); }; pub const Option = packed struct(c_uint) { From 5eff2d88a2bd7abc75f34efc9dafd0fee50fecdd Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 23 Jun 2024 12:05:58 -0700 Subject: [PATCH 09/13] nix: update package to zig 0.13 --- flake.lock | 16 ---------------- flake.nix | 2 +- nix/zigCacheHash.nix | 2 +- 3 files changed, 2 insertions(+), 18 deletions(-) diff --git a/flake.lock b/flake.lock index 5b0570c08..1523ed025 100644 --- a/flake.lock +++ b/flake.lock @@ -16,22 +16,6 @@ "type": "github" } }, - "flake-compat_2": { - "flake": false, - "locked": { - "lastModified": 1673956053, - "narHash": "sha256-4gtG9iQuiKITOjNQQeQIpoIB6b16fm+504Ch3sNKLd8=", - "owner": "edolstra", - "repo": "flake-compat", - "rev": "35bb57c0c8d8b62bbfd284272c928ceb64ddbde9", - "type": "github" - }, - "original": { - "owner": "edolstra", - "repo": "flake-compat", - "type": "github" - } - }, "flake-utils": { "inputs": { "systems": "systems" diff --git a/flake.nix b/flake.nix index f8a7f57b7..9bde321cf 100644 --- a/flake.nix +++ b/flake.nix @@ -45,7 +45,7 @@ packages.${system} = let mkArgs = optimize: { - inherit (pkgs-unstable) zig_0_12 lib; + inherit (pkgs-unstable) zig_0_13 lib; inherit optimize; revision = self.shortRev or self.dirtyShortRev or "dirty"; diff --git a/nix/zigCacheHash.nix b/nix/zigCacheHash.nix index 185984a52..cfce19528 100644 --- a/nix/zigCacheHash.nix +++ b/nix/zigCacheHash.nix @@ -1,3 +1,3 @@ # This file is auto-generated! check build-support/check-zig-cache-hash.sh for # more details. -"sha256-C+YVTjCuEDLZYZ9/bXfTI2bYVUKUtmxMQsttEcBJQwM=" +"sha256-TPQoLarpZ+aWOraB7i9augg+/VYrQwKuxxu5t2F1fKw=" From cb76fe6634089033dd4c4d16e35b02b7e61c7bb3 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 23 Jun 2024 12:12:24 -0700 Subject: [PATCH 10/13] fix linux builds --- build.zig | 2 +- src/apprt/gtk/key.zig | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index f92754992..6db0ccbe0 100644 --- a/build.zig +++ b/build.zig @@ -1017,7 +1017,7 @@ fn addDeps( // on x86_64. if (step.rootModuleTarget().os.tag == .linux) { const triple = try step.rootModuleTarget().linuxTriple(b.allocator); - step.addLibraryPath(b.path(b.fmt("/usr/lib/{s}", .{triple}))); + step.addLibraryPath(.{ .cwd_relative = b.fmt("/usr/lib/{s}", .{triple}) }); } // C files diff --git a/src/apprt/gtk/key.zig b/src/apprt/gtk/key.zig index c2b001738..405c73665 100644 --- a/src/apprt/gtk/key.zig +++ b/src/apprt/gtk/key.zig @@ -72,7 +72,7 @@ test "accelFromTrigger" { try testing.expectEqualStrings("q", (try accelFromTrigger(&buf, .{ .mods = .{ .super = true }, - .key = .q, + .key = .{ .translated = .q }, })).?); } From ac0550e267b49920fe69b8878bb72ec86f3b2728 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 23 Jun 2024 21:55:05 -0700 Subject: [PATCH 11/13] update libxev --- build.zig.zon | 4 ++-- nix/zigCacheHash.nix | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/build.zig.zon b/build.zig.zon index d48f1e0e0..f4e181fe0 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -5,8 +5,8 @@ .dependencies = .{ // Zig libs .libxev = .{ - .url = "https://github.com/mitchellh/libxev/archive/f6a672a78436d8efee1aa847a43a900ad773618b.tar.gz", - .hash = "12207b7a5b538ffb7fb18f954ae17d2f8490b6e3778a9e30564ad82c58ee8da52361", + .url = "https://github.com/mitchellh/libxev/archive/a42b74ae8139738a14148f94543c659ec2d5b92b.tar.gz", + .hash = "1220ff99305b4072365c5b1dfada4ba2fa3dc51b38118f39365cdc63469953840365", }, .mach_glfw = .{ .url = "https://github.com/mitchellh/mach-glfw/archive/37c2995f31abcf7e8378fba68ddcf4a3faa02de0.tar.gz", diff --git a/nix/zigCacheHash.nix b/nix/zigCacheHash.nix index cfce19528..406d1b4bb 100644 --- a/nix/zigCacheHash.nix +++ b/nix/zigCacheHash.nix @@ -1,3 +1,3 @@ # This file is auto-generated! check build-support/check-zig-cache-hash.sh for # more details. -"sha256-TPQoLarpZ+aWOraB7i9augg+/VYrQwKuxxu5t2F1fKw=" +"sha256-NqrQqTPssEKMIAVHab06KYsK6lk8pS4zy+o8iT8FCYA=" From c1ead2e2f18aedcfbf547748b73c77e8f3340a9f Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Sun, 23 Jun 2024 21:55:57 -0700 Subject: [PATCH 12/13] nix: update to zig 0.13 --- nix/package.nix | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/nix/package.nix b/nix/package.nix index c497516e0..47bf5ac48 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -22,7 +22,7 @@ git, ncurses, pkg-config, - zig_0_12, + zig_0_13, pandoc, revision ? "dirty", optimize ? "Debug", @@ -34,7 +34,7 @@ # https://github.com/ziglang/zig/issues/14281#issuecomment-1624220653 is # ultimately acted on and has made its way to a nixpkgs implementation, this # can probably be removed in favor of that. - zig012Hook = zig_0_12.hook.overrideAttrs { + zig012Hook = zig_0_13.hook.overrideAttrs { zig_default_flags = "-Dcpu=baseline -Doptimize=${optimize}"; }; @@ -79,7 +79,7 @@ name = "ghostty-cache"; nativeBuildInputs = [ git - zig_0_12.hook + zig_0_13.hook ]; dontConfigure = true; From 98689413b4cbffc5ab11ce70074534639f93365d Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Mon, 24 Jun 2024 15:06:16 -0700 Subject: [PATCH 13/13] disable AVX512 until Zig issue is resolved https://github.com/ziglang/zig/issues/20414 --- build.zig | 30 +++++++++++++++++++++++++----- pkg/simdutf/build.zig | 4 +++- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/build.zig b/build.zig index 6db0ccbe0..a30ddb4bf 100644 --- a/build.zig +++ b/build.zig @@ -1028,11 +1028,31 @@ fn addDeps( // C++ files step.linkLibCpp(); step.addIncludePath(b.path("src")); - step.addCSourceFiles(.{ .files = &.{ - "src/simd/codepoint_width.cpp", - "src/simd/index_of.cpp", - "src/simd/vt.cpp", - } }); + { + // From hwy/detect_targets.h + const HWY_AVX3_SPR: c_int = 1 << 4; + const HWY_AVX3_ZEN4: c_int = 1 << 6; + const HWY_AVX3_DL: c_int = 1 << 7; + const HWY_AVX3: c_int = 1 << 8; + + // Zig 0.13 bug: https://github.com/ziglang/zig/issues/20414 + // To workaround this we just disable AVX512 support completely. + // The performance difference between AVX2 and AVX512 is not + // significant for our use case and AVX512 is very rare on consumer + // hardware anyways. + const HWY_DISABLED_TARGETS: c_int = HWY_AVX3_SPR | HWY_AVX3_ZEN4 | HWY_AVX3_DL | HWY_AVX3; + + step.addCSourceFiles(.{ + .files = &.{ + "src/simd/codepoint_width.cpp", + "src/simd/index_of.cpp", + "src/simd/vt.cpp", + }, + .flags = if (step.rootModuleTarget().cpu.arch == .x86_64) &.{ + b.fmt("-DHWY_DISABLED_TARGETS={}", .{HWY_DISABLED_TARGETS}), + } else &.{}, + }); + } // If we're building a lib we have some different deps const lib = step.kind == .lib; diff --git a/pkg/simdutf/build.zig b/pkg/simdutf/build.zig index 784d7cce1..1532e4a33 100644 --- a/pkg/simdutf/build.zig +++ b/pkg/simdutf/build.zig @@ -19,7 +19,9 @@ pub fn build(b: *std.Build) !void { var flags = std.ArrayList([]const u8).init(b.allocator); defer flags.deinit(); - try flags.appendSlice(&.{}); + // Zig 0.13 bug: https://github.com/ziglang/zig/issues/20414 + // (See root Ghostty build.zig on why we do this) + try flags.appendSlice(&.{"-DSIMDUTF_IMPLEMENTATION_ICELAKE=0"}); lib.addCSourceFiles(.{ .flags = flags.items,