From f5c3b6523cab9861a343b1f49081205d799695c6 Mon Sep 17 00:00:00 2001 From: sternenseemann Date: Thu, 25 Nov 2021 13:58:06 +0100 Subject: [PATCH] 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. --- pkgs/development/compilers/ghc/8.10.7.nix | 9 ++++++--- pkgs/development/compilers/ghc/8.8.4.nix | 9 ++++++--- pkgs/development/compilers/ghc/9.0.1.nix | 9 ++++++--- pkgs/development/compilers/ghc/9.2.1.nix | 9 ++++++--- pkgs/development/compilers/ghc/head.nix | 9 ++++++--- 5 files changed, 30 insertions(+), 15 deletions(-) diff --git a/pkgs/development/compilers/ghc/8.10.7.nix b/pkgs/development/compilers/ghc/8.10.7.nix index 9cf459f45167..f2f1bfc64e14 100644 --- a/pkgs/development/compilers/ghc/8.10.7.nix +++ b/pkgs/development/compilers/ghc/8.10.7.nix @@ -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); diff --git a/pkgs/development/compilers/ghc/8.8.4.nix b/pkgs/development/compilers/ghc/8.8.4.nix index 069657808a35..44d8d33fecc4 100644 --- a/pkgs/development/compilers/ghc/8.8.4.nix +++ b/pkgs/development/compilers/ghc/8.8.4.nix @@ -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); diff --git a/pkgs/development/compilers/ghc/9.0.1.nix b/pkgs/development/compilers/ghc/9.0.1.nix index 3f2ea4dedca5..a778fda31a73 100644 --- a/pkgs/development/compilers/ghc/9.0.1.nix +++ b/pkgs/development/compilers/ghc/9.0.1.nix @@ -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); diff --git a/pkgs/development/compilers/ghc/9.2.1.nix b/pkgs/development/compilers/ghc/9.2.1.nix index d1c69e5c4633..5442a423bdd0 100644 --- a/pkgs/development/compilers/ghc/9.2.1.nix +++ b/pkgs/development/compilers/ghc/9.2.1.nix @@ -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); diff --git a/pkgs/development/compilers/ghc/head.nix b/pkgs/development/compilers/ghc/head.nix index 50bd9527093b..40dbe131f9dd 100644 --- a/pkgs/development/compilers/ghc/head.nix +++ b/pkgs/development/compilers/ghc/head.nix @@ -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);