zig.eclass: prefer source from WORKDIR if it exists

Some dependencies are fetched from Git and can't be in SRC_URI, so we
use a vendor "tarball-tarball".  However, when the tarball-tarball gets
extracted, the resulting deps land in WORKDIR, not DESTDIR, and zig
fetch can't find them.  Try to see if the dep exists in WORKDIR, and use
it if present.

Signed-off-by: sin-ack <sin-ack@protonmail.com>
Part-of: https://github.com/gentoo/gentoo/pull/47039
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
sin-ack
2026-11-10 18:04:14 +00:00
committed by Sam James
parent 9a6c490ea1
commit 0224e75766
+5 -1
View File
@@ -513,7 +513,11 @@ zig_src_unpack() {
touch build.zig || die
for zig_dep in "${zig_deps[@]}"; do
# Hide now-spammy hash from stdout
ezig fetch --save-exact="${zig_dep##-*}" "${DISTDIR}/${zig_dep}" > /dev/null
if [[ -f "${WORKDIR}/${zig_dep}" ]]; then
ezig fetch --save-exact="${zig_dep##-*}" "${WORKDIR}/${zig_dep}" > /dev/null
else
ezig fetch --save-exact="${zig_dep##-*}" "${DISTDIR}/${zig_dep}" > /dev/null
fi
done
# For 0.17 and later: