Skip to content

Commit

Permalink
haskell generic-builder: Always use separate pkg db for custom setup
Browse files Browse the repository at this point in the history
This decreases complexity and ensures setup dependencies are properly
specified with `setup-depends` as they should be. Testing will say if
this is a reasonable change.
  • Loading branch information
Ericson2314 committed Jun 18, 2018
1 parent 5e5bdfa commit f8ec07e
Showing 1 changed file with 4 additions and 13 deletions.
17 changes: 4 additions & 13 deletions pkgs/development/haskell-modules/generic-builder.nix
Original file line number Diff line number Diff line change
Expand Up @@ -166,14 +166,8 @@ let
"--configure-option=--host=${hostPlatform.config}"
] ++ crossCabalFlags);

useSeparateSetupDb = setupHaskellDepends != [] || isCross || isGhcjs;

setupCompileFlags = [
(optionalString (!coreSetup) "-${nativePackageDbFlag}=${
if useSeparateSetupDb
then "$setupPackageConfDir"
else "$packageConfDir"
}")
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$setupPackageConfDir")
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
# https://github.com/haskell/cabal/issues/2398
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
Expand Down Expand Up @@ -270,10 +264,8 @@ stdenv.mkDerivation ({
echo "Build with ${ghc}."
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
'' + (optionalString useSeparateSetupDb ''
setupPackageConfDir="$TMPDIR/setup-package.conf.d"
mkdir -p $setupPackageConfDir
'') + ''
packageConfDir="$TMPDIR/package.conf.d"
mkdir -p $packageConfDir
Expand All @@ -284,14 +276,13 @@ stdenv.mkDerivation ({
# dependencies for the build machine.
#
# pkgs* arrays defined in stdenv/setup.hs
+ (optionalString useSeparateSetupDb ''
+ ''
for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
${buildPkgDb nativeGhc.name "$setupPackageConfDir"}
done
${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
'')

# For normal components
''
# For normal components
+ ''
for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
${buildPkgDb ghc.name "$packageConfDir"}
Expand Down

0 comments on commit f8ec07e

Please sign in to comment.