haskell generic-builder: Always use separate pkg db for custom setup
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.
This commit is contained in:
parent
5e5bdfa6ad
commit
f8ec07e836
|
@ -166,14 +166,8 @@ let
|
||||||
"--configure-option=--host=${hostPlatform.config}"
|
"--configure-option=--host=${hostPlatform.config}"
|
||||||
] ++ crossCabalFlags);
|
] ++ crossCabalFlags);
|
||||||
|
|
||||||
useSeparateSetupDb = setupHaskellDepends != [] || isCross || isGhcjs;
|
|
||||||
|
|
||||||
setupCompileFlags = [
|
setupCompileFlags = [
|
||||||
(optionalString (!coreSetup) "-${nativePackageDbFlag}=${
|
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$setupPackageConfDir")
|
||||||
if useSeparateSetupDb
|
|
||||||
then "$setupPackageConfDir"
|
|
||||||
else "$packageConfDir"
|
|
||||||
}")
|
|
||||||
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
(optionalString (isGhcjs || isHaLVM || versionOlder "7.8" ghc.version) "-j$NIX_BUILD_CORES")
|
||||||
# https://github.com/haskell/cabal/issues/2398
|
# https://github.com/haskell/cabal/issues/2398
|
||||||
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
(optionalString (versionOlder "7.10" ghc.version && !isHaLVM) "-threaded")
|
||||||
|
@ -270,10 +264,8 @@ stdenv.mkDerivation ({
|
||||||
echo "Build with ${ghc}."
|
echo "Build with ${ghc}."
|
||||||
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
|
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
|
||||||
|
|
||||||
'' + (optionalString useSeparateSetupDb ''
|
|
||||||
setupPackageConfDir="$TMPDIR/setup-package.conf.d"
|
setupPackageConfDir="$TMPDIR/setup-package.conf.d"
|
||||||
mkdir -p $setupPackageConfDir
|
mkdir -p $setupPackageConfDir
|
||||||
'') + ''
|
|
||||||
packageConfDir="$TMPDIR/package.conf.d"
|
packageConfDir="$TMPDIR/package.conf.d"
|
||||||
mkdir -p $packageConfDir
|
mkdir -p $packageConfDir
|
||||||
|
|
||||||
|
@ -284,14 +276,13 @@ stdenv.mkDerivation ({
|
||||||
# dependencies for the build machine.
|
# dependencies for the build machine.
|
||||||
#
|
#
|
||||||
# pkgs* arrays defined in stdenv/setup.hs
|
# pkgs* arrays defined in stdenv/setup.hs
|
||||||
+ (optionalString useSeparateSetupDb ''
|
+ ''
|
||||||
for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
|
for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
|
||||||
${buildPkgDb nativeGhc.name "$setupPackageConfDir"}
|
${buildPkgDb nativeGhc.name "$setupPackageConfDir"}
|
||||||
done
|
done
|
||||||
${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
|
${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
|
||||||
'')
|
''
|
||||||
|
# For normal components
|
||||||
# For normal components
|
|
||||||
+ ''
|
+ ''
|
||||||
for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
|
for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
|
||||||
${buildPkgDb ghc.name "$packageConfDir"}
|
${buildPkgDb ghc.name "$packageConfDir"}
|
||||||
|
|
Loading…
Reference in New Issue