5902396aa30dcda26c941135a056233d70701d87
[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, iserv, libffi, libiserv, mtl, parsec, parallel, pretty
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 iserv = hsUtil "iserv"
62 libffi = cTop "libffi"
63 libiserv = hsLib "libiserv"
64 mtl = hsLib "mtl"
65 parsec = hsLib "parsec"
66 parallel = hsLib "parallel"
67 pretty = hsLib "pretty"
68 primitive = hsLib "primitive"
69 process = hsLib "process"
70 rts = cTop "rts"
71 runGhc = hsUtil "runghc"
72 stm = hsLib "stm"
73 templateHaskell = hsLib "template-haskell"
74 terminfo = hsLib "terminfo"
75 text = hsLib "text"
76 time = hsLib "time"
77 touchy = hsUtil "touchy"
78 transformers = hsLib "transformers"
79 unlit = hsUtil "unlit"
80 unix = hsLib "unix"
81 win32 = hsLib "Win32"
82 xhtml = hsLib "xhtml"
83
84 -- | Construct a Haskell library package, e.g. @array@.
85 hsLib :: PackageName -> Package
86 hsLib name = hsLibrary name ("libraries" -/- name)
87
88 -- | Construct a top-level Haskell library package, e.g. @compiler@.
89 hsTop :: PackageName -> Package
90 hsTop name = hsLibrary name name
91
92 -- | Construct a top-level C library package, e.g. @rts@.
93 cTop :: PackageName -> Package
94 cTop name = cLibrary name name
95
96 -- | Construct a top-level Haskell program package, e.g. @ghc@.
97 hsPrg :: PackageName -> Package
98 hsPrg name = hsProgram name name
99
100 -- | Construct a Haskell utility package, e.g. @haddock@.
101 hsUtil :: PackageName -> Package
102 hsUtil name = hsProgram name ("utils" -/- name)
103
104 -- | Amend a package path if it doesn't conform to a typical pattern.
105 setPath :: Package -> FilePath -> Package
106 setPath pkg path = pkg { pkgPath = path }