Zig 0.14: std.Target breakages

This commit is contained in:
LN Liberda
2025-03-10 01:41:01 +01:00
parent 19bfa2b515
commit ca63e57dd3
21 changed files with 27 additions and 27 deletions

View File

@ -14,7 +14,7 @@ pub fn build(b: *std.Build) !void {
lib.linkLibCpp();
lib.addIncludePath(upstream.path("src"));
lib.addIncludePath(b.path("vendor"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}
@ -29,7 +29,7 @@ pub fn build(b: *std.Build) !void {
.flags = flags.items,
});
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
lib.addCSourceFiles(.{
.root = upstream.path(""),
.files = common_apple,

View File

@ -76,7 +76,7 @@ pub fn build(b: *std.Build) !void {
.flags = flags.items,
});
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
if (!target.query.isNative()) {
try @import("apple_sdk").addPaths(b, &lib.root_module);
try @import("apple_sdk").addPaths(b, module);

View File

@ -69,7 +69,7 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
});
lib.linkLibC();
lib.addIncludePath(upstream.path("include"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -16,7 +16,7 @@ pub fn build(b: *std.Build) !void {
module.addIncludePath(upstream.path(""));
module.addIncludePath(b.path("override"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, module);
}
@ -53,7 +53,7 @@ fn buildGlslang(
lib.linkLibCpp();
lib.addIncludePath(upstream.path(""));
lib.addIncludePath(b.path("override"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -95,7 +95,7 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
lib.addIncludePath(upstream.path("src"));
module.addIncludePath(upstream.path("src"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
try apple_sdk.addPaths(b, &lib.root_module);
try apple_sdk.addPaths(b, module);
}

View File

@ -21,7 +21,7 @@ pub fn build(b: *std.Build) !void {
lib.addIncludePath(upstream.path(""));
module.addIncludePath(upstream.path(""));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
try apple_sdk.addPaths(b, module);

View File

@ -42,7 +42,7 @@ pub fn build(b: *std.Build) !void {
lib.addIncludePath(upstream.path("gettext-runtime/intl"));
lib.addIncludePath(upstream.path("gettext-runtime/intl/gnulib-lib"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -15,7 +15,7 @@ pub fn build(b: *std.Build) !void {
if (target.result.os.tag == .linux) {
lib.linkSystemLibrary("m");
}
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -38,7 +38,7 @@ pub fn build(b: *std.Build) !void {
module.linkFramework("Carbon", .{});
}
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
module.linkFramework("CoreFoundation", .{});
module.linkFramework("CoreGraphics", .{});
module.linkFramework("CoreText", .{});

View File

@ -68,7 +68,7 @@ fn buildLib(b: *std.Build, module: *std.Build.Module, options: anytype) !*std.Bu
lib.addIncludePath(upstream.path("src"));
module.addIncludePath(upstream.path("src"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -23,7 +23,7 @@ pub fn build(b: *std.Build) !void {
lib.linkLibC();
lib.addIncludePath(upstream.path("include"));
lib.addIncludePath(upstream.path("src"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
try apple_sdk.addPaths(b, module);

View File

@ -12,7 +12,7 @@ pub fn build(b: *std.Build) !void {
lib.linkLibCpp();
lib.addIncludePath(b.path("vendor"));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -42,7 +42,7 @@ fn buildSpirvCross(
});
lib.linkLibC();
lib.linkLibCpp();
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -14,7 +14,7 @@ pub fn build(b: *std.Build) !void {
lib.linkLibCpp();
lib.addIncludePath(upstream.path(""));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void {
.link_libc = true,
});
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, module);
}

View File

@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void {
});
lib.linkLibC();
lib.addIncludePath(upstream.path(""));
if (target.result.isDarwin()) {
if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module);
}

View File

@ -69,7 +69,7 @@ pub fn init(b: *std.Build) !Config {
// If we're building for macOS and we're on macOS, we need to
// use a generic target to workaround compilation issues.
if (result.result.os.tag == .macos and builtin.target.isDarwin()) {
if (result.result.os.tag == .macos and builtin.target.os.tag.isDarwin()) {
result = genericMacOSTarget(b, null);
}
@ -331,7 +331,7 @@ pub fn init(b: *std.Build) !Config {
bool,
"emit-xcframework",
"Build and install the xcframework for the macOS library.",
) orelse builtin.target.isDarwin() and
) orelse builtin.target.os.tag.isDarwin() and
target.result.os.tag == .macos and
config.app_runtime == .none and
(!config.emit_bench and
@ -366,7 +366,7 @@ pub fn init(b: *std.Build) !Config {
.{
// If we're not on darwin we want to use whatever the
// default is via the system package mode
.default = if (target.result.isDarwin()) false else null,
.default = if (target.result.os.tag.isDarwin()) false else null,
},
);
}

View File

@ -320,7 +320,7 @@ pub fn add(
// We always require the system SDK so that our system headers are available.
// This makes things like `os/log.h` available for cross-compiling.
if (step.rootModuleTarget().isDarwin()) {
if (step.rootModuleTarget().os.tag.isDarwin()) {
try @import("apple_sdk").addPaths(b, &step.root_module);
const metallib = self.metallib.?;
@ -363,7 +363,7 @@ pub fn add(
}).module("zf"));
// Mac Stuff
if (step.rootModuleTarget().isDarwin()) {
if (step.rootModuleTarget().os.tag.isDarwin()) {
const objc_dep = b.dependency("zig_objc", .{
.target = target,
.optimize = optimize,

View File

@ -80,7 +80,7 @@ pub const Artifact = enum {
wasm_module,
pub fn detect() Artifact {
if (builtin.target.isWasm()) {
if (builtin.target.cpu.arch.isWasm()) {
assert(builtin.output_mode == .Obj);
assert(builtin.link_mode == .Static);
return .wasm_module;

View File

@ -30,7 +30,7 @@ pub const Library = library.Library;
// If we're targeting wasm then we export some wasm APIs.
comptime {
if (builtin.target.isWasm()) {
if (builtin.target.cpu.arch.isWasm()) {
_ = Atlas.Wasm;
_ = DeferredFace.Wasm;
_ = face.web_canvas.Wasm;
@ -91,7 +91,7 @@ pub const Backend = enum {
// macOS also supports "coretext_freetype" but there is no scenario
// that is the default. It is only used by people who want to
// self-compile Ghostty and prefer the freetype aesthetic.
return if (target.isDarwin()) .coretext else .fontconfig_freetype;
return if (target.os.tag.isDarwin()) .coretext else .fontconfig_freetype;
}
// All the functions below can be called at comptime or runtime to

View File

@ -48,7 +48,7 @@ pub const Impl = enum {
};
}
if (target.isDarwin()) return .metal;
if (target.os.tag.isDarwin()) return .metal;
return .opengl;
}
};