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

View File

@ -76,7 +76,7 @@ pub fn build(b: *std.Build) !void {
.flags = flags.items, .flags = flags.items,
}); });
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
if (!target.query.isNative()) { if (!target.query.isNative()) {
try @import("apple_sdk").addPaths(b, &lib.root_module); try @import("apple_sdk").addPaths(b, &lib.root_module);
try @import("apple_sdk").addPaths(b, 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.linkLibC();
lib.addIncludePath(upstream.path("include")); lib.addIncludePath(upstream.path("include"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); 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(upstream.path(""));
module.addIncludePath(b.path("override")); module.addIncludePath(b.path("override"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
} }
@ -53,7 +53,7 @@ fn buildGlslang(
lib.linkLibCpp(); lib.linkLibCpp();
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));
lib.addIncludePath(b.path("override")); lib.addIncludePath(b.path("override"));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); 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")); lib.addIncludePath(upstream.path("src"));
module.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, &lib.root_module);
try apple_sdk.addPaths(b, module); try apple_sdk.addPaths(b, module);
} }

View File

@ -21,7 +21,7 @@ pub fn build(b: *std.Build) !void {
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));
module.addIncludePath(upstream.path("")); module.addIncludePath(upstream.path(""));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, &lib.root_module);
try apple_sdk.addPaths(b, 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"));
lib.addIncludePath(upstream.path("gettext-runtime/intl/gnulib-lib")); 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"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); 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) { if (target.result.os.tag == .linux) {
lib.linkSystemLibrary("m"); lib.linkSystemLibrary("m");
} }
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, &lib.root_module);
} }

View File

@ -38,7 +38,7 @@ pub fn build(b: *std.Build) !void {
module.linkFramework("Carbon", .{}); module.linkFramework("Carbon", .{});
} }
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
module.linkFramework("CoreFoundation", .{}); module.linkFramework("CoreFoundation", .{});
module.linkFramework("CoreGraphics", .{}); module.linkFramework("CoreGraphics", .{});
module.linkFramework("CoreText", .{}); 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")); lib.addIncludePath(upstream.path("src"));
module.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"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); try apple_sdk.addPaths(b, &lib.root_module);
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -13,7 +13,7 @@ pub fn build(b: *std.Build) !void {
}); });
lib.linkLibC(); lib.linkLibC();
lib.addIncludePath(upstream.path("")); lib.addIncludePath(upstream.path(""));
if (target.result.isDarwin()) { if (target.result.os.tag.isDarwin()) {
const apple_sdk = @import("apple_sdk"); const apple_sdk = @import("apple_sdk");
try apple_sdk.addPaths(b, &lib.root_module); 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 // If we're building for macOS and we're on macOS, we need to
// use a generic target to workaround compilation issues. // 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); result = genericMacOSTarget(b, null);
} }
@ -331,7 +331,7 @@ pub fn init(b: *std.Build) !Config {
bool, bool,
"emit-xcframework", "emit-xcframework",
"Build and install the xcframework for the macOS library.", "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 target.result.os.tag == .macos and
config.app_runtime == .none and config.app_runtime == .none and
(!config.emit_bench 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 // If we're not on darwin we want to use whatever the
// default is via the system package mode // 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. // We always require the system SDK so that our system headers are available.
// This makes things like `os/log.h` available for cross-compiling. // 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); try @import("apple_sdk").addPaths(b, &step.root_module);
const metallib = self.metallib.?; const metallib = self.metallib.?;
@ -363,7 +363,7 @@ pub fn add(
}).module("zf")); }).module("zf"));
// Mac Stuff // Mac Stuff
if (step.rootModuleTarget().isDarwin()) { if (step.rootModuleTarget().os.tag.isDarwin()) {
const objc_dep = b.dependency("zig_objc", .{ const objc_dep = b.dependency("zig_objc", .{
.target = target, .target = target,
.optimize = optimize, .optimize = optimize,

View File

@ -80,7 +80,7 @@ pub const Artifact = enum {
wasm_module, wasm_module,
pub fn detect() Artifact { pub fn detect() Artifact {
if (builtin.target.isWasm()) { if (builtin.target.cpu.arch.isWasm()) {
assert(builtin.output_mode == .Obj); assert(builtin.output_mode == .Obj);
assert(builtin.link_mode == .Static); assert(builtin.link_mode == .Static);
return .wasm_module; 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. // If we're targeting wasm then we export some wasm APIs.
comptime { comptime {
if (builtin.target.isWasm()) { if (builtin.target.cpu.arch.isWasm()) {
_ = Atlas.Wasm; _ = Atlas.Wasm;
_ = DeferredFace.Wasm; _ = DeferredFace.Wasm;
_ = face.web_canvas.Wasm; _ = face.web_canvas.Wasm;
@ -91,7 +91,7 @@ pub const Backend = enum {
// macOS also supports "coretext_freetype" but there is no scenario // macOS also supports "coretext_freetype" but there is no scenario
// that is the default. It is only used by people who want to // that is the default. It is only used by people who want to
// self-compile Ghostty and prefer the freetype aesthetic. // 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 // 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; return .opengl;
} }
}; };