gettext: implement clang 18 on Darwin workaround

This commit is contained in:
Randy Eckenrode
2024-11-20 02:14:49 +00:00
committed by Emily
parent 28f966f9e0
commit 227075c83e
+19 -4
View File
@@ -47,10 +47,25 @@ stdenv.mkDerivation rec {
];
postPatch = ''
substituteAllInPlace gettext-runtime/src/gettext.sh.in
substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd
substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd
substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd
# Older versions of gettext come with a copy of `extern-inline.m4` that is not compatible with clang 18.
# When a project uses gettext + autoreconfPhase, autoreconfPhase will invoke `autopoint -f`, which will
# replace whatever (probably compatible) version of `extern-inline.m4` with one that probalby wont work
# because `autopoint` will copy the autoconf macros from the projects required version of gettext.
# Fixing this requires replacing all the older copies of the problematic file with a new one.
#
# This is ugly, but it avoids requiring workarounds in every package using gettext and autoreconfPhase.
declare -a oldFiles=($(tar tf gettext-tools/misc/archive.dir.tar | grep '^gettext-0\.[19].*/extern-inline.m4'))
oldFilesDir=$(mktemp -d)
for oldFile in "''${oldFiles[@]}"; do
mkdir -p "$oldFilesDir/$(dirname "$oldFile")"
cp gettext-tools/gnulib-m4/extern-inline.m4 "$oldFilesDir/$oldFile"
done
tar uf gettext-tools/misc/archive.dir.tar -C "$oldFilesDir" "''${oldFiles[@]}"
substituteAllInPlace gettext-runtime/src/gettext.sh.in
substituteInPlace gettext-tools/projects/KDE/trigger --replace "/bin/pwd" pwd
substituteInPlace gettext-tools/projects/GNOME/trigger --replace "/bin/pwd" pwd
substituteInPlace gettext-tools/src/project-id --replace "/bin/pwd" pwd
'' + lib.optionalString stdenv.hostPlatform.isCygwin ''
sed -i -e "s/\(cldr_plurals_LDADD = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in
sed -i -e "s/\(libgettextsrc_la_LDFLAGS = \)/\\1..\/gnulib-lib\/libxml_rpl.la /" gettext-tools/src/Makefile.in