Merge pull request #2767 from jwiegley/hscolour

Build Haddocks with source hyperlinks unless doHscolour is false
This commit is contained in:
Peter Simons 2014-06-03 10:50:04 +02:00
commit 7d1c124647
4 changed files with 16 additions and 5 deletions

View File

@ -1,12 +1,13 @@
# generic builder for Cabal packages # generic builder for Cabal packages
{ stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal, glibcLocales { stdenv, fetchurl, lib, pkgconfig, ghc, Cabal, jailbreakCabal, glibcLocales
, gnugrep, coreutils , gnugrep, coreutils, hscolour
, enableLibraryProfiling ? false , enableLibraryProfiling ? false
, enableSharedLibraries ? false , enableSharedLibraries ? false
, enableSharedExecutables ? false , enableSharedExecutables ? false
, enableStaticLibraries ? true , enableStaticLibraries ? true
, enableCheckPhase ? stdenv.lib.versionOlder "7.4" ghc.version , enableCheckPhase ? stdenv.lib.versionOlder "7.4" ghc.version
, enableHyperlinkSource ? true
, extension ? (self : super : {}) , extension ? (self : super : {})
}: }:
@ -50,6 +51,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs; propagatedBuildInputs = filter (y : ! (y == null)) x.propagatedBuildInputs;
propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs; propagatedUserEnvPkgs = filter (y : ! (y == null)) x.propagatedUserEnvPkgs;
doCheck = enableCheckPhase && x.doCheck; doCheck = enableCheckPhase && x.doCheck;
hyperlinkSource = enableHyperlinkSource && x.hyperlinkSource;
}; };
defaults = defaults =
@ -92,6 +94,7 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
buildInputs = [ghc Cabal] ++ self.extraBuildInputs; buildInputs = [ghc Cabal] ++ self.extraBuildInputs;
extraBuildInputs = self.buildTools ++ extraBuildInputs = self.buildTools ++
(optionals self.doCheck self.testDepends) ++ (optionals self.doCheck self.testDepends) ++
(optional self.hyperlinkSource hscolour) ++
(if self.pkgconfigDepends == [] then [] else [pkgconfig]) ++ (if self.pkgconfigDepends == [] then [] else [pkgconfig]) ++
(if self.isLibrary then [] else self.buildDepends ++ self.extraLibraries ++ self.pkgconfigDepends); (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 # and run any regression test suites the package might have
doCheck = enableCheckPhase; doCheck = enableCheckPhase;
# pass the '--hyperlink-source' flag to ./Setup haddock
hyperlinkSource = enableHyperlinkSource;
# abort the build if the configure phase detects that the package # abort the build if the configure phase detects that the package
# depends on multiple versions of the same build input # depends on multiple versions of the same build input
strictConfigurePhase = true; strictConfigurePhase = true;
@ -222,7 +228,8 @@ assert !enableStaticLibraries -> versionOlder "7.7" ghc.version;
./Setup build ${self.buildTarget} ./Setup build ${self.buildTarget}
export GHC_PACKAGE_PATH=$(${ghc.GHCPackages}) 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" eval "$postBuild"
''; '';

View File

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

View File

@ -1,4 +1,4 @@
{ cabal }: { cabal, hyperlinkSource ? true }:
cabal.mkDerivation (self: { cabal.mkDerivation (self: {
pname = "hscolour"; pname = "hscolour";
@ -6,6 +6,7 @@ cabal.mkDerivation (self: {
sha256 = "15ix93sw4p7g5ln2halcgqppdc0i0vmkzcjzxvqzkk9yp9pq3nrs"; sha256 = "15ix93sw4p7g5ln2halcgqppdc0i0vmkzcjzxvqzkk9yp9pq3nrs";
isLibrary = true; isLibrary = true;
isExecutable = true; isExecutable = true;
hyperlinkSource = hyperlinkSource;
meta = { meta = {
homepage = "http://code.haskell.org/~malcolm/hscolour/"; homepage = "http://code.haskell.org/~malcolm/hscolour/";
description = "Colourise Haskell code"; 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 = callPackage ../build-support/cabal {
Cabal = null; # prefer the Cabal version shipped with the compiler Cabal = null; # prefer the Cabal version shipped with the compiler
hscolour = self.hscolourBootstrap;
inherit enableLibraryProfiling enableCheckPhase inherit enableLibraryProfiling enableCheckPhase
enableStaticLibraries enableSharedLibraries enableSharedExecutables; enableStaticLibraries enableSharedLibraries enableSharedExecutables;
glibcLocales = if pkgs.stdenv.isLinux then pkgs.glibcLocales else null; 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 {}; hsBibutils = callPackage ../development/libraries/haskell/hs-bibutils {};
hscolour = callPackage ../development/libraries/haskell/hscolour {};
hsdns = callPackage ../development/libraries/haskell/hsdns {}; hsdns = callPackage ../development/libraries/haskell/hsdns {};
hsemail = if (pkgs.stdenv.lib.versionOlder ghc.version "7") then null else hsemail = if (pkgs.stdenv.lib.versionOlder ghc.version "7") then null else
@ -2609,6 +2608,9 @@ self : let callPackage = x : y : modifyPrio (newScope self x y); in
hlint = callPackage ../development/tools/haskell/hlint {}; hlint = callPackage ../development/tools/haskell/hlint {};
hscolour = callPackage ../development/tools/haskell/hscolour {};
hscolourBootstrap = self.hscolour.override { hyperlinkSource = false; };
hslogger = callPackage ../development/tools/haskell/hslogger {}; hslogger = callPackage ../development/tools/haskell/hslogger {};
tar = callPackage ../development/libraries/haskell/tar {}; tar = callPackage ../development/libraries/haskell/tar {};