[ADD] gcc: make libgccjit optional, strip the remaining lib32 work
Arch configures and compiles the whole gcc tree a SECOND time just for
libgccjit, because it needs --enable-host-shared and applying that to
the main compiler would slow it down. That pass is about half of gcc's
build time -- twenty minutes per attempt on this hardware -- and
nothing in the bootstrap or in ERPLibre uses it.
It is now skipped by default and restored with:
EL_GCC_JIT=1 bash scripts/build-stage1.sh
Verified both ways: off leaves zero libgccjit references in the
PKGBUILD, on leaves the ten upstream ones untouched, including the
--enable-languages=jit line the main-build sed deliberately avoids.
package_gcc() still manipulated the 32-bit tree in several places, and
each fails once multilib is off because usr/lib32 never exists:
'usr/lib/gcc/s390x-ibm-linux-gnu/16/libatomic.so' -> '../../../libatomic.so'
ln: No such file or directory
The link named in that error is the one that SUCCEEDED; the failure is
the usr/lib32 line right after it in the same loop. Read alone, it
sends you hunting for a missing libatomic that is in fact present. The
same loop also linked the D runtimes, gone with the D front end.
--- FR ---
Arch configure et compile l arbre gcc entier une SECONDE fois pour le
seul libgccjit, qui reclame --enable-host-shared -- appliquer cette
option au compilateur principal le ralentirait. Cette passe represente
environ la moitie du temps de compilation de gcc, soit vingt minutes
par tentative sur cette machine, et rien dans l amorcage ni dans
ERPLibre ne s en sert.
Elle est desormais ecartee par defaut et se retablit par :
EL_GCC_JIT=1 bash scripts/build-stage1.sh
Verifie dans les deux sens : desactive, il ne reste aucune reference a
libgccjit dans le PKGBUILD ; active, les dix references amont restent
intactes, y compris la ligne --enable-languages=jit que le sed du
build principal evite deliberement.
package_gcc() manipulait encore l arbre 32 bits en plusieurs endroits,
et chacun echoue une fois le multilib retire, puisque usr/lib32
n existe jamais :
'usr/lib/gcc/s390x-ibm-linux-gnu/16/libatomic.so' -> '../../../libatomic.so'
ln: No such file or directory
Le lien nomme dans cette erreur est celui qui a REUSSI ; l echec est la
ligne usr/lib32 juste apres, dans la meme boucle. Lue seule, elle fait
chercher un libatomic manquant qui est pourtant bien la. La meme boucle
liait aussi les runtimes D, partis avec le frontal D.
Assisted-by: Claude Opus 5
This commit is contained in:
parent
63be2a7990
commit
6eb83c91c3
1 changed files with 66 additions and 0 deletions
|
|
@ -75,6 +75,30 @@ sed -i '/^\s*lib32-gcc-libs\s*$/d' PKGBUILD
|
|||
sed -i '/_pick lib32-gcc-libs/d' PKGBUILD
|
||||
sed -i '/lib32-gcc-libs: for generating code/d' PKGBUILD
|
||||
|
||||
# package_gcc() still manipulates the 32-bit tree in several places, and
|
||||
# every one of them fails once multilib is off, because usr/lib32 never
|
||||
# exists:
|
||||
#
|
||||
# 'usr/lib/gcc/s390x-ibm-linux-gnu/16/libatomic.so' -> '../../../libatomic.so'
|
||||
# ln: No such file or directory
|
||||
#
|
||||
# The link that is reported is the one that SUCCEEDED; the failure is the
|
||||
# usr/lib32 line right after it, in the same loop. Reading the error alone
|
||||
# sends you hunting for a missing libatomic that is in fact present.
|
||||
sed -i '/usr\/lib32/d; /_libdir\/32/d' PKGBUILD
|
||||
|
||||
# The same loop links the D runtimes, which do not exist now that the D
|
||||
# front end is off.
|
||||
sed -i 's/^\(\s*for _so in \).*; do$/\1libatomic.so libstdc++.so; do/' PKGBUILD
|
||||
|
||||
if grep -q 'usr/lib32' PKGBUILD; then
|
||||
echo "gcc: usr/lib32 still manipulated" >&2; exit 1
|
||||
fi
|
||||
if grep -qE 'for _so in .*(gdruntime|gphobos)' PKGBUILD; then
|
||||
echo "gcc: D runtimes still in the symlink loop" >&2; exit 1
|
||||
fi
|
||||
grep -m1 'for _so in' PKGBUILD | sed 's/^\s*//'
|
||||
|
||||
# Verify what matters: the array makepkg iterates. Grepping the whole file
|
||||
# for the bare name declared a false failure once already, on libtool and
|
||||
# then here -- the string survives in comments and in unused functions.
|
||||
|
|
@ -82,4 +106,46 @@ if sed -n '/^pkgname=(/,/^)/p' PKGBUILD | grep -q 'lib32'; then
|
|||
echo "gcc: lib32 still in pkgname array" >&2; exit 1
|
||||
fi
|
||||
grep -m1 -- '--enable-languages' PKGBUILD
|
||||
|
||||
# libgccjit: OPTIONAL, and off by default.
|
||||
#
|
||||
# Arch configures and compiles the entire gcc source tree a SECOND time just
|
||||
# for libgccjit -- it needs --enable-host-shared, which would slow the main
|
||||
# compiler down if applied to it. That second pass is roughly half of gcc's
|
||||
# build time, and on this hardware that is twenty minutes per attempt.
|
||||
#
|
||||
# Nothing in the bootstrap needs it, and neither does ERPLibre. It is
|
||||
# skipped by default and re-enabled with:
|
||||
#
|
||||
# EL_GCC_JIT=1 bash scripts/build-stage1.sh
|
||||
#
|
||||
# When enabled, nothing below runs and the PKGBUILD keeps its upstream
|
||||
# behaviour, including the --enable-languages=jit line the main-build sed
|
||||
# deliberately leaves alone.
|
||||
if [ "${EL_GCC_JIT:-0}" != "1" ]; then
|
||||
python3 - <<'PY'
|
||||
import io, re
|
||||
s = io.open("PKGBUILD", encoding="utf-8").read()
|
||||
# The second configure pass, from its comment to the copy of the .so.
|
||||
s = re.sub(
|
||||
r"\n # Build libgccjit separately.*?\n cp -a gcc/libgccjit\.so\* \.\./gcc-build/gcc/\n",
|
||||
"\n", s, flags=re.S)
|
||||
# Its package function, the _pick lines that feed it, and its pkgname entry.
|
||||
s = re.sub(r"\npackage_libgccjit\(\)\s*\{.*?\n\}\n", "\n", s, flags=re.S)
|
||||
s = "\n".join(l for l in s.split("\n")
|
||||
if "_pick libgccjit" not in l
|
||||
and l.strip() != "libgccjit"
|
||||
and "mkdir -p \"$srcdir\"/libgccjit-build" not in l)
|
||||
io.open("PKGBUILD", "w", encoding="utf-8").write(s)
|
||||
PY
|
||||
if grep -q 'libgccjit-build' PKGBUILD; then
|
||||
echo "gcc: libgccjit build block remains" >&2; exit 1
|
||||
fi
|
||||
if sed -n '/^pkgname=(/,/^)/p' PKGBUILD | grep -q 'libgccjit'; then
|
||||
echo "gcc: libgccjit still in pkgname array" >&2; exit 1
|
||||
fi
|
||||
echo "gcc: libgccjit skipped (set EL_GCC_JIT=1 to build it)"
|
||||
else
|
||||
echo "gcc: libgccjit ENABLED (second full build of the tree)"
|
||||
fi
|
||||
echo "gcc: front ends reduced, multilib off, lib32 removed"
|
||||
|
|
|
|||
Loading…
Reference in a new issue