Build Haddocks with source hyperlinks unless doHscolour is false

This commit is contained in:
John Wiegley 2014-05-29 20:00:04 -05:00
parent d58370db24
commit 176797576c
4 changed files with 16 additions and 5 deletions

View File

@ -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;
@ -219,7 +225,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"
'';

View File

@ -7,6 +7,7 @@ cabal.mkDerivation (self: {
isLibrary = true;
isExecutable = true;
buildDepends = [ mtl ];
hyperlinkSource = false;
meta = {
description = "Unlambda interpreter";
license = "GPL";

View File

@ -1,4 +1,4 @@
{ cabal }:
{ cabal, hyperlinkSource ? true }:
cabal.mkDerivation (self: {
pname = "hscolour";
@ -6,6 +6,7 @@ cabal.mkDerivation (self: {
sha256 = "15ix93sw4p7g5ln2halcgqppdc0i0vmkzcjzxvqzkk9yp9pq3nrs";
isLibrary = true;
isExecutable = true;
hyperlinkSource = hyperlinkSource;
meta = {
homepage = "http://code.haskell.org/~malcolm/hscolour/";
description = "Colourise Haskell code";

View File

@ -96,6 +96,7 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
cabal = callPackage ../build-support/cabal {
Cabal = null; # prefer the Cabal version shipped with the compiler
hscolour = self.hscolourBootstrap;
inherit enableLibraryProfiling enableCheckPhase
enableStaticLibraries enableSharedLibraries enableSharedExecutables;
glibcLocales = if pkgs.stdenv.isLinux then pkgs.glibcLocales else null;
@ -1117,8 +1118,6 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
hsBibutils = callPackage ../development/libraries/haskell/hs-bibutils {};
hscolour = callPackage ../development/libraries/haskell/hscolour {};
hsdns = callPackage ../development/libraries/haskell/hsdns {};
hsemail = if (pkgs.stdenv.lib.versionOlder ghc.version "7") then null else
@ -2605,6 +2604,9 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
hlint = callPackage ../development/tools/haskell/hlint {};
hscolour = callPackage ../development/tools/haskell/hscolour {};
hscolourBootstrap = self.hscolour.override { hyperlinkSource = false; };
hslogger = callPackage ../development/tools/haskell/hslogger {};
tar = callPackage ../development/libraries/haskell/tar {};