Added support for testsuite (#602)
[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, checkApiAnnotations
15 , compareSizes, compiler, containers, deepseq, deriveConstants, directory
16 , filepath, genapply, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCompact
17 , ghcHeap, ghci, ghcPkg, ghcPrim, ghcTags, haddock, haskeline, hsc2hs, hp2ps
18 , hpc, hpcBin, integerGmp, integerSimple, iserv, libffi, libiserv, mtl
19 , parsec, parallel, pretty, process, rts, runGhc, stm, templateHaskell
20 , terminfo, text, time, touchy, 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 checkApiAnnotations = hsUtil "check-api-annotations"
33 checkPpr = hsUtil "check-ppr"
34 compareSizes = hsUtil "compareSizes" `setPath` "utils/compare_sizes"
35 compiler = hsTop "ghc" `setPath` "compiler"
36 containers = hsLib "containers"
37 deepseq = hsLib "deepseq"
38 deriveConstants = hsUtil "deriveConstants"
39 directory = hsLib "directory"
40 filepath = hsLib "filepath"
41 genapply = hsUtil "genapply"
42 genprimopcode = hsUtil "genprimopcode"
43 ghc = hsPrg "ghc-bin" `setPath` "ghc"
44 ghcBoot = hsLib "ghc-boot"
45 ghcBootTh = hsLib "ghc-boot-th"
46 ghcCabal = hsUtil "ghc-cabal"
47 ghcCompact = hsLib "ghc-compact"
48 ghcHeap = hsLib "ghc-heap"
49 ghci = hsLib "ghci"
50 ghcPkg = hsUtil "ghc-pkg"
51 ghcPrim = hsLib "ghc-prim"
52 ghcTags = hsUtil "ghctags"
53 ghcSplit = hsUtil "ghc-split"
54 haddock = hsUtil "haddock"
55 haskeline = hsLib "haskeline"
56 hsc2hs = hsUtil "hsc2hs"
57 hp2ps = hsUtil "hp2ps"
58 hpc = hsLib "hpc"
59 hpcBin = hsUtil "hpc-bin" `setPath` "utils/hpc"
60 integerGmp = hsLib "integer-gmp"
61 integerSimple = hsLib "integer-simple"
62 iserv = hsUtil "iserv"
63 libffi = cTop "libffi"
64 libiserv = hsLib "libiserv"
65 mtl = hsLib "mtl"
66 parsec = hsLib "parsec"
67 parallel = hsLib "parallel"
68 pretty = hsLib "pretty"
69 primitive = hsLib "primitive"
70 process = hsLib "process"
71 rts = cTop "rts"
72 runGhc = hsUtil "runghc"
73 stm = hsLib "stm"
74 templateHaskell = hsLib "template-haskell"
75 terminfo = hsLib "terminfo"
76 text = hsLib "text"
77 time = hsLib "time"
78 touchy = hsUtil "touchy"
79 transformers = hsLib "transformers"
80 unlit = hsUtil "unlit"
81 unix = hsLib "unix"
82 win32 = hsLib "Win32"
83 xhtml = hsLib "xhtml"
84
85 -- | Construct a Haskell library package, e.g. @array@.
86 hsLib :: PackageName -> Package
87 hsLib name = hsLibrary name ("libraries" -/- name)
88
89 -- | Construct a top-level Haskell library package, e.g. @compiler@.
90 hsTop :: PackageName -> Package
91 hsTop name = hsLibrary name name
92
93 -- | Construct a top-level C library package, e.g. @rts@.
94 cTop :: PackageName -> Package
95 cTop name = cLibrary name name
96
97 -- | Construct a top-level Haskell program package, e.g. @ghc@.
98 hsPrg :: PackageName -> Package
99 hsPrg name = hsProgram name name
100
101 -- | Construct a Haskell utility package, e.g. @haddock@.
102 hsUtil :: PackageName -> Package
103 hsUtil name = hsProgram name ("utils" -/- name)
104
105 -- | Amend a package path if it doesn't conform to a typical pattern.
106 setPath :: Package -> FilePath -> Package
107 setPath pkg path = pkg { pkgPath = path }