perl: fix cross compiling (#348666)

This commit is contained in:
Tristan Ross 2024-10-14 21:41:51 -07:00 committed by GitHub
commit 59b63e5e98
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -106,12 +106,11 @@ stdenv.mkDerivation (rec {
"-Dman1dir=${placeholder "out"}/share/man/man1"
"-Dman3dir=${placeholder "out"}/share/man/man3"
] ++
(if stdenv.hostPlatform.isStatic
(if (stdenv.cc.targetPrefix != "")
then [
"-Dcc=${stdenv.cc.targetPrefix}cc"
"-Dnm=${stdenv.cc.targetPrefix}nm"
"-Dar=${stdenv.cc.targetPrefix}ar"
"-Uusedl"
]
else [
"-Dcc=cc"
@ -123,6 +122,7 @@ stdenv.mkDerivation (rec {
"-Dlocincpth=${libcInc}/include"
"-Dloclibpth=${libcLib}/lib"
]
++ lib.optional stdenv.hostPlatform.isStatic "-Uusedl"
++ lib.optionals ((builtins.match ''5\.[0-9]*[13579]\..+'' version) != null) [ "-Dusedevel" "-Uversiononly" ]
++ lib.optional stdenv.hostPlatform.isSunOS "-Dcc=gcc"
++ lib.optional enableThreading "-Dusethreads"
@ -135,7 +135,8 @@ stdenv.mkDerivation (rec {
configureScript = lib.optionalString (!crossCompiling) "${stdenv.shell} ./Configure";
postConfigure = lib.optionalString stdenv.hostPlatform.isStatic ''
# !canExecute cross uses miniperl which doesn't have this
postConfigure = lib.optionalString (!crossCompiling && stdenv.cc.targetPrefix != "") ''
substituteInPlace Makefile \
--replace-fail "AR = ar" "AR = ${stdenv.cc.targetPrefix}ar"
'';