enable split-output builds for all haskellPackages

This commit is contained in:
michael bishop 2017-07-24 22:22:19 -03:00 committed by Peter Simons
parent b602082e07
commit be63b1994d
3 changed files with 20 additions and 3 deletions

View File

@ -728,7 +728,7 @@ self: super: {
}; };
in overrideCabal super.servant (old: { in overrideCabal super.servant (old: {
postInstall = old.postInstall or "" + '' postInstall = old.postInstall or "" + ''
ln -s ${docs} $out/share/doc/servant ln -s ${docs} $doc/share/doc/servant
''; '';
}); });

View File

@ -1,5 +1,5 @@
{ stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused { stdenv, fetchurl, ghc, pkgconfig, glibcLocales, coreutils, gnugrep, gnused
, jailbreak-cabal, hscolour, cpphs, nodejs, lib , jailbreak-cabal, hscolour, cpphs, nodejs, lib, removeReferencesTo
}: let isCross = (ghc.cross or null) != null; in }: let isCross = (ghc.cross or null) != null; in
{ pname { pname
@ -53,6 +53,8 @@
, coreSetup ? false # Use only core packages to build Setup.hs. , coreSetup ? false # Use only core packages to build Setup.hs.
, useCpphs ? false , useCpphs ? false
, hardeningDisable ? lib.optional (ghc.isHaLVM or false) "all" , hardeningDisable ? lib.optional (ghc.isHaLVM or false) "all"
, enableSeparateDataOutput ? false
, enableSeparateDocOutput ? doHaddock
} @ args: } @ args:
assert editedCabalFile != null -> revision != null; assert editedCabalFile != null -> revision != null;
@ -108,6 +110,8 @@ let
defaultConfigureFlags = [ defaultConfigureFlags = [
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid" "--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
(optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")
(optionalString enableSeparateDocOutput "--docdir=$doc/share/doc")
"--with-gcc=$CC" # Clang won't work without that extra information. "--with-gcc=$CC" # Clang won't work without that extra information.
"--package-db=$packageConfDir" "--package-db=$packageConfDir"
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}") (optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
@ -144,7 +148,7 @@ let
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++ allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
optionals doCheck testPkgconfigDepends ++ optionals withBenchmarkDepends benchmarkPkgconfigDepends; optionals doCheck testPkgconfigDepends ++ optionals withBenchmarkDepends benchmarkPkgconfigDepends;
nativeBuildInputs = buildTools ++ libraryToolDepends ++ executableToolDepends; nativeBuildInputs = buildTools ++ libraryToolDepends ++ executableToolDepends ++ [ removeReferencesTo ];
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends; propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++ otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++ optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++
@ -173,6 +177,9 @@ assert allPkgconfigDepends != [] -> pkgconfig != null;
stdenv.mkDerivation ({ stdenv.mkDerivation ({
name = "${pname}-${version}"; name = "${pname}-${version}";
outputs = if (args ? outputs) then args.outputs else ([ "out" ] ++ (optional enableSeparateDataOutput "data") ++ (optional enableSeparateDocOutput "doc"));
setOutputFlags = false;
pos = builtins.unsafeGetAttrPos "pname" args; pos = builtins.unsafeGetAttrPos "pname" args;
prePhases = ["setupCompilerEnvironmentPhase"]; prePhases = ["setupCompilerEnvironmentPhase"];
@ -323,6 +330,14 @@ stdenv.mkDerivation ({
done done
''} ''}
${optionalString enableSeparateDocOutput ''
for x in $doc/share/doc/html/src/*.html; do
remove-references-to -t $out $x
done
mkdir -p $doc
''}
${optionalString enableSeparateDataOutput "mkdir -p $data"}
runHook postInstall runHook postInstall
''; '';

View File

@ -111,4 +111,6 @@ rec {
overrideSrc = drv: { src, version ? drv.version }: overrideSrc = drv: { src, version ? drv.version }:
overrideCabal drv (_: { inherit src version; editedCabalFile = null; }); overrideCabal drv (_: { inherit src version; editedCabalFile = null; });
hasNoDataOutput = drv: overrideCabal drv (drv: { hasDataDir = false; });
hasNoDocOutput = drv: overrideCabal drv (drv: { hasDocDir = false; });
} }