From ebc09349421eafa136a3cb4f0d4e25ed4b7c4f96 Mon Sep 17 00:00:00 2001 From: Komo Date: Tue, 3 Dec 2024 04:12:01 +0800 Subject: [PATCH] fix(main/zig): fix warning missing ABI and dynamic linker Closes #20294 Zig uses FHS-type path to guess the ABI and dynamic linker of `env` binary. That leads to a warning like in #20294 --- packages/zig/build.sh | 1 + packages/zig/lib-std-zig-system.zig.patch | 15 +++++++++++++++ 2 files changed, 16 insertions(+) create mode 100644 packages/zig/lib-std-zig-system.zig.patch diff --git a/packages/zig/build.sh b/packages/zig/build.sh index 488d86ad1453105..a922cb1ea060d49 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-system.zig.patch b/packages/zig/lib-std-zig-system.zig.patch new file mode 100644 index 000000000000000..764e10b2a0bd109 --- /dev/null +++ b/packages/zig/lib-std-zig-system.zig.patch @@ -0,0 +1,15 @@ +diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig +index 83c798c34..8eebdb857 100644 +--- a/zig/lib/std/zig/system.zig ++++ b/zig/lib/std/zig/system.zig +@@ -988,7 +988,9 @@ fn detectAbiAndDynamicLinker( + // if it finds one, then instead of using /usr/bin/env as the ELF file to examine, it uses the file it references instead, + // doing the same logic recursively in case it finds another shebang line. + +- var file_name: []const u8 = switch (os.tag) { ++ var file_name: []const u8 = if (os.tag.isAndroid()) ++ "@TERMUX_PREFIX@/bin/env" ++ else switch (os.tag) { + // Since /usr/bin/env is hard-coded into the shebang line of many portable scripts, it's a + // reasonably reliable path to start with. + else => "/usr/bin/env",