build: update our macOS checks to check for macOS specifically

This commit is contained in:
Mitchell Hashimoto
2024-01-13 15:29:12 -08:00
parent bfe3c356f0
commit f61eaea4d0
2 changed files with 22 additions and 14 deletions

View File

@ -40,10 +40,18 @@ pub fn build(b: *std.Build) !void {
const target = target: {
var result = b.standardTargetOptions(.{});
if (result.result.isDarwin()) {
if (result.query.os_version_min == null) {
result.query.os_version_min = .{ .semver = .{ .major = 12, .minor = 0, .patch = 0 } };
}
// On macOS, we specify a minimum supported version. This is important
// to set since header files will use this to determine the availability
// 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;
@ -261,7 +269,7 @@ pub fn build(b: *std.Build) !void {
}
// App (Mac)
if (target.result.isDarwin()) {
if (target.result.os.tag == .macos) {
const bin_install = b.addInstallFile(
exe.getEmittedBin(),
"Ghostty.app/Contents/MacOS/ghostty",
@ -282,7 +290,7 @@ pub fn build(b: *std.Build) !void {
});
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: {
var copy = install.options;
copy.install_dir = .{
@ -305,7 +313,7 @@ pub fn build(b: *std.Build) !void {
});
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: {
var copy = install.options;
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_install = b.addInstallFile(src_source, "share/terminfo/ghostty.terminfo");
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(
src_source,
"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");
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(
out_source,
"Ghostty.app/Contents/Resources/terminfo/ghostty.termcap",
@ -379,7 +387,7 @@ pub fn build(b: *std.Build) !void {
b.getInstallStep().dependOn(&copy_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");
copy_step.addArgs(&.{ "cp", "-R" });
copy_step.addFileArg(path);

View File

@ -58,15 +58,15 @@ pub const version_string = options.app_version_string;
/// building a standalone exe, an embedded lib, etc.
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 flatpak = options.flatpak;
pub const app_runtime: apprt.Runtime = config.app_runtime;
pub const font_backend: font.Backend = config.font_backend;
pub const renderer: rendererpkg.Impl = config.renderer;
/// We want to integrate with Flatpak APIs.
pub const flatpak = options.flatpak;
pub const Artifact = enum {
/// Standalone executable
exe,