haskell.compiler.*: move propagatedBuildInputs into runtimeDeps

This has two main benefits:

* GHC will work reliably outside of stdenv, even when using -fllvm since
  everything it'll call at runtime will be provided in PATH via the
  wrapper scripts.

* LLVM will no longer leak into haskell packages' configure
  scripts. This was an issue with llvm-hs which fails to build if the
  LLVM version of the compiler since the propagatedBuildInputs of GHC
  take precedence over the nativeBuildInputs added in the derivation.
This commit is contained in:
sternenseemann 2021-11-25 13:58:06 +01:00
parent 035f20bc6b
commit f5c3b6523c
5 changed files with 30 additions and 15 deletions

View file

@ -132,9 +132,15 @@ let
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Tools GHC will need to call at runtime. Some of these were handled using
# propagatedBuildInputs before, however this allowed for GHC environment and
# a derivations build environment to interfere, especially when GHC is built.
runtimeDeps = [
targetPackages.stdenv.cc
targetPackages.stdenv.cc.bintools
coreutils # for cat
] ++ lib.optionals useLLVM [
(lib.getBin llvmPackages.llvm)
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -290,9 +296,6 @@ stdenv.mkDerivation (rec {
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
propagatedBuildInputs = [ targetPackages.stdenv.cc ]
++ lib.optional useLLVM llvmPackages.llvm;
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);

View file

@ -140,9 +140,15 @@ let
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Tools GHC will need to call at runtime. Some of these were handled using
# propagatedBuildInputs before, however this allowed for GHC environment and
# a derivations build environment to interfere, especially when GHC is built.
runtimeDeps = [
targetPackages.stdenv.cc
targetPackages.stdenv.cc.bintools
coreutils # for cat
] ++ lib.optionals useLLVM [
(lib.getBin llvmPackages.llvm)
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -293,9 +299,6 @@ stdenv.mkDerivation (rec {
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
propagatedBuildInputs = [ targetPackages.stdenv.cc ]
++ lib.optional useLLVM llvmPackages.llvm;
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);

View file

@ -127,9 +127,15 @@ let
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Tools GHC will need to call at runtime. Some of these were handled using
# propagatedBuildInputs before, however this allowed for GHC environment and
# a derivations build environment to interfere, especially when GHC is built.
runtimeDeps = [
targetPackages.stdenv.cc
targetPackages.stdenv.cc.bintools
coreutils # for cat
] ++ lib.optionals useLLVM [
(lib.getBin llvmPackages.llvm)
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -255,9 +261,6 @@ stdenv.mkDerivation (rec {
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
propagatedBuildInputs = [ targetPackages.stdenv.cc ]
++ lib.optional useLLVM llvmPackages.llvm;
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);

View file

@ -126,9 +126,15 @@ let
# see #84670 and #49071 for more background.
useLdGold = targetPlatform.linker == "gold" || (targetPlatform.linker == "bfd" && !targetPlatform.isMusl);
# Tools GHC will need to call at runtime. Some of these were handled using
# propagatedBuildInputs before, however this allowed for GHC environment and
# a derivations build environment to interfere, especially when GHC is built.
runtimeDeps = [
targetPackages.stdenv.cc
targetPackages.stdenv.cc.bintools
coreutils # for cat
] ++ lib.optionals useLLVM [
(lib.getBin llvmPackages.llvm)
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -258,9 +264,6 @@ stdenv.mkDerivation (rec {
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
propagatedBuildInputs = [ targetPackages.stdenv.cc ]
++ lib.optional useLLVM llvmPackages.llvm;
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);

View file

@ -140,9 +140,15 @@ let
useLdGold = targetPlatform.linker == "gold" ||
(targetPlatform.linker == "bfd" && (targetPackages.stdenv.cc.bintools.bintools.hasGold or false) && !targetPlatform.isMusl);
# Tools GHC will need to call at runtime. Some of these were handled using
# propagatedBuildInputs before, however this allowed for GHC environment and
# a derivations build environment to interfere, especially when GHC is built.
runtimeDeps = [
targetPackages.stdenv.cc
targetPackages.stdenv.cc.bintools
coreutils # for cat
] ++ lib.optionals useLLVM [
(lib.getBin llvmPackages.llvm)
]
# On darwin, we need unwrapped bintools as well (for otool)
++ lib.optionals (stdenv.targetPlatform.linker == "cctools") [
@ -278,9 +284,6 @@ stdenv.mkDerivation (rec {
buildInputs = [ perl bash ] ++ (libDeps hostPlatform);
propagatedBuildInputs = [ targetPackages.stdenv.cc ]
++ lib.optional useLLVM llvmPackages.llvm;
depsTargetTarget = map lib.getDev (libDeps targetPlatform);
depsTargetTargetPropagated = map (lib.getOutput "out") (libDeps targetPlatform);