mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-13 19:15:48 +00:00
core: fix c macro comparisons
This commit is contained in:
@@ -146,7 +146,27 @@ pub fn add(
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
});
|
||||
c.defineCMacro("ZIG_TARGET", @tagName(target.result.os.tag));
|
||||
inline for (@typeInfo(std.Target.Os.Tag).@"enum".fields) |field| {
|
||||
c.defineCMacro(
|
||||
b.fmt(
|
||||
"ZIG_TARGET_{s}",
|
||||
.{try std.ascii.allocUpperString(b.allocator, field.name)},
|
||||
),
|
||||
b.fmt("{d}", .{field.value}),
|
||||
);
|
||||
}
|
||||
c.defineCMacro(
|
||||
"ZIG_TARGET",
|
||||
b.fmt(
|
||||
"ZIG_TARGET_{s}",
|
||||
.{
|
||||
try std.ascii.allocUpperString(
|
||||
b.allocator,
|
||||
@tagName(target.result.os.tag),
|
||||
),
|
||||
},
|
||||
),
|
||||
);
|
||||
switch (target.result.os.tag) {
|
||||
.macos => {
|
||||
const libc = try std.zig.LibCInstallation.findNative(.{
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
#if ZIG_TARGET == freebsd
|
||||
#if ZIG_TARGET == ZIG_TARGET_FREEBSD
|
||||
#include <termios.h> // ioctl and constants
|
||||
#include <libutil.h> // openpty
|
||||
#include <stdlib.h> // ptsname_r
|
||||
#include <unistd.h> // tcgetpgrp
|
||||
#endif
|
||||
|
||||
#if ZIG_TARGET == linux
|
||||
#if ZIG_TARGET == ZIG_TARGET_LINUX
|
||||
#define _GNU_SOURCE // ptsname_r
|
||||
#include <pty.h> // openpty
|
||||
#include <stdlib.h> // ptsname_r
|
||||
@@ -13,7 +13,7 @@
|
||||
#include <unistd.h> // tcgetpgrp, setsid
|
||||
#endif
|
||||
|
||||
#if ZIG_TARGET == macos
|
||||
#if ZIG_TARGET == ZIG_TARGET_MACOS
|
||||
#include <sys/ioctl.h> // ioctl and constants
|
||||
#include <sys/ttycom.h> // ioctl and constants for TIOCPTYGNAME
|
||||
#include <sys/types.h>
|
||||
|
||||
Reference in New Issue
Block a user