Re-export Expression from Predicates
[ghc.git] / src / Settings / Packages.hs
1 module Settings.Packages (getPackages, knownPackages, findKnownPackage) where
2
3 import Base
4 import GHC
5 import Predicates
6 import Oracles.Config.Setting
7 import Settings.User
8
9 -- Combining default list of packages with user modifications
10 getPackages :: Expr [Package]
11 getPackages = fromDiffExpr $ defaultPackages <> userPackages
12
13 -- These are the packages we build by default
14 -- TODO: simplify
15 defaultPackages :: Packages
16 defaultPackages = mconcat
17 [ stage0 ? packagesStage0
18 , stage1 ? packagesStage1
19 , stage2 ? packagesStage2 ]
20
21 packagesStage0 :: Packages
22 packagesStage0 = mconcat
23 [ append [ binary, cabal, compiler, ghc, ghcBoot, ghcCabal, ghcPkg
24 , hsc2hs, hoopl, hpc, templateHaskell, transformers ]
25 -- the stage0 predicate makes sure these packages are built only in Stage0
26 , stage0 ? append [ deriveConstants, dllSplit, genapply, genprimopcode
27 , hp2ps, unlit ]
28 , stage0 ? windowsHost ? append [touchy]
29 , notM windowsHost ? notM iosHost ? append [terminfo] ]
30
31 packagesStage1 :: Packages
32 packagesStage1 = mconcat
33 [ packagesStage0
34 , append [ array, base, bytestring, containers, compareSizes, deepseq
35 , directory, filepath, ghci, ghcPrim, haskeline, hpcBin
36 , integerLibrary, pretty, process, rts, runGhc, time ]
37 , windowsHost ? append [win32]
38 , notM windowsHost ? append [unix]
39 , notM windowsHost ? append [iservBin]
40 , buildHaddock ? append [xhtml] ]
41
42 -- TODO: currently there is an unchecked assumption that we build only programs
43 -- in Stage2 and Stage3. Can we check this in compile time?
44 packagesStage2 :: Packages
45 packagesStage2 = mconcat
46 [ append [ghcTags, mkUserGuidePart]
47 , buildHaddock ? append [haddock] ]
48
49 -- TODO: switch to Set Package as the order of packages should not matter?
50 -- Otherwise we have to keep remembering to sort packages from time to time.
51 knownPackages :: [Package]
52 knownPackages = sort $ defaultKnownPackages ++ userKnownPackages
53
54 -- Note: this is slow but we keep it simple as there are just ~50 packages
55 -- TODO: speed up?
56 findKnownPackage :: PackageName -> Maybe Package
57 findKnownPackage name = find (\pkg -> pkgName pkg == name) knownPackages