From dd18eaab5da6926e1314a695d168639fd4ab7314 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 2 Aug 2023 15:06:24 -0700 Subject: [PATCH] fix various build scripts --- build.zig | 23 +++++++++++++---------- pkg/fontconfig/build.zig | 12 ++++++------ pkg/imgui/build.zig | 16 +++++++++++----- vendor/zig-libxml2 | 2 +- 4 files changed, 31 insertions(+), 22 deletions(-) diff --git a/build.zig b/build.zig index 905e87e15..278e144af 100644 --- a/build.zig +++ b/build.zig @@ -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"); @@ -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"), } } @@ -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/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/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/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