dev-lang/zig: fix building 0.13.0 with sys-devel/llvm-18.1.8-r6

Also, while we are here, sync `.maxrss` fix from 9999 ebuild .
Patch message:

This is backported PR https://www.github.com/ziglang/zig/pull/21862 ,
squashed and trimmed down for Zig 0.13.0 . Fixes following error when
compiling with sys-devel/llvm-18.1.8-r6:
```
/var/tmp/portage/dev-lang/zig-0.13.0/work/zig-0.13.0/src/zig_llvm.cpp:738:68: error: static assertion failed
  738 | static_assert((Triple::EnvironmentType)ZigLLVM_LastEnvironmentType == Triple::LastEnvironmentType, "");
```

Chronology as I understood it:
 * New enum tags were added for `Triple::EnvironmentType` to 20.x in
   https://www.github.com/llvm/llvm-project/pull/111302 ,
 * These additions were backported to 19.1.3 in
   https://www.github.com/llvm/llvm-project/pull/112364 , at this point
   Zig upstream (9999) notices static assert failure and fixes in
   https://www.github.com/ziglang/zig/pull/21862 .
   Discussed here:
   https://www.github.com/llvm/llvm-project/pull/112364#discussion_r1823206017 .
 * These additions were backported again to 18.1.8-r6 (Gentoo only) in
   https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9455b76daa769c03686d18098dbf37690c5c5f61 ,
   this time it causes static assert failure for 0.13.0 .

Closes: https://bugs.gentoo.org/942563
Signed-off-by: Eric Joldasov <bratishkaerik@landless-city.net>
Closes: https://github.com/gentoo/gentoo/pull/39187
Signed-off-by: Sam James <sam@gentoo.org>
This commit is contained in:
Eric Joldasov
2024-11-03 05:08:53 +05:00
committed by Sam James
parent 4777ea448c
commit f4a5c79c89
2 changed files with 15 additions and 0 deletions

View File

@@ -1,2 +1,3 @@
DIST zig-0.13.0-llvm-18.1.8-r6-fix.patch 45968 BLAKE2B a07c47b22b079d324b200fe84af5c89ffe51a1c81f50ca894a80f9f9db51a9d4119ae51c2e4e84a9b4f0111b2b809978b88adca42480ee800693afbd78f47387 SHA512 148b3f4807763dfb6a4d4e201890fa8204deaf73e620a8b592dfa03b997bc16ed01ea26e4d85f242473e91ccc45b1a06af22f786851f8e26cec1ac821b14efdc
DIST zig-0.13.0.tar.xz 17220728 BLAKE2B f4bbacc2012950c556bebc28fc322fc6424bf20fe118e8362373336b6460e514028978584087f6e7f25ed8b8e6991610edce625676a1dd80c1975c5f9ef48775 SHA512 6f5f31f4ba71a11d8b16c7a5a613e124095e503fa6b02d2b77e5b177674c739287e81d98d96dc261fed24bc836caf196f71c3fcc7a6518387df86ba9e03df4dd
DIST zig-0.13.0.tar.xz.minisig 312 BLAKE2B 2d061257c9c75f9c36b01cfb08dcd2040538a125b9ea2cae8617ae5496e685b165933ce8981494419522b7e19b51fc69a651ecaa4a8930753acf2e4ae3d6e00f SHA512 21c6139c06cba6c5e23a3305fed0c0f1b9b32d9140bd686c26365ce0279d5f53cd081894eaba29f0c1ed51b2e831edf7bd4ae6a7eaee5018a252e312e9b65507

View File

@@ -21,6 +21,7 @@ else
SRC_URI="
https://ziglang.org/download/${PV}/${P}.tar.xz
verify-sig? ( https://ziglang.org/download/${PV}/${P}.tar.xz.minisig )
https://codeberg.org/BratishkaErik/distfiles/releases/download/dev-lang%2Fzig-${PV}/${P}-llvm-18.1.8-r6-fix.patch
"
KEYWORDS="~amd64 ~arm ~arm64"
@@ -73,6 +74,7 @@ CHECKREQS_MEMORY="4G"
PATCHES=(
"${FILESDIR}/${P}-test-fmt-no-doc.patch"
"${FILESDIR}/${P}-test-std-kernel-version.patch"
"${DISTDIR}/${P}-llvm-18.1.8-r6-fix.patch"
)
llvm_check_deps() {
@@ -124,6 +126,13 @@ pkg_setup() {
check-reqs_pkg_setup
}
src_unpack() {
if use verify-sig; then
verify-sig_verify_detached "${DISTDIR}"/${P}.tar.xz{,.minisig}
fi
default
}
src_configure() {
# Useful for debugging and a little bit more deterministic.
export ZIG_LOCAL_CACHE_DIR="${T}/zig-local-cache"
@@ -142,6 +151,11 @@ src_configure() {
}
src_compile() {
# Remove "limit memory usage" flags, it's already verified by
# CHECKREQS_MEMORY and causes unneccessary errors. Upstream set them
# according to CI OOM failures, which are higher than during Gentoo build.
sed -i -e '/\.max_rss = .*,/d' build.zig || die
cmake_src_compile
"${BUILD_DIR}/stage3/bin/zig" env || die "Zig compilation failed"