From c4b9c0e039ceea4e1cef93add47999675843090e Mon Sep 17 00:00:00 2001 From: lumenkeyes <77762232+lumenkeyes@users.noreply.github.com> Date: Tue, 6 May 2025 09:46:42 -0600 Subject: [PATCH 1/3] properly generate android triple in build.zig --- build.zig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 60356a215..0858c3861 100644 --- a/build.zig +++ b/build.zig @@ -215,7 +215,14 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. else => @panic("unsupported host OS"), }; - const androidTriple = try target.result.linuxTriple(b.allocator); + const androidTriple = switch (target.result.cpu.arch) { + .x86 => "i686-linux-android", + .x86_64 => "x86_64-linux-android", + .arm => "arm-linux-androideabi", + .aarch64 => "aarch64-linux-android", + .riscv64 => "riscv64-linux-android", + else => error.InvalidAndroidTarget, + }; const androidNdkPathString: []const u8 = options.android_ndk; if (androidNdkPathString.len < 1) @panic("no ndk path provided and ANDROID_NDK_HOME is not set"); const androidApiLevel: []const u8 = options.android_api_version; From eae3fd83d52174740b9bc763b3981b0ebc57e20a Mon Sep 17 00:00:00 2001 From: lumenkeyes <77762232+lumenkeyes@users.noreply.github.com> Date: Tue, 6 May 2025 10:04:54 -0600 Subject: [PATCH 2/3] properly detect if abi is android --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 0858c3861..3492bf59e 100644 --- a/build.zig +++ b/build.zig @@ -205,7 +205,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. raylib.root_module.addCMacro("PLATFORM_DRM", ""); raylib.root_module.addCMacro("EGL_NO_X11", ""); raylib.root_module.addCMacro("DEFAULT_BATCH_BUFFER_ELEMENT", ""); - } else if (target.result.abi == .android) { + } else if (target.result.abi.isAndroid()) { //these are the only tag options per https://developer.android.com/ndk/guides/other_build_systems const hostTuple = switch (builtin.target.os.tag) { From 35de7b26a487b2ccd4a43dcf5c43d9c8f598a98b Mon Sep 17 00:00:00 2001 From: lumenkeyes <77762232+lumenkeyes@users.noreply.github.com> Date: Tue, 6 May 2025 10:08:12 -0600 Subject: [PATCH 3/3] catch error in build.zig --- build.zig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 3492bf59e..77681e0e6 100644 --- a/build.zig +++ b/build.zig @@ -222,7 +222,7 @@ fn compileRaylib(b: *std.Build, target: std.Build.ResolvedTarget, optimize: std. .aarch64 => "aarch64-linux-android", .riscv64 => "riscv64-linux-android", else => error.InvalidAndroidTarget, - }; + } catch @panic("invalid android target!"); const androidNdkPathString: []const u8 = options.android_ndk; if (androidNdkPathString.len < 1) @panic("no ndk path provided and ANDROID_NDK_HOME is not set"); const androidApiLevel: []const u8 = options.android_api_version;