From 13c8edc10a06a8002035a0fcd5b33c5643ba0f89 Mon Sep 17 00:00:00 2001 From: Tristan Ross Date: Mon, 14 Oct 2024 20:10:38 -0700 Subject: [PATCH] perl: fix cross compiling --- pkgs/development/interpreters/perl/interpreter.nix | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pkgs/development/interpreters/perl/interpreter.nix b/pkgs/development/interpreters/perl/interpreter.nix index f04b352388ec..b10ba2b1f283 100644 --- a/pkgs/development/interpreters/perl/interpreter.nix +++ b/pkgs/development/interpreters/perl/interpreter.nix @@ -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" '';