From f87502622adddd926ca1643030d439b7304ade48 Mon Sep 17 00:00:00 2001 From: Mathieu Benoit Date: Sat, 15 Aug 2026 21:01:18 -0400 Subject: [PATCH] [ADD] port patches: gcc front ends, binutils gold, libtool multilib Three more upstream PKGBUILDs assume x86_64, each in a different way, and each is dropped rather than repaired because the thing being dropped is architecture-specific by nature. gcc: Ada and D are written in themselves and need an existing compiler of the same language. Ubuntu ships gnat, but not one GCC 15 accepts, and there is no D bootstrap compiler here at all. Modula-2 and COBOL have the same shape. Front ends reduced to c, c++, fortran, lto, objc and obj-c++, which is everything this port and ERPLibre compile. binutils: gold is x86-centric, deprecated upstream since 2.44, and built by no distribution that ships s390x. ld.bfd is the linker on Z. binutils builds once gold is disabled -- measured. libtool: the lib32-libltdl split package is i686-on-x86_64 multilib. Its build step is already guarded by CARCH, but prepare() copies the tree to src/libtool32 unconditionally and the package function then packages a tree nobody built. Two host-layout bridges were also needed. Ubuntu multiarch puts asm/, bits/, gnu/ and sys/sdt.h under /usr/include/s390x-linux-gnu, while glibc builds with -nostdinc and expects the classic layout: fatal error: asm/errno.h: No such file or directory fatal error: sys/sdt.h: No such file or directory Symlinks make the host look like Arch for those paths. sys/ needed the files linked, not the directory, since /usr/include/sys already exists. --- FR --- Trois PKGBUILD amont de plus supposent x86_64, chacun a sa maniere, et chacun est retire plutot que repare : ce qu on retire est par nature propre a une architecture. gcc : Ada et D sont ecrits en eux-memes et reclament un compilateur existant du meme langage. Ubuntu livre gnat, mais pas une version que GCC 15 accepte, et il n y a ici aucun compilateur D d amorcage. Modula-2 et COBOL posent le meme probleme. Les frontaux se reduisent a c, c++, fortran, lto, objc et obj-c++, ce qui couvre tout ce que ce portage et ERPLibre compilent. binutils : gold est centre sur x86, abandonne en amont depuis 2.44, et construit par aucune distribution livrant s390x. Sur Z, l editeur de liens est ld.bfd. binutils se construit des que gold est desactive -- mesure. libtool : le paquet scinde lib32-libltdl est du multilib i686 sur x86_64. Son etape de compilation est deja gardee par CARCH, mais prepare() copie l arbre vers src/libtool32 sans condition, et la fonction de paquet empaquette ensuite un arbre que personne n a bati. Deux ponts de disposition d hote etaient aussi necessaires. Le multiarch d Ubuntu place asm/, bits/, gnu/ et sys/sdt.h sous /usr/include/s390x-linux-gnu, quand glibc compile avec -nostdinc et attend la disposition classique : fatal error: asm/errno.h: No such file or directory fatal error: sys/sdt.h: No such file or directory Des liens symboliques donnent a l hote l allure d Arch pour ces chemins. Pour sys/ il faut lier les fichiers et non le repertoire, puisque /usr/include/sys existe deja. Assisted-by: Claude Opus 5 --- patches/pkgbuild/binutils.sh | 16 ++++++++++++++++ patches/pkgbuild/gcc.sh | 24 ++++++++++++++++++++++++ patches/pkgbuild/libtool.sh | 30 ++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+) create mode 100755 patches/pkgbuild/binutils.sh create mode 100755 patches/pkgbuild/gcc.sh create mode 100755 patches/pkgbuild/libtool.sh diff --git a/patches/pkgbuild/binutils.sh b/patches/pkgbuild/binutils.sh new file mode 100755 index 0000000..2e535c6 --- /dev/null +++ b/patches/pkgbuild/binutils.sh @@ -0,0 +1,16 @@ +#!/usr/bin/env bash +# binutils: drop the gold linker. +# +# make[1]: *** [Makefile:6798: all-gold] Error 2 +# +# gold is x86-centric, deprecated upstream since binutils 2.44, and it is not +# built for s390x by any distribution that ships this architecture. Nothing +# links with it here: ld.bfd is the linker on Z. +# +# Dropped rather than debugged, because fixing gold for s390x would be work +# spent on a component upstream is removing. +set -euo pipefail +sed -i 's/--enable-gold[^ \\]*//' PKGBUILD +sed -i 's/^\(\s*\)--enable-gold.*$/\1--disable-gold \\/' PKGBUILD +grep -q -- '--enable-gold' PKGBUILD && { echo "binutils: gold still enabled" >&2; exit 1; } +echo "binutils: gold linker disabled (deprecated upstream, absent on s390x)" diff --git a/patches/pkgbuild/gcc.sh b/patches/pkgbuild/gcc.sh new file mode 100755 index 0000000..d5e4dc2 --- /dev/null +++ b/patches/pkgbuild/gcc.sh @@ -0,0 +1,24 @@ +#!/usr/bin/env bash +# gcc: keep only the front ends that bootstrap without an existing compiler +# of the same language. +# +# configure: error: GNAT is required to build ada +# configure: error: GDC is required to build d +# +# Ada and D are written in themselves: building their front ends needs an +# existing Ada or D compiler of a compatible vintage. Ubuntu ships gnat, but +# not one GCC 15 accepts, and D has no bootstrap compiler here at all. +# Modula-2 and COBOL have the same shape of problem. +# +# Nothing in a core bootstrap -- and nothing in ERPLibre -- is written in any +# of them. C, C++, Fortran, LTO and the Objective-C front ends cover +# everything the rest of this port compiles. +# +# STAGE 1 CONCESSION, not a permanent one. Once the port is self-hosting its +# own gcc can bootstrap the others, and this hook should be revisited. +set -euo pipefail +sed -i 's/^\(\s*--enable-languages=\).*\\$/\1c,c++,fortran,lto,objc,obj-c++ \\/' PKGBUILD +grep -m1 -- '--enable-languages' PKGBUILD +grep -qE 'enable-languages=[^ ]*(ada|,d,|m2|cobol)' PKGBUILD && { + echo "gcc: a self-hosted front end is still enabled" >&2; exit 1; } +echo "gcc: front ends reduced to those that bootstrap from C" diff --git a/patches/pkgbuild/libtool.sh b/patches/pkgbuild/libtool.sh new file mode 100755 index 0000000..2b02572 --- /dev/null +++ b/patches/pkgbuild/libtool.sh @@ -0,0 +1,30 @@ +#!/usr/bin/env bash +# libtool: drop the 32-bit multilib split package. +# +# Arch builds libtool as (libtool lib32-libltdl). The build() step that +# compiles the 32-bit half is already guarded by [[ $CARCH = x86_64 ]] and +# never runs here -- but prepare() copies the source tree to src/libtool32 +# UNCONDITIONALLY, and package_lib32-libltdl() then packages a tree that was +# never built: +# +# cp: cannot create regular file '.../src/libtool32/libtool/.git...' +# +# lib32 is i686-on-x86_64 multilib. It has no meaning on s390x, where no +# 32-bit userspace is shipped and lib32-glibc does not exist. Removed rather +# than repaired: the artefact itself is architecture-specific. +set -euo pipefail +sed -i 's/^pkgname=(libtool lib32-libltdl)$/pkgname=(libtool)/' PKGBUILD +sed -i '/lib32-gcc-libs/d; /lib32-glibc/d; /libtool32/d' PKGBUILD +python3 - <<'PY' +import io, re +s = io.open("PKGBUILD", encoding="utf-8").read() +s = re.sub(r"\npackage_lib32-libltdl\(\)\s*\{.*?\n\}\n", "\n", s, flags=re.S) +io.open("PKGBUILD", "w", encoding="utf-8").write(s) +PY +# Verify what actually matters. "lib32" also appears in a harmless +# lt_cv_sys_lib_dlsearch_path_spec string and in the CARCH-guarded block; +# grepping for the bare word declared a false failure. +grep -q '^pkgname=(libtool)$' PKGBUILD || { echo "libtool: pkgname not reduced" >&2; exit 1; } +grep -q 'package_lib32-libltdl' PKGBUILD && { echo "libtool: lib32 package function remains" >&2; exit 1; } +grep -q 'libtool32' PKGBUILD && { echo "libtool: libtool32 tree still referenced" >&2; exit 1; } +echo "libtool: lib32 split package removed (x86-only multilib)"