mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-08-02 14:57:31 +03:00
build: update our macOS checks to check for macOS specifically
This commit is contained in:
28
build.zig
28
build.zig
@ -40,10 +40,18 @@ pub fn build(b: *std.Build) !void {
|
|||||||
const target = target: {
|
const target = target: {
|
||||||
var result = b.standardTargetOptions(.{});
|
var result = b.standardTargetOptions(.{});
|
||||||
|
|
||||||
if (result.result.isDarwin()) {
|
// On macOS, we specify a minimum supported version. This is important
|
||||||
if (result.query.os_version_min == null) {
|
// to set since header files will use this to determine the availability
|
||||||
result.query.os_version_min = .{ .semver = .{ .major = 12, .minor = 0, .patch = 0 } };
|
// of certain APIs and I believe it is also encoded in the Mach-O
|
||||||
}
|
// binaries.
|
||||||
|
if (result.result.os.tag == .macos and
|
||||||
|
result.query.os_version_min == null)
|
||||||
|
{
|
||||||
|
result.query.os_version_min = .{ .semver = .{
|
||||||
|
.major = 12,
|
||||||
|
.minor = 0,
|
||||||
|
.patch = 0,
|
||||||
|
} };
|
||||||
}
|
}
|
||||||
|
|
||||||
break :target result;
|
break :target result;
|
||||||
@ -261,7 +269,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// App (Mac)
|
// App (Mac)
|
||||||
if (target.result.isDarwin()) {
|
if (target.result.os.tag == .macos) {
|
||||||
const bin_install = b.addInstallFile(
|
const bin_install = b.addInstallFile(
|
||||||
exe.getEmittedBin(),
|
exe.getEmittedBin(),
|
||||||
"Ghostty.app/Contents/MacOS/ghostty",
|
"Ghostty.app/Contents/MacOS/ghostty",
|
||||||
@ -282,7 +290,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
});
|
});
|
||||||
b.getInstallStep().dependOn(&install.step);
|
b.getInstallStep().dependOn(&install.step);
|
||||||
|
|
||||||
if (target.result.isDarwin() and exe_ != null) {
|
if (target.result.os.tag == .macos and exe_ != null) {
|
||||||
const mac_install = b.addInstallDirectory(options: {
|
const mac_install = b.addInstallDirectory(options: {
|
||||||
var copy = install.options;
|
var copy = install.options;
|
||||||
copy.install_dir = .{
|
copy.install_dir = .{
|
||||||
@ -305,7 +313,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
});
|
});
|
||||||
b.getInstallStep().dependOn(&install.step);
|
b.getInstallStep().dependOn(&install.step);
|
||||||
|
|
||||||
if (target.result.isDarwin() and exe_ != null) {
|
if (target.result.os.tag == .macos and exe_ != null) {
|
||||||
const mac_install = b.addInstallDirectory(options: {
|
const mac_install = b.addInstallDirectory(options: {
|
||||||
var copy = install.options;
|
var copy = install.options;
|
||||||
copy.install_dir = .{
|
copy.install_dir = .{
|
||||||
@ -329,7 +337,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
const src_source = wf.add("share/terminfo/ghostty.terminfo", str.items);
|
const src_source = wf.add("share/terminfo/ghostty.terminfo", str.items);
|
||||||
const src_install = b.addInstallFile(src_source, "share/terminfo/ghostty.terminfo");
|
const src_install = b.addInstallFile(src_source, "share/terminfo/ghostty.terminfo");
|
||||||
b.getInstallStep().dependOn(&src_install.step);
|
b.getInstallStep().dependOn(&src_install.step);
|
||||||
if (target.result.isDarwin() and exe_ != null) {
|
if (target.result.os.tag == .macos and exe_ != null) {
|
||||||
const mac_src_install = b.addInstallFile(
|
const mac_src_install = b.addInstallFile(
|
||||||
src_source,
|
src_source,
|
||||||
"Ghostty.app/Contents/Resources/terminfo/ghostty.terminfo",
|
"Ghostty.app/Contents/Resources/terminfo/ghostty.terminfo",
|
||||||
@ -350,7 +358,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
const cap_install = b.addInstallFile(out_source, "share/terminfo/ghostty.termcap");
|
const cap_install = b.addInstallFile(out_source, "share/terminfo/ghostty.termcap");
|
||||||
b.getInstallStep().dependOn(&cap_install.step);
|
b.getInstallStep().dependOn(&cap_install.step);
|
||||||
|
|
||||||
if (target.result.isDarwin() and exe_ != null) {
|
if (target.result.os.tag == .macos and exe_ != null) {
|
||||||
const mac_cap_install = b.addInstallFile(
|
const mac_cap_install = b.addInstallFile(
|
||||||
out_source,
|
out_source,
|
||||||
"Ghostty.app/Contents/Resources/terminfo/ghostty.termcap",
|
"Ghostty.app/Contents/Resources/terminfo/ghostty.termcap",
|
||||||
@ -379,7 +387,7 @@ pub fn build(b: *std.Build) !void {
|
|||||||
b.getInstallStep().dependOn(©_step.step);
|
b.getInstallStep().dependOn(©_step.step);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (target.result.isDarwin() and exe_ != null) {
|
if (target.result.os.tag == .macos and exe_ != null) {
|
||||||
const copy_step = RunStep.create(b, "copy terminfo db");
|
const copy_step = RunStep.create(b, "copy terminfo db");
|
||||||
copy_step.addArgs(&.{ "cp", "-R" });
|
copy_step.addArgs(&.{ "cp", "-R" });
|
||||||
copy_step.addFileArg(path);
|
copy_step.addFileArg(path);
|
||||||
|
@ -58,15 +58,15 @@ pub const version_string = options.app_version_string;
|
|||||||
/// building a standalone exe, an embedded lib, etc.
|
/// building a standalone exe, an embedded lib, etc.
|
||||||
pub const artifact = Artifact.detect();
|
pub const artifact = Artifact.detect();
|
||||||
|
|
||||||
/// Our build configuration.
|
/// Our build configuration. We re-export a lot of these back at the
|
||||||
|
/// top-level so its a bit cleaner to use throughout the code. See the doc
|
||||||
|
/// comments in BuildConfig for details on each.
|
||||||
pub const config = BuildConfig.fromOptions();
|
pub const config = BuildConfig.fromOptions();
|
||||||
|
pub const flatpak = options.flatpak;
|
||||||
pub const app_runtime: apprt.Runtime = config.app_runtime;
|
pub const app_runtime: apprt.Runtime = config.app_runtime;
|
||||||
pub const font_backend: font.Backend = config.font_backend;
|
pub const font_backend: font.Backend = config.font_backend;
|
||||||
pub const renderer: rendererpkg.Impl = config.renderer;
|
pub const renderer: rendererpkg.Impl = config.renderer;
|
||||||
|
|
||||||
/// We want to integrate with Flatpak APIs.
|
|
||||||
pub const flatpak = options.flatpak;
|
|
||||||
|
|
||||||
pub const Artifact = enum {
|
pub const Artifact = enum {
|
||||||
/// Standalone executable
|
/// Standalone executable
|
||||||
exe,
|
exe,
|
||||||
|
Reference in New Issue
Block a user