Update generic-builder.nix

Drop `hasActiveLibrary` altogether. The condition is wrong, `isLibrary` is the correct one. We can have non-static, non-shared libraries as well.
This commit is contained in:
Moritz Angermann 2018-07-27 12:24:22 +08:00 committed by Peter Simons
parent e4a61c8b6e
commit e1d180725b

View File

@ -112,12 +112,10 @@ let
main = defaultMain main = defaultMain
''; '';
hasActiveLibrary = isLibrary && (enableStaticLibraries || enableSharedLibraries || enableLibraryProfiling || hostPlatform.isWindows);
# We cannot enable -j<n> parallelism for libraries because GHC is far more # We cannot enable -j<n> parallelism for libraries because GHC is far more
# likely to generate a non-determistic library ID in that case. Further # likely to generate a non-determistic library ID in that case. Further
# details are at <https://github.com/peti/ghc-library-id-bug>. # details are at <https://github.com/peti/ghc-library-id-bug>.
enableParallelBuilding = (versionOlder "7.8" ghc.version && !hasActiveLibrary) || versionOlder "8.0.1" ghc.version; enableParallelBuilding = (versionOlder "7.8" ghc.version && !isLibrary) || versionOlder "8.0.1" ghc.version;
crossCabalFlags = [ crossCabalFlags = [
"--with-ghc=${ghc.targetPrefix}ghc" "--with-ghc=${ghc.targetPrefix}ghc"
@ -237,8 +235,8 @@ stdenv.mkDerivation ({
inherit src; inherit src;
inherit depsBuildBuild nativeBuildInputs; inherit depsBuildBuild nativeBuildInputs;
buildInputs = otherBuildInputs ++ optionals (!hasActiveLibrary) propagatedBuildInputs; buildInputs = otherBuildInputs ++ optionals (!isLibrary) propagatedBuildInputs;
propagatedBuildInputs = optionals hasActiveLibrary propagatedBuildInputs; propagatedBuildInputs = optionals isLibrary 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.
@ -256,7 +254,7 @@ stdenv.mkDerivation ({
runHook preSetupCompilerEnvironment runHook preSetupCompilerEnvironment
echo "Build with ${ghc}." echo "Build with ${ghc}."
${optionalString (hasActiveLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"} ${optionalString (isLibrary && hyperlinkSource) "export PATH=${hscolour}/bin:$PATH"}
setupPackageConfDir="$TMPDIR/setup-package.conf.d" setupPackageConfDir="$TMPDIR/setup-package.conf.d"
mkdir -p $setupPackageConfDir mkdir -p $setupPackageConfDir
@ -369,10 +367,10 @@ stdenv.mkDerivation ({
haddockPhase = '' haddockPhase = ''
runHook preHaddock runHook preHaddock
${optionalString (doHaddock && hasActiveLibrary) '' ${optionalString (doHaddock && isLibrary) ''
${setupCommand} haddock --html \ ${setupCommand} haddock --html \
${optionalString doHoogle "--hoogle"} \ ${optionalString doHoogle "--hoogle"} \
${optionalString (hasActiveLibrary && hyperlinkSource) "--hyperlink-source"} ${optionalString (isLibrary && hyperlinkSource) "--hyperlink-source"}
''} ''}
runHook postHaddock runHook postHaddock
''; '';
@ -380,7 +378,7 @@ stdenv.mkDerivation ({
installPhase = '' installPhase = ''
runHook preInstall runHook preInstall
${if !hasActiveLibrary then "${setupCommand} install" else '' ${if !isLibrary then "${setupCommand} install" else ''
${setupCommand} copy ${setupCommand} copy
local packageConfDir="$out/lib/${ghc.name}/package.conf.d" local packageConfDir="$out/lib/${ghc.name}/package.conf.d"
local packageConfFile="$packageConfDir/${pname}-${version}.conf" local packageConfFile="$packageConfDir/${pname}-${version}.conf"
@ -431,7 +429,7 @@ stdenv.mkDerivation ({
compiler = ghc; compiler = ghc;
isHaskellLibrary = hasActiveLibrary; isHaskellLibrary = isLibrary;
# TODO: ask why the split outputs are configurable at all? # TODO: ask why the split outputs are configurable at all?
# TODO: include tests for split if possible # TODO: include tests for split if possible