libghostty als zweite Terminal-Engine integriert (Default ghostty, SwiftTerm Fallback)

- vendor/libghostty: vorgebaute macOS-libghostty.a (arm64) + Header + Build-Patches + README
- Sources/CGhostty: C-Modul der libghostty-C-API
- Sources/MiniTerm/Ghostty.swift: GhosttyApp + GhosttySurfaceView (Surface, Input, Größe, Fokus)
- main.swift: Engine-Wahl per Info.plist MTEngine
- Package.swift: CGhostty-Target + Link gegen libghostty + Frameworks
- STATUS.md: Stand, Build-Weg (macOS-15-VM), offene Punkte
This commit is contained in:
marcus.hinz
2026-06-21 21:40:00 +02:00
parent 51cb14a782
commit c8f5714b1e
22 changed files with 4970 additions and 11 deletions
@@ -0,0 +1,124 @@
diff --git a/build.zig b/build.zig
index f9d861b..93d0780 100644
--- a/build.zig
+++ b/build.zig
@@ -138,9 +138,8 @@ pub fn build(b: *std.Build) !void {
// We shouldn't have this guard but we don't currently
// build on macOS this way ironically so we need to fix that.
- if (!config.target.result.os.tag.isDarwin()) {
+ if (true) {
libghostty_shared.installHeader(); // Only need one header
- libghostty_shared.install("libghostty.so");
libghostty_static.install("libghostty.a");
}
}
diff --git a/src/build/GhosttyXCFramework.zig b/src/build/GhosttyXCFramework.zig
index 3afeb90..ef075b3 100644
--- a/src/build/GhosttyXCFramework.zig
+++ b/src/build/GhosttyXCFramework.zig
@@ -15,74 +15,24 @@ pub fn init(
deps: *const SharedDeps,
target: Target,
) !GhosttyXCFramework {
- // Universal macOS build
- const macos_universal = try GhosttyLib.initMacOSUniversal(b, deps);
-
- // Native macOS build
+ // PATCH: Nur die native macOS-Slice bauen. iOS/iOS-Simulator/Universal
+ // entfernt, weil die VM nur Command Line Tools hat (kein iOS-SDK) und wir
+ // für die macOS-only MiniTerm-Hülle ohnehin nur libghostty.a brauchen.
const macos_native = try GhosttyLib.initStatic(b, &try deps.retarget(
b,
Config.genericMacOSTarget(b, null),
));
- // iOS
- const ios = try GhosttyLib.initStatic(b, &try deps.retarget(
- b,
- b.resolveTargetQuery(.{
- .cpu_arch = .aarch64,
- .os_tag = .ios,
- .os_version_min = Config.osVersionMin(.ios),
- .abi = null,
- }),
- ));
-
- // iOS Simulator
- const ios_sim = try GhosttyLib.initStatic(b, &try deps.retarget(
- b,
- b.resolveTargetQuery(.{
- .cpu_arch = .aarch64,
- .os_tag = .ios,
- .os_version_min = Config.osVersionMin(.ios),
- .abi = .simulator,
-
- // We force the Apple CPU model because the simulator
- // doesn't support the generic CPU model as of Zig 0.14 due
- // to missing "altnzcv" instructions, which is false. This
- // surely can't be right but we can fix this if/when we get
- // back to running simulator builds.
- .cpu_model = .{ .explicit = &std.Target.aarch64.cpu.apple_a17 },
- }),
- ));
-
// The xcframework wraps our ghostty library so that we can link
// it to the final app built with Swift.
const xcframework = XCFrameworkStep.create(b, .{
.name = "GhosttyKit",
.out_path = "macos/GhosttyKit.xcframework",
- .libraries = switch (target) {
- .universal => &.{
- .{
- .library = macos_universal.output,
- .headers = b.path("include"),
- .dsym = macos_universal.dsym,
- },
- .{
- .library = ios.output,
- .headers = b.path("include"),
- .dsym = ios.dsym,
- },
- .{
- .library = ios_sim.output,
- .headers = b.path("include"),
- .dsym = ios_sim.dsym,
- },
- },
-
- .native => &.{.{
- .library = macos_native.output,
- .headers = b.path("include"),
- .dsym = macos_native.dsym,
- }},
- },
+ .libraries = &.{.{
+ .library = macos_native.output,
+ .headers = b.path("include"),
+ .dsym = macos_native.dsym,
+ }},
});
return .{
diff --git a/src/build/MetallibStep.zig b/src/build/MetallibStep.zig
index fcf3055..f4f5bc9 100644
--- a/src/build/MetallibStep.zig
+++ b/src/build/MetallibStep.zig
@@ -55,7 +55,7 @@ pub fn create(b: *std.Build, opts: Options) ?*MetallibStep {
b,
b.fmt("metal {s}", .{opts.name}),
);
- run_ir.addArgs(&.{ "/usr/bin/xcrun", "-sdk", sdk, "metal", "-o" });
+ run_ir.addArgs(&.{ "/usr/bin/env", "DEVELOPER_DIR=/Applications/Xcode_26.4.1.app/Contents/Developer", "/usr/bin/xcrun", "-sdk", sdk, "metal", "-o" });
const output_ir = run_ir.addOutputFileArg(b.fmt("{s}.ir", .{opts.name}));
run_ir.addArgs(&.{"-c"});
for (opts.sources) |source| run_ir.addFileArg(source);
@@ -70,7 +70,7 @@ pub fn create(b: *std.Build, opts: Options) ?*MetallibStep {
b,
b.fmt("metallib {s}", .{opts.name}),
);
- run_lib.addArgs(&.{ "/usr/bin/xcrun", "-sdk", sdk, "metallib", "-o" });
+ run_lib.addArgs(&.{ "/usr/bin/env", "DEVELOPER_DIR=/Applications/Xcode_26.4.1.app/Contents/Developer", "/usr/bin/xcrun", "-sdk", sdk, "metallib", "-o" });
const output_lib = run_lib.addOutputFileArg(b.fmt("{s}.metallib", .{opts.name}));
run_lib.addFileArg(output_ir);
run_lib.step.dependOn(&run_ir.step);