Add ghc-heap
[hadrian.git] / src / GHC / Packages.hs
1 {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
2 module GHC.Packages where
3
4 import Hadrian.Package
5 import Hadrian.Utilities
6
7 -- | These are all GHC packages we know about. Build rules will be generated for
8 -- all of them. However, not all of these packages will be built. For example,
9 -- package 'win32' is built only on Windows. 'defaultPackages' defines default
10 -- conditions for building each package. Users can add their own packages and
11 -- modify build default build conditions in "UserSettings".
12 ghcPackages :: [Package]
13 ghcPackages =
14 [ array, base, binary, bytestring, cabal, checkPpr, compareSizes, compiler
15 , containers, deepseq, deriveConstants, directory, filepath, genapply
16 , genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCompact, ghcHeap, ghci, ghcPkg
17 , ghcPrim, ghcTags, haddock, haskeline, hsc2hs, hp2ps, hpc, hpcBin, integerGmp
18 , integerSimple, iservBin, libffi, mtl, parsec, parallel, pretty, primitive
19 , process, rts, runGhc, stm, templateHaskell, terminfo, text, time, touchy
20 , transformers, unlit, unix, win32, xhtml ]
21
22 -- TODO: Optimise by switching to sets of packages.
23 isGhcPackage :: Package -> Bool
24 isGhcPackage = (`elem` ghcPackages)
25
26 -- | Package definitions, see 'Package'.
27 array = hsLib "array"
28 base = hsLib "base"
29 binary = hsLib "binary"
30 bytestring = hsLib "bytestring"
31 cabal = hsLib "Cabal" `setPath` "libraries/Cabal/Cabal"
32 checkPpr = hsUtil "check-ppr"
33 compareSizes = hsUtil "compareSizes" `setPath` "utils/compare_sizes"
34 compiler = hsTop "ghc" `setPath` "compiler"
35 containers = hsLib "containers"
36 deepseq = hsLib "deepseq"
37 deriveConstants = hsUtil "deriveConstants"
38 directory = hsLib "directory"
39 filepath = hsLib "filepath"
40 genapply = hsUtil "genapply"
41 genprimopcode = hsUtil "genprimopcode"
42 ghc = hsPrg "ghc-bin" `setPath` "ghc"
43 ghcBoot = hsLib "ghc-boot"
44 ghcBootTh = hsLib "ghc-boot-th"
45 ghcCabal = hsUtil "ghc-cabal"
46 ghcCompact = hsLib "ghc-compact"
47 ghcHeap = hsLib "ghc-heap"
48 ghci = hsLib "ghci"
49 ghcPkg = hsUtil "ghc-pkg"
50 ghcPrim = hsLib "ghc-prim"
51 ghcTags = hsUtil "ghctags"
52 ghcSplit = hsUtil "ghc-split"
53 haddock = hsUtil "haddock"
54 haskeline = hsLib "haskeline"
55 hsc2hs = hsUtil "hsc2hs"
56 hp2ps = hsUtil "hp2ps"
57 hpc = hsLib "hpc"
58 hpcBin = hsUtil "hpc-bin" `setPath` "utils/hpc"
59 integerGmp = hsLib "integer-gmp"
60 integerSimple = hsLib "integer-simple"
61 iservBin = hsUtil "iserv-bin" `setPath` "iserv"
62 libffi = cTop "libffi"
63 mtl = hsLib "mtl"
64 parsec = hsLib "parsec"
65 parallel = hsLib "parallel"
66 pretty = hsLib "pretty"
67 primitive = hsLib "primitive"
68 process = hsLib "process"
69 rts = cTop "rts"
70 runGhc = hsUtil "runghc"
71 stm = hsLib "stm"
72 templateHaskell = hsLib "template-haskell"
73 terminfo = hsLib "terminfo"
74 text = hsLib "text"
75 time = hsLib "time"
76 touchy = hsUtil "touchy"
77 transformers = hsLib "transformers"
78 unlit = hsUtil "unlit"
79 unix = hsLib "unix"
80 win32 = hsLib "Win32"
81 xhtml = hsLib "xhtml"
82
83 -- | Construct a Haskell library package, e.g. @array@.
84 hsLib :: PackageName -> Package
85 hsLib name = hsLibrary name ("libraries" -/- name)
86
87 -- | Construct a top-level Haskell library package, e.g. @compiler@.
88 hsTop :: PackageName -> Package
89 hsTop name = hsLibrary name name
90
91 -- | Construct a top-level C library package, e.g. @rts@.
92 cTop :: PackageName -> Package
93 cTop name = cLibrary name name
94
95 -- | Construct a top-level Haskell program package, e.g. @ghc@.
96 hsPrg :: PackageName -> Package
97 hsPrg name = hsProgram name name
98
99 -- | Construct a Haskell utility package, e.g. @haddock@.
100 hsUtil :: PackageName -> Package
101 hsUtil name = hsProgram name ("utils" -/- name)
102
103 -- | Amend a package path if it doesn't conform to a typical pattern.
104 setPath :: Package -> FilePath -> Package
105 setPath pkg path = pkg { pkgPath = path }