summary refs log tree commit diff
path: root/pkgs/build-support/cabal/default.nix
diff options
context:
space:
mode:
authorPeter Simons <simons@cryp.to>2014-06-03 10:50:04 +0200
committerPeter Simons <simons@cryp.to>2014-06-03 10:50:04 +0200
commit7d1c124647febf9f675accfbc511fa0fd61931eb (patch)
tree00a4bb729fb409772f05e33b76805a22a1219521 /pkgs/build-support/cabal/default.nix
parent191dbc234fc3f9bfa7d265f0e9210c311cd7f6d6 (diff)
parent176797576ccbc924323598cc1886b4f8c0ad330f (diff)
downloadnixpkgs-7d1c124647febf9f675accfbc511fa0fd61931eb.tar
nixpkgs-7d1c124647febf9f675accfbc511fa0fd61931eb.tar.gz
nixpkgs-7d1c124647febf9f675accfbc511fa0fd61931eb.tar.bz2
nixpkgs-7d1c124647febf9f675accfbc511fa0fd61931eb.tar.lz
nixpkgs-7d1c124647febf9f675accfbc511fa0fd61931eb.tar.xz
nixpkgs-7d1c124647febf9f675accfbc511fa0fd61931eb.tar.zst
nixpkgs-7d1c124647febf9f675accfbc511fa0fd61931eb.zip
Merge pull request #2767 from jwiegley/hscolour
Build Haddocks with source hyperlinks unless doHscolour is false
Diffstat (limited to 'pkgs/build-support/cabal/default.nix')
-rw-r--r--pkgs/build-support/cabal/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/build-support/cabal/default.nix b/pkgs/build-support/cabal/default.nix
index 7605d863c21..bc73d1f73a2 100644
--- a/pkgs/build-support/cabal/default.nix
+++ b/pkgs/build-support/cabal/default.nix
@@ -1,12 +1,13 @@
 # generic builder for Cabal packages
 
 { stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal, glibcLocales
-, gnugrep, coreutils
+, gnugrep, coreutils, hscolour
 , enableLibraryProfiling ? false
 , enableSharedLibraries ? false
 , enableSharedExecutables ? false
 , enableStaticLibraries ? true
 , enableCheckPhase ? stdenv.lib.versionOlder "7.4" ghc.version
+, enableHyperlinkSource ? true
 , extension ? (self : super : {})
 }:
 
@@ -50,6 +51,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
                 propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs;
                 propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs;
                 doCheck               = enableCheckPhase && x.doCheck;
+                hyperlinkSource       = enableHyperlinkSource && x.hyperlinkSource;
               };
 
         defaults =
@@ -92,6 +94,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
             buildInputs = [ghc Cabal] ++ self.extraBuildInputs;
             extraBuildInputs = self.buildTools ++
                                (optionals self.doCheck self.testDepends) ++
+                               (optional self.hyperlinkSource hscolour) ++
                                (if self.pkgconfigDepends == [] then [] else [pkgconfig]) ++
                                (if self.isLibrary then [] else self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends);
 
@@ -140,6 +143,9 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
             # and run any regression test suites the package might have
             doCheck = enableCheckPhase;
 
+            # pass the '--hyperlink-source' flag to ./Setup haddock
+            hyperlinkSource = enableHyperlinkSource;
+
             # abort the build if the configure phase detects that the package
             # depends on multiple versions of the same build input
             strictConfigurePhase = true;
@@ -222,7 +228,8 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
               ./Setup build ${self.buildTarget}
 
               export GHC_PACKAGE_PATH=$(${ghc.GHCPackages})
-              test -n "$noHaddock" || ./Setup haddock --html --hoogle
+              test -n "$noHaddock" || ./Setup haddock --html --hoogle \
+                  ${optionalString self.hyperlinkSource "--hyperlink-source"}
 
               eval "$postBuild"
             '';