diff options
Diffstat (limited to 'pkgs/development/haskell-modules/generic-builder.nix')
-rw-r--r-- | pkgs/development/haskell-modules/generic-builder.nix | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/pkgs/development/haskell-modules/generic-builder.nix b/pkgs/development/haskell-modules/generic-builder.nix index 1cc385864585..52128d3fc5d1 100644 --- a/pkgs/development/haskell-modules/generic-builder.nix +++ b/pkgs/development/haskell-modules/generic-builder.nix @@ -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") @@ -185,7 +179,8 @@ let allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++ optionals doCheck testPkgconfigDepends ++ optionals doBenchmark benchmarkPkgconfigDepends; - nativeBuildInputs = [ ghc nativeGhc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++ + depsBuildBuild = [ nativeGhc ]; + nativeBuildInputs = [ ghc removeReferencesTo ] ++ optional (allPkgconfigDepends != []) pkgconfig ++ setupHaskellDepends ++ buildTools ++ libraryToolDepends ++ executableToolDepends; propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends ++ libraryFrameworkDepends; @@ -216,18 +211,6 @@ let cp -f "$p/lib/${ghcName}/package.conf.d/"*.conf ${packageConfDir}/ continue fi - if [ -d "$p/include" ]; then - configureFlags+=" --extra-include-dirs=$p/include" - fi - if [ -d "$p/lib" ]; then - configureFlags+=" --extra-lib-dirs=$p/lib" - fi - '' - # It is not clear why --extra-framework-dirs does work fine on Linux - + optionalString (!buildPlatform.isDarwin || versionAtLeast nativeGhc.version "8.0") '' - if [[ -d "$p/Library/Frameworks" ]]; then - configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks" - fi ''; in @@ -248,7 +231,7 @@ stdenv.mkDerivation ({ inherit src; - inherit nativeBuildInputs; + inherit depsBuildBuild nativeBuildInputs; buildInputs = otherBuildInputs ++ optionals (!hasActiveLibrary) propagatedBuildInputs; propagatedBuildInputs = optionals hasActiveLibrary propagatedBuildInputs; @@ -270,10 +253,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 @@ -284,17 +265,29 @@ 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"} + if [ -d "$p/include" ]; then + configureFlags+=" --extra-include-dirs=$p/include" + fi + if [ -d "$p/lib" ]; then + configureFlags+=" --extra-lib-dirs=$p/lib" + fi + '' + # It is not clear why --extra-framework-dirs does work fine on Linux + + optionalString (!buildPlatform.isDarwin || versionAtLeast nativeGhc.version "8.0") '' + if [[ -d "$p/Library/Frameworks" ]]; then + configureFlags+=" --extra-framework-dirs=$p/Library/Frameworks" + fi + '' + '' done '' # only use the links hack if we're actually building dylibs. otherwise, the |