Skip to content

Commit 59b63e5

Browse files
perl: fix cross compiling (#348666)
2 parents 7a330d7 + 13c8edc commit 59b63e5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

pkgs/development/interpreters/perl/interpreter.nix

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,12 +106,11 @@ stdenv.mkDerivation (rec {
106106
"-Dman1dir=${placeholder "out"}/share/man/man1"
107107
"-Dman3dir=${placeholder "out"}/share/man/man3"
108108
] ++
109-
(if stdenv.hostPlatform.isStatic
109+
(if (stdenv.cc.targetPrefix != "")
110110
then [
111111
"-Dcc=${stdenv.cc.targetPrefix}cc"
112112
"-Dnm=${stdenv.cc.targetPrefix}nm"
113113
"-Dar=${stdenv.cc.targetPrefix}ar"
114-
"-Uusedl"
115114
]
116115
else [
117116
"-Dcc=cc"
@@ -123,6 +122,7 @@ stdenv.mkDerivation (rec {
123122
"-Dlocincpth=${libcInc}/include"
124123
"-Dloclibpth=${libcLib}/lib"
125124
]
125+
++ lib.optional stdenv.hostPlatform.isStatic "-Uusedl"
126126
++ lib.optionals ((builtins.match ''5\.[0-9]*[13579]\..+'' version) != null) [ "-Dusedevel" "-Uversiononly" ]
127127
++ lib.optional stdenv.hostPlatform.isSunOS "-Dcc=gcc"
128128
++ lib.optional enableThreading "-Dusethreads"
@@ -135,7 +135,8 @@ stdenv.mkDerivation (rec {
135135

136136
configureScript = lib.optionalString (!crossCompiling) "${stdenv.shell} ./Configure";
137137

138-
postConfigure = lib.optionalString stdenv.hostPlatform.isStatic ''
138+
# !canExecute cross uses miniperl which doesn't have this
139+
postConfigure = lib.optionalString (!crossCompiling && stdenv.cc.targetPrefix != "") ''
139140
substituteInPlace Makefile \
140141
--replace-fail "AR = ar" "AR = ${stdenv.cc.targetPrefix}ar"
141142
'';

0 commit comments

Comments
 (0)