fix various build scripts

This commit is contained in:
Mitchell Hashimoto
2023-08-02 15:06:24 -07:00
parent d649b3f6d4
commit dd18eaab5d
4 changed files with 31 additions and 22 deletions

View File

@ -250,7 +250,7 @@ pub fn build(b: *std.Build) !void {
// If we're installing, we get the install step so we can add // If we're installing, we get the install step so we can add
// additional dependencies to it. // additional dependencies to it.
const install_step = if (app_runtime != .none) step: { const install_step = if (app_runtime != .none) step: {
const step = b.addInstallArtifact(exe); const step = b.addInstallArtifact(exe, .{});
b.getInstallStep().dependOn(&step.step); b.getInstallStep().dependOn(&step.step);
break :step step; break :step step;
} else null; } else null;
@ -392,7 +392,7 @@ pub fn build(b: *std.Build) !void {
// App (Mac) // App (Mac)
if (target.isDarwin()) { if (target.isDarwin()) {
const bin_install = b.addInstallFile( const bin_install = b.addInstallFile(
.{ .generated = &exe.output_path_source }, exe.getEmittedBin(),
"Ghostty.app/Contents/MacOS/ghostty", "Ghostty.app/Contents/MacOS/ghostty",
); );
b.getInstallStep().dependOn(&bin_install.step); 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 // Create a single static lib with all our dependencies merged
var lib_list = try addDeps(b, lib, true); 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, .{ const libtool = LibtoolStep.create(b, .{
.name = "ghostty", .name = "ghostty",
.out_name = "libghostty-aarch64-fat.a", .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 // Create a single static lib with all our dependencies merged
var lib_list = try addDeps(b, lib, true); 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, .{ const libtool = LibtoolStep.create(b, .{
.name = "ghostty", .name = "ghostty",
.out_name = "libghostty-x86_64-fat.a", .out_name = "libghostty-x86_64-fat.a",
@ -530,7 +530,7 @@ pub fn build(b: *std.Build) !void {
_ = try addDeps(b, wasm, true); _ = try addDeps(b, wasm, true);
// Install // Install
const wasm_install = b.addInstallArtifact(wasm); const wasm_install = b.addInstallArtifact(wasm, .{});
wasm_install.dest_dir = .{ .prefix = {} }; wasm_install.dest_dir = .{ .prefix = {} };
const step = b.step("wasm", "Build the wasm library"); const step = b.step("wasm", "Build the wasm library");
@ -792,16 +792,19 @@ fn addDeps(
if (!lib) { if (!lib) {
// We always statically compile glad // We always statically compile glad
step.addIncludePath("vendor/glad/include/"); step.addIncludePath(.{ .path = "vendor/glad/include/" });
step.addCSourceFile("vendor/glad/src/gl.c", &.{}); step.addCSourceFile(.{
.file = .{ .path = "vendor/glad/src/gl.c" },
.flags = &.{},
});
// When we're targeting flatpak we ALWAYS link GTK so we // When we're targeting flatpak we ALWAYS link GTK so we
// get access to glib for dbus. // get access to glib for dbus.
if (flatpak) { if (flatpak) {
step.linkSystemLibrary("gtk4"); step.linkSystemLibrary("gtk4");
switch (step.target.getCpuArch()) { switch (step.target.getCpuArch()) {
.aarch64 => step.addLibraryPath("/usr/lib/aarch64-linux-gnu"), .aarch64 => step.addLibraryPath(.{ .path = "/usr/lib/aarch64-linux-gnu" }),
.x86_64 => step.addLibraryPath("/usr/lib/x86_64-linux-gnu"), .x86_64 => step.addLibraryPath(.{ .path = "/usr/lib/x86_64-linux-gnu" }),
else => @panic("unsupported flatpak target"), else => @panic("unsupported flatpak target"),
} }
} }
@ -915,7 +918,7 @@ fn conformanceSteps(
.optimize = optimize, .optimize = optimize,
}); });
const install = b.addInstallArtifact(c_exe); const install = b.addInstallArtifact(c_exe, .{});
install.dest_sub_path = "conformance"; install.dest_sub_path = "conformance";
b.getInstallStep().dependOn(&install.step); b.getInstallStep().dependOn(&install.step);

View File

@ -44,8 +44,8 @@ pub fn link(
) !*std.build.LibExeObjStep { ) !*std.build.LibExeObjStep {
const lib = try buildFontconfig(b, step, opt); const lib = try buildFontconfig(b, step, opt);
step.linkLibrary(lib); step.linkLibrary(lib);
step.addIncludePath(include_path); step.addIncludePath(.{ .path = include_path });
step.addIncludePath(include_path_self); step.addIncludePath(.{ .path = include_path_self });
return lib; return lib;
} }
@ -62,8 +62,8 @@ pub fn buildFontconfig(
}); });
// Include // Include
lib.addIncludePath(include_path); lib.addIncludePath(.{ .path = include_path });
lib.addIncludePath(include_path_self); lib.addIncludePath(.{ .path = include_path_self });
// Link // Link
lib.linkLibC(); lib.linkLibC();
@ -74,7 +74,7 @@ pub fn buildFontconfig(
lib.linkSystemLibrary("expat"); lib.linkSystemLibrary("expat");
if (opt.expat.include) |dirs| 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.enabled) {
if (opt.freetype.step) |freetype| if (opt.freetype.step) |freetype|
@ -83,7 +83,7 @@ pub fn buildFontconfig(
lib.linkSystemLibrary("freetype2"); lib.linkSystemLibrary("freetype2");
if (opt.freetype.include) |dirs| if (opt.freetype.include) |dirs|
for (dirs) |dir| lib.addIncludePath(dir); for (dirs) |dir| lib.addIncludePath(.{ .path = dir });
} }
if (!target.isWindows()) { if (!target.isWindows()) {
lib.linkSystemLibrary("pthread"); lib.linkSystemLibrary("pthread");

View File

@ -37,7 +37,7 @@ pub fn link(
) !*std.build.LibExeObjStep { ) !*std.build.LibExeObjStep {
const lib = try buildImgui(b, step, opt); const lib = try buildImgui(b, step, opt);
step.linkLibrary(lib); step.linkLibrary(lib);
inline for (include_paths) |path| step.addIncludePath(path); inline for (include_paths) |path| step.addIncludePath(.{ .path = path });
return lib; return lib;
} }
@ -54,7 +54,7 @@ pub fn buildImgui(
}); });
// Include // Include
inline for (include_paths) |path| lib.addIncludePath(path); inline for (include_paths) |path| lib.addIncludePath(.{ .path = path });
// Link // Link
lib.linkLibC(); lib.linkLibC();
@ -88,7 +88,7 @@ pub fn buildImgui(
lib.linkSystemLibrary("freetype2"); lib.linkSystemLibrary("freetype2");
if (opt.freetype.include) |dirs| if (opt.freetype.include) |dirs|
for (dirs) |dir| lib.addIncludePath(dir); for (dirs) |dir| lib.addIncludePath(.{ .path = dir });
// Enable in defines // Enable in defines
try flags.appendSlice(&.{ try flags.appendSlice(&.{
@ -97,7 +97,10 @@ pub fn buildImgui(
}); });
// Add necessary C file // 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 // C files
@ -117,7 +120,10 @@ pub fn buildImgui(
.{ root, backend, ext }, .{ root, backend, ext },
); );
lib.addCSourceFile(path, flags.items); lib.addCSourceFile(.{
.file = .{ .path = path },
.flags = flags.items,
});
} }
} }

2
vendor/zig-libxml2 vendored

@ -1 +1 @@
Subproject commit 252c732429a686e4a835831038263a554e752c40 Subproject commit 5aae6093c9faa8699d4a39b530b44daf5df91c0e