Skip to content

Commit 0c03ac7

Browse files
committed
Fix build for recent Zig 0.14.0-dev changes
Upstream change: ziglang/zig@481b7bf
1 parent d582e20 commit 0c03ac7

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

build.zig

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ pub fn build(b: *std.Build) void {
55
const optimize = b.standardOptimizeOption(.{});
66
const t = target.result;
77

8-
const is_shared_library = t.isAndroid();
8+
const is_android = if (@hasDecl(@TypeOf(t), "isAndroid")) t.isAndroid() else t.abi.isAndroid();
9+
const is_shared_library = is_android;
910
const lib = if (!is_shared_library) b.addStaticLibrary(.{
1011
.name = "SDL2",
1112
.target = target,
@@ -74,7 +75,7 @@ pub fn build(b: *std.Build) void {
7475
lib.addIncludePath(.{ .cwd_relative = cache_include });
7576
},
7677
else => {
77-
if (t.isAndroid()) {
78+
if (is_android) {
7879
lib.root_module.addCSourceFiles(.{
7980
.files = &android_src_files,
8081
});
@@ -115,7 +116,7 @@ pub fn build(b: *std.Build) void {
115116

116117
const use_pregenerated_config = switch (t.os.tag) {
117118
.windows, .macos, .emscripten => true,
118-
.linux => t.isAndroid(),
119+
.linux => is_android,
119120
else => false,
120121
};
121122

@@ -165,7 +166,7 @@ pub fn build(b: *std.Build) void {
165166
lib.installHeader(revision_header.getOutput(), "SDL2/SDL_revision.h");
166167
}
167168

168-
const use_hidapi = b.option(bool, "use_hidapi", "Use hidapi shared library") orelse t.isAndroid();
169+
const use_hidapi = b.option(bool, "use_hidapi", "Use hidapi shared library") orelse is_android;
169170

170171
if (use_hidapi) {
171172
const hidapi_lib = b.addSharedLibrary(.{
@@ -1183,7 +1184,7 @@ fn configHeader(b: *std.Build, t: std.Target) *std.Build.Step.ConfigHeader {
11831184
.HAVE_SETJMP = 1,
11841185
.HAVE_NANOSLEEP = 1,
11851186
.HAVE_SYSCONF = 1,
1186-
.HAVE_SYSCTLBYNAME = t.isDarwin(),
1187+
.HAVE_SYSCTLBYNAME = t.os.tag.isDarwin(),
11871188
.HAVE_CLOCK_GETTIME = 1,
11881189
.HAVE_GETPAGESIZE = 1,
11891190
.HAVE_MPROTECT = 1,

0 commit comments

Comments
 (0)