diff --git a/packages/zig/build.sh b/packages/zig/build.sh index 488d86ad145310..a922cb1ea060d4 100644 --- a/packages/zig/build.sh +++ b/packages/zig/build.sh @@ -4,6 +4,7 @@ TERMUX_PKG_LICENSE="MIT" TERMUX_PKG_LICENSE_FILE="zig/LICENSE" TERMUX_PKG_MAINTAINER="@termux" TERMUX_PKG_VERSION="0.13.0" +TERMUX_PKG_REVISION=1 TERMUX_PKG_SRCURL=https://github.com/ziglang/zig/releases/download/${TERMUX_PKG_VERSION}/zig-bootstrap-${TERMUX_PKG_VERSION}.tar.xz TERMUX_PKG_SHA256=cd446c084b5da7bc42e8ad9b4e1c910a957f2bf3f82bcc02888102cd0827c139 TERMUX_PKG_BUILD_IN_SRC=true diff --git a/packages/zig/lib-std-zig-LibCInstallation.zig.patch b/packages/zig/lib-std-zig-LibCInstallation.zig.patch new file mode 100644 index 00000000000000..cd28acb0b83786 --- /dev/null +++ b/packages/zig/lib-std-zig-LibCInstallation.zig.patch @@ -0,0 +1,15 @@ +diff --git a/lib/std/zig/LibCInstallation.zig b/lib/std/zig/LibCInstallation.zig +index 686471bde..47e1f714c 100644 +--- a/zig/lib/std/zig/LibCInstallation.zig ++++ b/zig/lib/std/zig/LibCInstallation.zig +@@ -203,6 +203,10 @@ pub fn findNative(args: FindNativeOptions) FindError!LibCInstallation { + self.include_dir = try args.allocator.dupeZ(u8, "/usr/include"); + self.sys_include_dir = try args.allocator.dupeZ(u8, "/usr/include"); + self.crt_dir = try args.allocator.dupeZ(u8, "/usr/lib/64"); ++ } else if (builtin.target.isAndroid()) { ++ self.include_dir = try args.allocator.dupeZ(u8, "@TERMUX_PREFIX@/include"); ++ self.sys_include_dir = try args.allocator.dupeZ(u8, "@TERMUX_PREFIX@/include/sys"); ++ self.crt_dir = try args.allocator.dupeZ(u8, "@TERMUX_PREFIX@/lib/crtbegin_dynamic.o"); + } else if (std.process.can_spawn) { + try self.findNativeIncludeDirPosix(args); + switch (builtin.target.os.tag) { diff --git a/packages/zig/lib-std-zig-system.zig.patch b/packages/zig/lib-std-zig-system.zig.patch new file mode 100644 index 00000000000000..255e87df58d5ad --- /dev/null +++ b/packages/zig/lib-std-zig-system.zig.patch @@ -0,0 +1,16 @@ +diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig +index 83c798c34..6668f4bcd 100644 +--- a/zig/lib/std/zig/system.zig ++++ b/zig/lib/std/zig/system.zig +@@ -996,6 +996,11 @@ fn detectAbiAndDynamicLinker( + .haiku => "/bin/env", + }; + ++ if (builtin.target.isAndroid()) { ++ // Consider using /system/bin/env instead ++ file_name = "@TERMUX_PREFIX@/bin/env"; ++ } ++ + // According to `man 2 execve`: + // + // The kernel imposes a maximum length on the text