summaryrefslogtreecommitdiff
path: root/hadrian
diff options
context:
space:
mode:
authorAlec Theriault <alec.theriault@gmail.com>2018-12-27 13:07:51 -0800
committerBen Gamari <ben@smart-cactus.org>2019-01-16 14:13:03 -0500
commitda2d9cf8e028cd4e47285a71a720f33f112db69b (patch)
tree70c42c49e8e675d82fc7157785547ef5beb55343 /hadrian
parentf78048f6575b370f078bcddc6b9e64bfe23932eb (diff)
downloadhaskell-da2d9cf8e028cd4e47285a71a720f33f112db69b.tar.gz
Hadrian: configure packages with right 'htmldir'
This means that we can query the package DB for haddock interfaces. Haddock uses this in its testsuite. 'cabal {v1-,v2,}-haddock' also uses this. Also thread through to Haddock package-specific overrides of GHC warnings.
Diffstat (limited to 'hadrian')
-rw-r--r--hadrian/src/Settings/Builders/Cabal.hs14
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs4
-rw-r--r--hadrian/src/Settings/Default.hs3
-rw-r--r--hadrian/src/Settings/Warnings.hs6
4 files changed, 21 insertions, 6 deletions
diff --git a/hadrian/src/Settings/Builders/Cabal.hs b/hadrian/src/Settings/Builders/Cabal.hs
index 80b9b67a71..8eedcde2b3 100644
--- a/hadrian/src/Settings/Builders/Cabal.hs
+++ b/hadrian/src/Settings/Builders/Cabal.hs
@@ -13,6 +13,7 @@ cabalBuilderArgs :: Args
cabalBuilderArgs = builder (Cabal Setup) ? do
verbosity <- expr getVerbosity
top <- expr topDirectory
+ pkg <- getPackage
path <- getContextPath
stage <- getStage
mconcat [ arg "configure"
@@ -25,13 +26,24 @@ cabalBuilderArgs = builder (Cabal Setup) ? do
, flag CrossCompiling ? pure [ "--disable-executable-stripping"
, "--disable-library-stripping" ]
, arg "--cabal-file"
- , arg =<< pkgCabalFile <$> getPackage
+ , arg $ pkgCabalFile pkg
, arg "--distdir"
, arg $ top -/- path
, arg "--ipid"
, arg "$pkg-$version"
, arg "--prefix"
, arg "${pkgroot}/.."
+
+ -- NB: this is valid only because Hadrian puts the @docs@ and
+ -- @libraries@ folders in the same relative position:
+ --
+ -- * libraries in @_build/stageN/libraries@
+ -- * docs in @_build/docs/html/libraries@
+ --
+ -- This doesn't hold if we move the @docs@ folder anywhere else.
+ , arg "--htmldir"
+ , arg $ "${pkgroot}/../../docs/html/libraries/" ++ pkgName pkg
+
, withStaged $ Ghc CompileHs
, withStaged (GhcPkg Update)
, withBuilderArgs (GhcPkg Update stage)
diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs
index e2cad2cffd..a605873d77 100644
--- a/hadrian/src/Settings/Builders/Ghc.hs
+++ b/hadrian/src/Settings/Builders/Ghc.hs
@@ -83,7 +83,9 @@ findHsDependencies = builder (Ghc FindHsDependencies) ? do
, getInputs ]
haddockGhcArgs :: Args
-haddockGhcArgs = mconcat [ commonGhcArgs, getContextData hcOpts ]
+haddockGhcArgs = mconcat [ commonGhcArgs
+ , getContextData hcOpts
+ , ghcWarningsArgs ]
-- | Common GHC command line arguments used in 'ghcBuilderArgs',
-- 'ghcCBuilderArgs', 'ghcMBuilderArgs' and 'haddockGhcArgs'.
diff --git a/hadrian/src/Settings/Default.hs b/hadrian/src/Settings/Default.hs
index 2cadc4fc79..e2d7644beb 100644
--- a/hadrian/src/Settings/Default.hs
+++ b/hadrian/src/Settings/Default.hs
@@ -277,4 +277,5 @@ defaultBuilderArgs = mconcat
-- | All 'Package'-dependent command line arguments.
defaultPackageArgs :: Args
-defaultPackageArgs = mconcat [ packageArgs, warningArgs ]
+defaultPackageArgs = mconcat [ packageArgs
+ , builder Ghc ? ghcWarningsArgs ]
diff --git a/hadrian/src/Settings/Warnings.hs b/hadrian/src/Settings/Warnings.hs
index 5a9e8311db..42e7662cdc 100644
--- a/hadrian/src/Settings/Warnings.hs
+++ b/hadrian/src/Settings/Warnings.hs
@@ -1,4 +1,4 @@
-module Settings.Warnings (defaultGhcWarningsArgs, warningArgs) where
+module Settings.Warnings (defaultGhcWarningsArgs, ghcWarningsArgs) where
import Expression
import Oracles.Flag
@@ -18,8 +18,8 @@ defaultGhcWarningsArgs = mconcat
, flag GccIsClang ? arg "-optc-Wno-unknown-pragmas" ]
-- | Package-specific warnings-related arguments, mostly suppressing various warnings.
-warningArgs :: Args
-warningArgs = builder Ghc ? do
+ghcWarningsArgs :: Args
+ghcWarningsArgs = do
isIntegerSimple <- (== integerSimple) <$> getIntegerPackage
mconcat
[ stage0 ? mconcat