fd126fdf5294d02117d98d651510cde51dcf39ab
[hadrian.git] / src / Settings / Packages / GhcCabal.hs
1 module Settings.Packages.GhcCabal (ghcCabalPackageArgs) where
2
3 import Base
4 import GHC
5 import Oracles.Config.Setting
6 import Predicate
7 import Settings
8
9 ghcCabalPackageArgs :: Args
10 ghcCabalPackageArgs = package ghcCabal ? mconcat
11 [ builder Ghc ?
12 mconcat [ ghcCabalBootArgs
13 , remove ["-no-auto-link-packages"] ] ]
14
15 -- Boostrapping ghcCabal
16 -- TODO: do we need -DCABAL_VERSION=$(CABAL_VERSION)?
17 ghcCabalBootArgs :: Args
18 ghcCabalBootArgs = stage0 ? do
19 path <- getBuildPath
20 let cabalMacros = path -/- "autogen/cabal_macros.h"
21 cabalMacrosBoot = pkgPath ghcCabal -/- "cabal_macros_boot.h"
22 -- Note: We could have computed 'cabalDeps' instead of hard-coding it
23 -- but this doesn't worth the effort, since we plan to drop ghc-cabal
24 -- altogether at some point. See #18.
25 cabalDeps <- fromDiffExpr $ mconcat
26 [ append [ array, base, bytestring, containers, deepseq, directory
27 , pretty, process, time ]
28 , notM windowsHost ? append [unix]
29 , windowsHost ? append [win32] ]
30 mconcat
31 [ append [ "-package " ++ pkgNameString pkg | pkg <- cabalDeps ]
32 , removePair "-optP-include" $ "-optP" ++ cabalMacros
33 , arg "--make"
34 , arg "-j"
35 , arg "-DBOOTSTRAPPING"
36 , arg "-DMIN_VERSION_binary_0_8_0"
37 , arg "-DGENERICS"
38 , arg "-optP-include"
39 , arg $ "-optP" ++ cabalMacrosBoot
40 , arg "-ilibraries/Cabal/Cabal"
41 , arg "-ilibraries/binary/src"
42 , arg "-ilibraries/filepath"
43 , arg "-ilibraries/hpc" ]