diff --git a/.gitmodules b/.gitmodules index 70a7fdbcb..b07913876 100644 --- a/.gitmodules +++ b/.gitmodules @@ -42,4 +42,4 @@ url = https://github.com/hexops/sdk-linux-x86_64.git [submodule "vendor/mach-glfw"] path = vendor/mach-glfw - url = https://github.com/hexops/mach-glfw.git + url = https://github.com/mitchellh/mach-glfw.git diff --git a/build.zig b/build.zig index 9e1f05f68..4510bf5e3 100644 --- a/build.zig +++ b/build.zig @@ -36,7 +36,7 @@ const system_sdk = @import("vendor/mach-glfw/system_sdk.zig"); // but we liberally update it. In the future, we'll be more careful about // using released versions so that package managers can integrate better. comptime { - const required_zig = "0.11.0-dev.4282+0f21d3d4d"; + const required_zig = "0.11.0-dev.4404+4f6013bf5"; const current_zig = builtin.zig_version; const min_zig = std.SemanticVersion.parse(required_zig) catch unreachable; if (current_zig.order(min_zig) == .lt) { @@ -250,7 +250,7 @@ pub fn build(b: *std.Build) !void { // If we're installing, we get the install step so we can add // additional dependencies to it. const install_step = if (app_runtime != .none) step: { - const step = b.addInstallArtifact(exe); + const step = b.addInstallArtifact(exe, .{}); b.getInstallStep().dependOn(&step.step); break :step step; } else null; @@ -392,7 +392,7 @@ pub fn build(b: *std.Build) !void { // App (Mac) if (target.isDarwin()) { const bin_install = b.addInstallFile( - .{ .generated = &exe.output_path_source }, + exe.getEmittedBin(), "Ghostty.app/Contents/MacOS/ghostty", ); b.getInstallStep().dependOn(&bin_install.step); @@ -419,7 +419,7 @@ pub fn build(b: *std.Build) !void { // Create a single static lib with all our dependencies merged var lib_list = try addDeps(b, lib, true); - try lib_list.append(.{ .generated = &lib.output_path_source }); + try lib_list.append(lib.getEmittedBin()); const libtool = LibtoolStep.create(b, .{ .name = "ghostty", .out_name = "libghostty-aarch64-fat.a", @@ -448,7 +448,7 @@ pub fn build(b: *std.Build) !void { // Create a single static lib with all our dependencies merged var lib_list = try addDeps(b, lib, true); - try lib_list.append(.{ .generated = &lib.output_path_source }); + try lib_list.append(lib.getEmittedBin()); const libtool = LibtoolStep.create(b, .{ .name = "ghostty", .out_name = "libghostty-x86_64-fat.a", @@ -530,7 +530,7 @@ pub fn build(b: *std.Build) !void { _ = try addDeps(b, wasm, true); // Install - const wasm_install = b.addInstallArtifact(wasm); + const wasm_install = b.addInstallArtifact(wasm, .{}); wasm_install.dest_dir = .{ .prefix = {} }; const step = b.step("wasm", "Build the wasm library"); @@ -684,11 +684,11 @@ fn addDeps( // stb_image_resize const stb_image_resize_step = try stb_image_resize.link(b, step, .{}); - try static_libs.append(.{ .generated = &stb_image_resize_step.output_path_source }); + try static_libs.append(stb_image_resize_step.getEmittedBin()); // utf8proc const utf8proc_step = try utf8proc.link(b, step); - try static_libs.append(.{ .generated = &utf8proc_step.output_path_source }); + try static_libs.append(utf8proc_step.getEmittedBin()); // Imgui, we have to do this later since we need some information const imgui_backends = if (step.target.isDarwin()) @@ -702,7 +702,7 @@ fn addDeps( // Dynamic link if (!static) { - step.addIncludePath(freetype.include_path_self); + step.addIncludePath(.{ .path = freetype.include_path_self }); step.linkSystemLibrary("bzip2"); step.linkSystemLibrary("freetype2"); step.linkSystemLibrary("harfbuzz"); @@ -716,7 +716,7 @@ fn addDeps( // Other dependencies, we may dynamically link if (static) { const zlib_step = try zlib.link(b, step); - try static_libs.append(.{ .generated = &zlib_step.output_path_source }); + try static_libs.append(zlib_step.getEmittedBin()); const libpng_step = try libpng.link(b, step, .{ .zlib = .{ @@ -724,7 +724,7 @@ fn addDeps( .include = &zlib.include_paths, }, }); - try static_libs.append(.{ .generated = &libpng_step.output_path_source }); + try static_libs.append(libpng_step.getEmittedBin()); // Freetype const freetype_step = try freetype.link(b, step, .{ @@ -740,7 +740,7 @@ fn addDeps( .include = &zlib.include_paths, }, }); - try static_libs.append(.{ .generated = &freetype_step.output_path_source }); + try static_libs.append(freetype_step.getEmittedBin()); // Harfbuzz const harfbuzz_step = try harfbuzz.link(b, step, .{ @@ -755,11 +755,11 @@ fn addDeps( }, }); system_sdk.include(b, harfbuzz_step, .{}); - try static_libs.append(.{ .generated = &harfbuzz_step.output_path_source }); + try static_libs.append(harfbuzz_step.getEmittedBin()); // Pixman const pixman_step = try pixman.link(b, step, .{}); - try static_libs.append(.{ .generated = &pixman_step.output_path_source }); + try static_libs.append(pixman_step.getEmittedBin()); // Only Linux gets fontconfig if (font_backend.hasFontconfig()) { @@ -792,16 +792,19 @@ fn addDeps( if (!lib) { // We always statically compile glad - step.addIncludePath("vendor/glad/include/"); - step.addCSourceFile("vendor/glad/src/gl.c", &.{}); + step.addIncludePath(.{ .path = "vendor/glad/include/" }); + step.addCSourceFile(.{ + .file = .{ .path = "vendor/glad/src/gl.c" }, + .flags = &.{}, + }); // When we're targeting flatpak we ALWAYS link GTK so we // get access to glib for dbus. if (flatpak) { step.linkSystemLibrary("gtk4"); switch (step.target.getCpuArch()) { - .aarch64 => step.addLibraryPath("/usr/lib/aarch64-linux-gnu"), - .x86_64 => step.addLibraryPath("/usr/lib/x86_64-linux-gnu"), + .aarch64 => step.addLibraryPath(.{ .path = "/usr/lib/aarch64-linux-gnu" }), + .x86_64 => step.addLibraryPath(.{ .path = "/usr/lib/x86_64-linux-gnu" }), else => @panic("unsupported flatpak target"), } } @@ -874,8 +877,8 @@ fn benchSteps( .root_source_file = .{ .path = path }, .target = target, .optimize = optimize, + .main_pkg_path = .{ .path = "./src" }, }); - c_exe.setMainPkgPath("./src"); if (install) b.installArtifact(c_exe); _ = try addDeps(b, c_exe, true); } @@ -915,7 +918,7 @@ fn conformanceSteps( .optimize = optimize, }); - const install = b.addInstallArtifact(c_exe); + const install = b.addInstallArtifact(c_exe, .{}); install.dest_sub_path = "conformance"; b.getInstallStep().dependOn(&install.step); diff --git a/com.mitchellh.ghostty.yml b/com.mitchellh.ghostty.yml index 014036b1d..657094350 100644 --- a/com.mitchellh.ghostty.yml +++ b/com.mitchellh.ghostty.yml @@ -33,13 +33,13 @@ modules: - cp -r ./* /app/tmp/zig sources: - type: archive - url: https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.4282+0f21d3d4d.tar.xz - sha256: 7668c82735abbb1bbe51b06aaf4114962983e8eed1a217f03482b2399b54c32a + url: https://ziglang.org/builds/zig-linux-x86_64-0.11.0-dev.4404+4f6013bf5.tar.xz + sha256: 997f7d9747e3d46c31b3d6e54e4263810c67c8f1a77a8d9e4279af8535b39f84 only-arches: - x86_64 - type: archive - url: https://ziglang.org/builds/zig-linux-aarch64-0.11.0-dev.4282+0f21d3d4d.tar.xz - sha256: 43b7c5a1462750f732e2f1e08ab1123c95abf9e3df6c516de83cc9b9069421cf + url: https://ziglang.org/builds/zig-linux-aarch64-0.11.0-dev.4404+4f6013bf5.tar.xz + sha256: 918d57fe5862380bca2c56add0542ed03eb1dd6ed8e3021a287cad78ffbd6d72 only-arches: - aarch64 diff --git a/flake.lock b/flake.lock index 8da3fe934..3c2350a0f 100644 --- a/flake.lock +++ b/flake.lock @@ -126,11 +126,11 @@ "nixpkgs": "nixpkgs_2" }, "locked": { - "lastModified": 1690503794, - "narHash": "sha256-KeJI6b2CxOFeCzp8wWJCdct5XSgUKpsDap0rkWttVXc=", + "lastModified": 1690978078, + "narHash": "sha256-+S9s6sjOGuGCtA9njTdduJ7KjZm2tskxKhwGRKBK/xM=", "owner": "mitchellh", "repo": "zig-overlay", - "rev": "cdf67ad78726cd7919984efbb83924ea47b4c0f1", + "rev": "c9f51464f2c2c9c75f3d7fdc58c157d252545dec", "type": "github" }, "original": { diff --git a/pkg/fontconfig/build.zig b/pkg/fontconfig/build.zig index 3b6e50b43..5f09408e2 100644 --- a/pkg/fontconfig/build.zig +++ b/pkg/fontconfig/build.zig @@ -44,8 +44,8 @@ pub fn link( ) !*std.build.LibExeObjStep { const lib = try buildFontconfig(b, step, opt); step.linkLibrary(lib); - step.addIncludePath(include_path); - step.addIncludePath(include_path_self); + step.addIncludePath(.{ .path = include_path }); + step.addIncludePath(.{ .path = include_path_self }); return lib; } @@ -62,8 +62,8 @@ pub fn buildFontconfig( }); // Include - lib.addIncludePath(include_path); - lib.addIncludePath(include_path_self); + lib.addIncludePath(.{ .path = include_path }); + lib.addIncludePath(.{ .path = include_path_self }); // Link lib.linkLibC(); @@ -74,7 +74,7 @@ pub fn buildFontconfig( lib.linkSystemLibrary("expat"); if (opt.expat.include) |dirs| - for (dirs) |dir| lib.addIncludePath(dir); + for (dirs) |dir| lib.addIncludePath(.{ .path = dir }); } if (opt.freetype.enabled) { if (opt.freetype.step) |freetype| @@ -83,7 +83,7 @@ pub fn buildFontconfig( lib.linkSystemLibrary("freetype2"); if (opt.freetype.include) |dirs| - for (dirs) |dir| lib.addIncludePath(dir); + for (dirs) |dir| lib.addIncludePath(.{ .path = dir }); } if (!target.isWindows()) { lib.linkSystemLibrary("pthread"); diff --git a/pkg/freetype/build.zig b/pkg/freetype/build.zig index 6bc5a25bb..add99b6ff 100644 --- a/pkg/freetype/build.zig +++ b/pkg/freetype/build.zig @@ -41,8 +41,8 @@ pub fn link( ) !*std.build.LibExeObjStep { const lib = try buildFreetype(b, step, opt); step.linkLibrary(lib); - step.addIncludePath(include_path); - step.addIncludePath(include_path_self); + step.addIncludePath(.{ .path = include_path }); + step.addIncludePath(.{ .path = include_path_self }); return lib; } @@ -59,7 +59,7 @@ pub fn buildFreetype( }); // Include - lib.addIncludePath(include_path); + lib.addIncludePath(.{ .path = include_path }); // Link lib.linkLibC(); @@ -70,7 +70,7 @@ pub fn buildFreetype( lib.linkSystemLibrary("libpng"); if (opt.libpng.include) |dirs| - for (dirs) |dir| lib.addIncludePath(dir); + for (dirs) |dir| lib.addIncludePath(.{ .path = dir }); } if (opt.zlib.enabled) { if (opt.zlib.step) |zlib| @@ -79,7 +79,7 @@ pub fn buildFreetype( lib.linkSystemLibrary("z"); if (opt.zlib.include) |dirs| - for (dirs) |dir| lib.addIncludePath(dir); + for (dirs) |dir| lib.addIncludePath(.{ .path = dir }); } // Compile @@ -100,16 +100,30 @@ pub fn buildFreetype( // C files lib.addCSourceFiles(srcs, flags.items); switch (target.getOsTag()) { - .linux => lib.addCSourceFile(root ++ "builds/unix/ftsystem.c", flags.items), - .windows => lib.addCSourceFile(root ++ "builds/windows/ftsystem.c", flags.items), - else => lib.addCSourceFile(root ++ "src/base/ftsystem.c", flags.items), + .linux => lib.addCSourceFile(.{ + .file = .{ .path = root ++ "builds/unix/ftsystem.c" }, + .flags = flags.items, + }), + .windows => lib.addCSourceFile(.{ + .file = .{ .path = root ++ "builds/windows/ftsystem.c" }, + .flags = flags.items, + }), + else => lib.addCSourceFile(.{ + .file = .{ .path = root ++ "src/base/ftsystem.c" }, + .flags = flags.items, + }), } switch (target.getOsTag()) { .windows => { - lib.addCSourceFile(root ++ "builds/windows/ftdebug.c", flags.items); - lib.addCSourceFile(root ++ "src/base/ftver.c", flags.items); + lib.addCSourceFiles(&.{ + root ++ "builds/windows/ftdebug.c", + root ++ "src/base/ftver.c", + }, flags.items); }, - else => lib.addCSourceFile(root ++ "src/base/ftdebug.c", flags.items), + else => lib.addCSourceFile(.{ + .file = .{ .path = root ++ "src/base/ftdebug.c" }, + .flags = flags.items, + }), } return lib; diff --git a/pkg/harfbuzz/build.zig b/pkg/harfbuzz/build.zig index c1370ef86..6d51156e5 100644 --- a/pkg/harfbuzz/build.zig +++ b/pkg/harfbuzz/build.zig @@ -45,7 +45,7 @@ pub fn link( ) !*std.build.LibExeObjStep { const lib = try buildHarfbuzz(b, step, opt); step.linkLibrary(lib); - step.addIncludePath(include_path); + step.addIncludePath(.{ .path = include_path }); return lib; } @@ -61,7 +61,7 @@ pub fn buildHarfbuzz( }); // Include - lib.addIncludePath(include_path); + lib.addIncludePath(.{ .path = include_path }); // Link lib.linkLibC(); @@ -73,7 +73,7 @@ pub fn buildHarfbuzz( lib.linkSystemLibrary("freetype2"); if (opt.freetype.include) |dirs| - for (dirs) |dir| lib.addIncludePath(dir); + for (dirs) |dir| lib.addIncludePath(.{ .path = dir }); } // Compile diff --git a/pkg/imgui/build.zig b/pkg/imgui/build.zig index 1ca817104..293d25f2f 100644 --- a/pkg/imgui/build.zig +++ b/pkg/imgui/build.zig @@ -37,7 +37,7 @@ pub fn link( ) !*std.build.LibExeObjStep { const lib = try buildImgui(b, step, opt); step.linkLibrary(lib); - inline for (include_paths) |path| step.addIncludePath(path); + inline for (include_paths) |path| step.addIncludePath(.{ .path = path }); return lib; } @@ -54,7 +54,7 @@ pub fn buildImgui( }); // Include - inline for (include_paths) |path| lib.addIncludePath(path); + inline for (include_paths) |path| lib.addIncludePath(.{ .path = path }); // Link lib.linkLibC(); @@ -88,7 +88,7 @@ pub fn buildImgui( lib.linkSystemLibrary("freetype2"); if (opt.freetype.include) |dirs| - for (dirs) |dir| lib.addIncludePath(dir); + for (dirs) |dir| lib.addIncludePath(.{ .path = dir }); // Enable in defines try flags.appendSlice(&.{ @@ -97,7 +97,10 @@ pub fn buildImgui( }); // Add necessary C file - lib.addCSourceFile(root ++ "imgui/misc/freetype/imgui_freetype.cpp", flags.items); + lib.addCSourceFile(.{ + .file = .{ .path = root ++ "imgui/misc/freetype/imgui_freetype.cpp" }, + .flags = flags.items, + }); } // C files @@ -117,7 +120,10 @@ pub fn buildImgui( .{ root, backend, ext }, ); - lib.addCSourceFile(path, flags.items); + lib.addCSourceFile(.{ + .file = .{ .path = path }, + .flags = flags.items, + }); } } diff --git a/pkg/libpng/build.zig b/pkg/libpng/build.zig index a097e9240..0e98059ac 100644 --- a/pkg/libpng/build.zig +++ b/pkg/libpng/build.zig @@ -32,7 +32,7 @@ pub fn link( ) !*std.build.LibExeObjStep { const lib = try buildLib(b, step, opt); step.linkLibrary(lib); - step.addIncludePath(include_path); + step.addIncludePath(.{ .path = include_path }); return lib; } @@ -49,8 +49,8 @@ pub fn buildLib( }); // Include - lib.addIncludePath(include_path); - lib.addIncludePath(include_path_pnglibconf); + lib.addIncludePath(.{ .path = include_path }); + lib.addIncludePath(.{ .path = include_path_pnglibconf }); // Link lib.linkLibC(); @@ -64,7 +64,7 @@ pub fn buildLib( lib.linkSystemLibrary("z"); if (opt.zlib.include) |dirs| - for (dirs) |dir| lib.addIncludePath(dir); + for (dirs) |dir| lib.addIncludePath(.{ .path = dir }); // Compile var flags = std.ArrayList([]const u8).init(b.allocator); diff --git a/pkg/macos/build.zig b/pkg/macos/build.zig index a75087cdd..c9bd6b3ba 100644 --- a/pkg/macos/build.zig +++ b/pkg/macos/build.zig @@ -27,8 +27,14 @@ pub fn link( .target = step.target, .optimize = step.optimize, }); - step.addCSourceFile(comptime thisDir() ++ "/os/log.c", flags.items); - step.addCSourceFile(comptime thisDir() ++ "/text/ext.c", flags.items); + step.addCSourceFile(.{ + .file = .{ .path = comptime thisDir() ++ "/os/log.c" }, + .flags = flags.items, + }); + step.addCSourceFile(.{ + .file = .{ .path = comptime thisDir() ++ "/text/ext.c" }, + .flags = flags.items, + }); step.linkFramework("CoreFoundation"); step.linkFramework("CoreText"); return lib; diff --git a/pkg/pixman/build.zig b/pkg/pixman/build.zig index 77847fa75..bcee196d3 100644 --- a/pkg/pixman/build.zig +++ b/pkg/pixman/build.zig @@ -42,8 +42,8 @@ pub fn link( ) !*std.build.LibExeObjStep { const lib = try buildPixman(b, step, opt); step.linkLibrary(lib); - step.addIncludePath(include_path); - step.addIncludePath(include_path_self); + step.addIncludePath(.{ .path = include_path }); + step.addIncludePath(.{ .path = include_path_self }); return lib; } @@ -62,8 +62,8 @@ pub fn buildPixman( }); // Include - lib.addIncludePath(include_path); - lib.addIncludePath(include_path_self); + lib.addIncludePath(.{ .path = include_path }); + lib.addIncludePath(.{ .path = include_path_self }); // Link lib.linkLibC(); diff --git a/pkg/stb_image_resize/build.zig b/pkg/stb_image_resize/build.zig index 6a0deb2a8..00f0bec57 100644 --- a/pkg/stb_image_resize/build.zig +++ b/pkg/stb_image_resize/build.zig @@ -25,7 +25,7 @@ pub fn link( ) !*std.build.LibExeObjStep { const lib = try buildStbImageResize(b, step, opt); step.linkLibrary(lib); - inline for (include_paths) |path| step.addIncludePath(path); + inline for (include_paths) |path| step.addIncludePath(.{ .path = path }); return lib; } @@ -43,7 +43,7 @@ pub fn buildStbImageResize( }); // Include - inline for (include_paths) |path| lib.addIncludePath(path); + inline for (include_paths) |path| lib.addIncludePath(.{ .path = path }); // Link lib.linkLibC(); @@ -56,7 +56,10 @@ pub fn buildStbImageResize( }); // C files - lib.addCSourceFile(root ++ "/stb_image_resize.c", flags.items); + lib.addCSourceFile(.{ + .file = .{ .path = root ++ "/stb_image_resize.c" }, + .flags = flags.items, + }); return lib; } diff --git a/pkg/tracy/build.zig b/pkg/tracy/build.zig index 7894f00c3..23c94422d 100644 --- a/pkg/tracy/build.zig +++ b/pkg/tracy/build.zig @@ -16,7 +16,7 @@ fn thisDir() []const u8 { pub fn link(b: *std.Build, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep { const tracy = try buildTracy(b, step); step.linkLibrary(tracy); - step.addIncludePath(root); + step.addIncludePath(.{ .path = root }); return tracy; } @@ -45,11 +45,14 @@ pub fn buildTracy( }); } - lib.addIncludePath(root); - lib.addCSourceFile(try std.fs.path.join( - b.allocator, - &.{ root, "TracyClient.cpp" }, - ), flags.items); + lib.addIncludePath(.{ .path = root }); + lib.addCSourceFile(.{ + .file = .{ .path = try std.fs.path.join( + b.allocator, + &.{ root, "TracyClient.cpp" }, + ) }, + .flags = flags.items, + }); lib.linkLibC(); lib.linkSystemLibrary("c++"); diff --git a/pkg/utf8proc/build.zig b/pkg/utf8proc/build.zig index 23bfa8346..675c79630 100644 --- a/pkg/utf8proc/build.zig +++ b/pkg/utf8proc/build.zig @@ -19,7 +19,7 @@ fn thisDir() []const u8 { pub fn link(b: *std.Build, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep { const lib = try buildLib(b, step); step.linkLibrary(lib); - step.addIncludePath(include_path); + step.addIncludePath(.{ .path = include_path }); return lib; } @@ -34,7 +34,7 @@ pub fn buildLib( }); // Include - lib.addIncludePath(include_path); + lib.addIncludePath(.{ .path = include_path }); // Link lib.linkLibC(); diff --git a/pkg/zlib/build.zig b/pkg/zlib/build.zig index 7628479cc..fa2a57acb 100644 --- a/pkg/zlib/build.zig +++ b/pkg/zlib/build.zig @@ -18,7 +18,7 @@ fn thisDir() []const u8 { pub fn link(b: *std.build.Builder, step: *std.build.LibExeObjStep) !*std.build.LibExeObjStep { const lib = try buildLib(b, step); step.linkLibrary(lib); - step.addIncludePath(include_path); + step.addIncludePath(.{ .path = include_path }); return lib; } @@ -33,7 +33,7 @@ pub fn buildLib( }); // Include - lib.addIncludePath(include_path); + lib.addIncludePath(.{ .path = include_path }); // Link lib.linkLibC(); diff --git a/vendor/mach-glfw b/vendor/mach-glfw index 70ff87ba8..037ccd1a2 160000 --- a/vendor/mach-glfw +++ b/vendor/mach-glfw @@ -1 +1 @@ -Subproject commit 70ff87ba8af0820bbcfdbdf3b15555cb4c19f7ab +Subproject commit 037ccd1a241cf71d6e777ef5fff1b1241cf652e0 diff --git a/vendor/zig-libxml2 b/vendor/zig-libxml2 index 252c73242..5aae6093c 160000 --- a/vendor/zig-libxml2 +++ b/vendor/zig-libxml2 @@ -1 +1 @@ -Subproject commit 252c732429a686e4a835831038263a554e752c40 +Subproject commit 5aae6093c9faa8699d4a39b530b44daf5df91c0e