Unverified Commit 59b63e5e authored by Tristan Ross's avatar Tristan Ross Committed by GitHub
Browse files

perl: fix cross compiling (#348666)

parents 7a330d7d 13c8edc1
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -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"
  '';