Minor revision
[hadrian.git] / src / Settings / Builders / GhcPkg.hs
1 module Settings.Builders.GhcPkg (ghcPkgBuilderArgs) where
2
3 import Base
4 import Predicate
5 import Settings
6 import Settings.Builders.GhcCabal
7
8 ghcPkgBuilderArgs :: Args
9 ghcPkgBuilderArgs = builder GhcPkg ? (initArgs <> updateArgs)
10
11 initPredicate :: Predicate
12 initPredicate = orM $ map (output . packageDbDirectory) [Stage0 ..]
13
14 initArgs :: Args
15 initArgs = initPredicate ? mconcat [ arg "init", arg =<< getOutput ]
16
17 -- TODO: move inplace-pkg-config to buildRootPath, see #113.
18 updateArgs :: Args
19 updateArgs = notM initPredicate ? do
20 pkg <- getPackage
21 dir <- getContextDirectory
22 mconcat [ arg "update"
23 , arg "--force"
24 , bootPackageDbArgs
25 , arg $ pkgPath pkg -/- dir -/- "inplace-pkg-config" ]