haskell generic-builder: Fix setup depends

I was referring to the wrong package db in a few places. Thanks
@ElvishJerricco for catching.
This commit is contained in:
John Ericson 2018-06-12 13:54:26 -04:00
parent f5b0d6d889
commit eeeaab8d5e

@ -167,7 +167,11 @@ let
] ++ crossCabalFlags);
setupCompileFlags = [
(optionalString (!coreSetup) "-${nativePackageDbFlag}=$packageConfDir")
(optionalString (!coreSetup) "-${nativePackageDbFlag}=${
if setupHaskellDepends != []
then "$setupPackageConfDir"
else "$packageConfDir"
}")
(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")
@ -205,9 +209,9 @@ let
nativeGhcCommand = "${nativeGhc.targetPrefix}ghc";
buildPkgDb = ghcName: ''
buildPkgDb = ghcName: packageConfDir: ''
if [ -d "$p/lib/${ghcName}/package.conf.d" ]; then
cp -f "$p/lib/${ghcName}/package.conf.d/"*.conf $packageConfDir/
cp -f "$p/lib/${ghcName}/package.conf.d/"*.conf ${packageConfDir}/
continue
fi
if [ -d "$p/include" ]; then
@ -280,7 +284,7 @@ stdenv.mkDerivation ({
# pkgs* arrays defined in stdenv/setup.hs
+ (optionalString (setupHaskellDepends != []) ''
for p in "''${pkgsBuildBuild[@]}" "''${pkgsBuildHost[@]}" "''${pkgsBuildTarget[@]}"; do
${buildPkgDb nativeGhc.name}
${buildPkgDb nativeGhc.name "$setupPackageConfDir"}
done
${nativeGhcCommand}-pkg --${nativePackageDbFlag}="$setupPackageConfDir" recache
'')
@ -288,7 +292,7 @@ stdenv.mkDerivation ({
# For normal components
+ ''
for p in "''${pkgsHostHost[@]}" "''${pkgsHostTarget[@]}"; do
${buildPkgDb ghc.name}
${buildPkgDb ghc.name "$packageConfDir"}
done
''
# only use the links hack if we're actually building dylibs. otherwise, the
@ -323,11 +327,7 @@ stdenv.mkDerivation ({
done
echo setupCompileFlags: $setupCompileFlags
${optionalString (setupHaskellDepends != [])
''
echo GHC_PACKAGE_PATH="$setupPackageConfDir:"
GHC_PACKAGE_PATH="$setupPackageConfDir:" ''
}${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
${nativeGhcCommand} $setupCompileFlags --make -o Setup -odir $TMPDIR -hidir $TMPDIR $i
runHook postCompileBuildDriver
'';