From 09e4c1e6f2f86de1b92fd1dd4d057f293f58fa34 Mon Sep 17 00:00:00 2001 From: Mitchell Hashimoto Date: Wed, 01 Oct 2025 14:00:41 +0000 Subject: [PATCH] build: isolate XCFramework.Target so runtime code doesn't depend on it This fixes the lazyImport importing outside of the build root. The build root for the build binary is always the root `build.zig` (which we want), but our `src/build_config.zig` transitively imported SharedDeps which led to issues. --- src/build/Config.zig | 6 +++--- src/build/GhosttyXCFramework.zig | 3 +-- src/build/xcframework.zig | 3 +++ 3 file(s) changed, 7 insertion(s)(+), 5 deletion(s)(-) diff --git a/src/build/Config.zig b/src/build/Config.zig --- a/src/build/Config.zig +++ b/src/build/Config.zig @@ -9,7 +9,7 @@ const FontBackend = @import("../font/backend.zig").Backend; const RendererBackend = @import("../renderer/backend.zig").Backend; const TerminalBuildOptions = @import("../terminal/build_options.zig").Options; -const XCFramework = @import("GhosttyXCFramework.zig"); +const XCFrameworkTarget = @import("xcframework.zig").Target; const WasmTarget = @import("../os/wasm/target.zig").Target; const expandPath = @import("../os/path.zig").expand; @@ -26,7 +26,7 @@ /// Standard build configuration options. optimize: std.builtin.OptimizeMode, target: std.Build.ResolvedTarget, -xcframework_target: XCFramework.Target = .universal, +xcframework_target: XCFrameworkTarget = .universal, wasm_target: WasmTarget, /// Comptime interfaces @@ -121,7 +121,7 @@ //--------------------------------------------------------------- // Target-specific properties config.xcframework_target = b.option( - XCFramework.Target, + XCFrameworkTarget, "xcframework-target", "The target for the xcframework.", ) orelse .universal; diff --git a/src/build/GhosttyXCFramework.zig b/src/build/GhosttyXCFramework.zig --- a/src/build/GhosttyXCFramework.zig +++ b/src/build/GhosttyXCFramework.zig @@ -5,11 +5,10 @@ const SharedDeps = @import("SharedDeps.zig"); const GhosttyLib = @import("GhosttyLib.zig"); const XCFrameworkStep = @import("XCFrameworkStep.zig"); +const Target = @import("xcframework.zig").Target; xcframework: *XCFrameworkStep, target: Target, - -pub const Target = enum { native, universal }; pub fn init( b: *std.Build, diff --git a/src/build/xcframework.zig b/src/build/xcframework.zig new file mode 100644 --- /dev/null +++ b/src/build/xcframework.zig @@ -0,0 +1,3 @@ +/// Target for xcframework builds. This is a separate file so that +/// our runtime code doesn't need to import build code. +pub const Target = enum { native, universal }; -- tangled.sh