build: shared object is a dylib on macOS
parent
3d04fbb451
commit
def4969aff
|
|
@ -101,9 +101,8 @@ pub fn build(b: *std.Build) !void {
|
||||||
const libghostty_vt_shared = try buildpkg.GhosttyLibVt.initShared(
|
const libghostty_vt_shared = try buildpkg.GhosttyLibVt.initShared(
|
||||||
b,
|
b,
|
||||||
&mod,
|
&mod,
|
||||||
&deps,
|
|
||||||
);
|
);
|
||||||
libghostty_vt_shared.install(libvt_step, "libghostty-vt.so");
|
libghostty_vt_shared.install(libvt_step, "libghostty-vt");
|
||||||
libghostty_vt_shared.installHeader(libvt_step);
|
libghostty_vt_shared.installHeader(libvt_step);
|
||||||
|
|
||||||
// Helpgen
|
// Helpgen
|
||||||
|
|
|
||||||
|
|
@ -589,6 +589,16 @@ pub fn genericMacOSTarget(
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// The extension to use for a shared library on the given target.
|
||||||
|
pub fn sharedLibExt(target: std.Build.ResolvedTarget) []const u8 {
|
||||||
|
return if (target.result.os.tag.isDarwin())
|
||||||
|
"dylib"
|
||||||
|
else if (target.result.os.tag == .windows)
|
||||||
|
return "dll"
|
||||||
|
else
|
||||||
|
return "so";
|
||||||
|
}
|
||||||
|
|
||||||
/// The possible entrypoints for the exe artifact. This has no effect on
|
/// The possible entrypoints for the exe artifact. This has no effect on
|
||||||
/// other artifact types (i.e. lib, wasm_module).
|
/// other artifact types (i.e. lib, wasm_module).
|
||||||
///
|
///
|
||||||
|
|
|
||||||
|
|
@ -15,11 +15,14 @@ step: *std.Build.Step,
|
||||||
output: std.Build.LazyPath,
|
output: std.Build.LazyPath,
|
||||||
dsym: ?std.Build.LazyPath,
|
dsym: ?std.Build.LazyPath,
|
||||||
|
|
||||||
|
/// Library extension, e.g. "dylib", "so", "dll"
|
||||||
|
ext: []const u8,
|
||||||
|
|
||||||
pub fn initShared(
|
pub fn initShared(
|
||||||
b: *std.Build,
|
b: *std.Build,
|
||||||
zig: *const GhosttyZig,
|
zig: *const GhosttyZig,
|
||||||
deps: *const SharedDeps,
|
|
||||||
) !GhosttyLibVt {
|
) !GhosttyLibVt {
|
||||||
|
const target = zig.vt.resolved_target.?;
|
||||||
const lib = b.addSharedLibrary(.{
|
const lib = b.addSharedLibrary(.{
|
||||||
.name = "ghostty-vt",
|
.name = "ghostty-vt",
|
||||||
.root_module = zig.vt,
|
.root_module = zig.vt,
|
||||||
|
|
@ -27,7 +30,7 @@ pub fn initShared(
|
||||||
|
|
||||||
// Get our debug symbols
|
// Get our debug symbols
|
||||||
const dsymutil: ?std.Build.LazyPath = dsymutil: {
|
const dsymutil: ?std.Build.LazyPath = dsymutil: {
|
||||||
if (!deps.config.target.result.os.tag.isDarwin()) {
|
if (!target.result.os.tag.isDarwin()) {
|
||||||
break :dsymutil null;
|
break :dsymutil null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -43,6 +46,7 @@ pub fn initShared(
|
||||||
.step = &lib.step,
|
.step = &lib.step,
|
||||||
.output = lib.getEmittedBin(),
|
.output = lib.getEmittedBin(),
|
||||||
.dsym = dsymutil,
|
.dsym = dsymutil,
|
||||||
|
.ext = Config.sharedLibExt(target),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -54,7 +58,7 @@ pub fn install(
|
||||||
const b = self.step.owner;
|
const b = self.step.owner;
|
||||||
const lib_install = b.addInstallLibFile(
|
const lib_install = b.addInstallLibFile(
|
||||||
self.output,
|
self.output,
|
||||||
name,
|
b.fmt("{s}.{s}", .{ name, self.ext }),
|
||||||
);
|
);
|
||||||
step.dependOn(&lib_install.step);
|
step.dependOn(&lib_install.step);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue