generic-builder: use buildInputs for Haskell dependencies

This actually will matter when I (soon) land cross-compilation support,
and native deps are compiled for the build, instead of host, platform.
But even now, it's good style do this, and one less thing to review
later.

The use of `$nativePkgs` is unfortunate, as it will need to be
swapped out for `$crossPkgs` for build != host builds. This will just a
temporarily cause pain, however, as eventually I will change stdenv to
use a `$runPkgs` (or moral equivalent) in both case.

Closes https://github.com/NixOS/nixpkgs/pull/26480.
This commit is contained in:
John Ericson 2017-06-08 10:55:11 -04:00 committed by Peter Simons
parent 7bcfdc1c11
commit 8a8f0408cd

View File

@ -144,9 +144,9 @@ let
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++ allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
optionals doCheck testPkgconfigDepends ++ optionals withBenchmarkDepends benchmarkPkgconfigDepends; optionals doCheck testPkgconfigDepends ++ optionals withBenchmarkDepends benchmarkPkgconfigDepends;
nativeBuildInputs = setupHaskellDepends ++ buildTools ++ libraryToolDepends ++ executableToolDepends;
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends; propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ setupHaskellDepends ++ otherBuildInputs = extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
buildTools ++ libraryToolDepends ++ executableToolDepends ++
optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++ optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++
optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++ optionals doCheck (testDepends ++ testHaskellDepends ++ testSystemDepends ++ testToolDepends) ++
# ghcjs's hsc2hs calls out to the native hsc2hs # ghcjs's hsc2hs calls out to the native hsc2hs
@ -181,8 +181,9 @@ stdenv.mkDerivation ({
inherit src; inherit src;
nativeBuildInputs = otherBuildInputs ++ optionals (!hasActiveLibrary) propagatedBuildInputs; inherit nativeBuildInputs;
propagatedNativeBuildInputs = optionals hasActiveLibrary propagatedBuildInputs; buildInputs = otherBuildInputs ++ optionals (!hasActiveLibrary) propagatedBuildInputs;
propagatedBuildInputs = optionals hasActiveLibrary propagatedBuildInputs;
LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase. LANG = "en_US.UTF-8"; # GHC needs the locale configured during the Haddock phase.
@ -209,11 +210,8 @@ stdenv.mkDerivation ({
setupCompileFlags="${concatStringsSep " " setupCompileFlags}" setupCompileFlags="${concatStringsSep " " setupCompileFlags}"
configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags" configureFlags="${concatStringsSep " " defaultConfigureFlags} $configureFlags"
local inputClosure="" # nativePkgs defined in stdenv/setup.hs
for i in $propagatedNativeBuildInputs $nativeBuildInputs; do for p in $nativePkgs; do
findInputs $i inputClosure propagated-native-build-inputs
done
for p in $inputClosure; do
if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then if [ -d "$p/lib/${ghc.name}/package.conf.d" ]; then
cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/ cp -f "$p/lib/${ghc.name}/package.conf.d/"*.conf $packageConfDir/
continue continue