Skip to content

Commit

Permalink
enable split-output builds for all haskellPackages
Browse files Browse the repository at this point in the history
  • Loading branch information
cleverca22 authored and peti committed Jul 27, 2017
1 parent b602082 commit be63b19
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pkgs/development/haskell-modules/configuration-common.nix
Expand Up @@ -728,7 +728,7 @@ self: super: {
};
in overrideCabal super.servant (old: {
postInstall = old.postInstall or "" + ''
ln -s ${docs} $out/share/doc/servant
ln -s ${docs} $doc/share/doc/servant

This comment has been minimized.

Copy link
@nh2

nh2 May 12, 2019

Contributor

Breaks on enableSeparateDocOutput = false; tentative fix at:

nh2@08530f2

'';
});

Expand Down
19 changes: 17 additions & 2 deletions pkgs/development/haskell-modules/generic-builder.nix
@@ -1,5 +1,5 @@
{ 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

{ pname
Expand Down Expand Up @@ -53,6 +53,8 @@
, coreSetup ? false # Use only core packages to build Setup.hs.
, useCpphs ? false
, hardeningDisable ? lib.optional (ghc.isHaLVM or false) "all"
, enableSeparateDataOutput ? false
, enableSeparateDocOutput ? doHaddock
} @ args:

assert editedCabalFile != null -> revision != null;
Expand Down Expand Up @@ -108,6 +110,8 @@ let

defaultConfigureFlags = [
"--verbose" "--prefix=$out" "--libdir=\\$prefix/lib/\\$compiler" "--libsubdir=\\$pkgid"
(optionalString enableSeparateDataOutput "--datadir=$data/share/${ghc.name}")

This comment has been minimized.

Copy link
@dudebout

dudebout Aug 7, 2017

Contributor

@cleverca22 what is the purpose of ${ghc.name} here?

(optionalString enableSeparateDocOutput "--docdir=$doc/share/doc")
"--with-gcc=$CC" # Clang won't work without that extra information.
"--package-db=$packageConfDir"
(optionalString (enableSharedExecutables && stdenv.isLinux) "--ghc-option=-optl=-Wl,-rpath=$out/lib/${ghc.name}/${pname}-${version}")
Expand Down Expand Up @@ -144,7 +148,7 @@ let
allPkgconfigDepends = pkgconfigDepends ++ libraryPkgconfigDepends ++ executablePkgconfigDepends ++
optionals doCheck testPkgconfigDepends ++ optionals withBenchmarkDepends benchmarkPkgconfigDepends;

nativeBuildInputs = buildTools ++ libraryToolDepends ++ executableToolDepends;
nativeBuildInputs = buildTools ++ libraryToolDepends ++ executableToolDepends ++ [ removeReferencesTo ];
propagatedBuildInputs = buildDepends ++ libraryHaskellDepends ++ executableHaskellDepends;
otherBuildInputs = setupHaskellDepends ++ extraLibraries ++ librarySystemDepends ++ executableSystemDepends ++
optionals (allPkgconfigDepends != []) ([pkgconfig] ++ allPkgconfigDepends) ++
Expand Down Expand Up @@ -173,6 +177,9 @@ assert allPkgconfigDepends != [] -> pkgconfig != null;
stdenv.mkDerivation ({
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;

prePhases = ["setupCompilerEnvironmentPhase"];
Expand Down Expand Up @@ -323,6 +330,14 @@ stdenv.mkDerivation ({
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
'';

Expand Down
2 changes: 2 additions & 0 deletions pkgs/development/haskell-modules/lib.nix
Expand Up @@ -111,4 +111,6 @@ rec {
overrideSrc = drv: { src, version ? drv.version }:
overrideCabal drv (_: { inherit src version; editedCabalFile = null; });

hasNoDataOutput = drv: overrideCabal drv (drv: { hasDataDir = false; });
hasNoDocOutput = drv: overrideCabal drv (drv: { hasDocDir = false; });
}

0 comments on commit be63b19

Please sign in to comment.