texinfo: fix build references when cross-compiling

The XS modules were being built for the build platform, and the perl scripts
had build platform shebangs.

It is possible to build the XS modules by passing
PERL_EXT_CC=${stdenv.cc.targetPrefix}cc and --enable-perl-xs=yes, but they
fail to load due to a handshake key mismatch. Instead, I just decided to
disable the XS modules and use the pure Perl fallbacks when cross-compiling.

The shebangs were fixed manually using substituteInPlace.
This commit is contained in:
Ben Wolsieffer
2022-06-20 13:51:44 -04:00
parent bf15544726
commit 30bfac6095
+11 -2
View File
@@ -36,8 +36,7 @@ stdenv.mkDerivation {
strictDeps = true;
enableParallelBuilding = true;
# We need a native compiler to build perl XS extensions
# when cross-compiling.
# A native compiler is needed to build tools needed at build time
depsBuildBuild = [ buildPackages.stdenv.cc perl ];
buildInputs = [ xz.bin bash libintl ]
@@ -45,6 +44,9 @@ stdenv.mkDerivation {
++ optional interactive ncurses;
configureFlags = [ "PERL=${buildPackages.perl}/bin/perl" ]
# Perl XS modules are difficult to cross-compile and texinfo has pure Perl
# fallbacks.
++ optional crossBuildTools "--enable-perl-xs=no"
++ lib.optional stdenv.isSunOS "AWK=${gawk}/bin/awk";
installFlags = [ "TEXMF=$(out)/texmf-dist" ];
@@ -62,6 +64,13 @@ stdenv.mkDerivation {
"XFAIL_TESTS=test_scripts/layout_formatting_fr_icons.sh"
];
postFixup = optionalString crossBuildTools ''
for f in "$out"/bin/{pod2texi,texi2any}; do
substituteInPlace "$f" \
--replace ${buildPackages.perl}/bin/perl ${perl}/bin/perl
done
'';
meta = {
homepage = "https://www.gnu.org/software/texinfo/";
description = "The GNU documentation system";