Make build badges more informative
[hadrian.git] / src / GHC.hs
1 {-# LANGUAGE OverloadedStrings #-}
2 module GHC (
3 array, base, binary, bytestring, cabal, compiler, containers, compareSizes,
4 deepseq, deriveConstants, directory, dllSplit, filepath, genapply,
5 genprimopcode, ghc, ghcBoot, ghcCabal, ghci, ghcPkg, ghcPrim, ghcTags,
6 haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp,
7 integerSimple, iservBin, libffi, mkUserGuidePart, parallel, pretty,
8 primitive, process, rts, runGhc, stm, templateHaskell, terminfo, time,
9 touchy, transformers, unix, win32, xhtml,
10
11 defaultKnownPackages, defaultTargetDirectory, defaultProgramPath
12 ) where
13
14 import Base
15 import Package
16 import Stage
17
18 -- | These are all GHC packages we know about. Build rules will be generated for
19 -- all of them. However, not all of these packages will be built. For example,
20 -- package /win32/ is built only on Windows.
21 -- "Packages" defines default conditions for building each package, which can
22 -- be overridden in "User".
23 defaultKnownPackages :: [Package]
24 defaultKnownPackages =
25 [ array, base, binary, bytestring, cabal, compiler, containers, compareSizes
26 , deepseq, deriveConstants, directory, dllSplit, filepath, genapply
27 , genprimopcode, ghc, ghcBoot, ghcCabal, ghci, ghcPkg, ghcPrim
28 , ghcTags, haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp
29 , integerSimple, iservBin, libffi, mkUserGuidePart, parallel, pretty
30 , primitive, process, rts, runGhc, stm, templateHaskell, terminfo, time
31 , touchy, transformers, unix, win32, xhtml ]
32
33 -- Package definitions (see "Package")
34 array, base, binary, bytestring, cabal, compiler, containers, compareSizes,
35 deepseq, deriveConstants, directory, dllSplit, filepath, genapply,
36 genprimopcode, ghc, ghcBoot, ghcCabal, ghci, ghcPkg, ghcPrim, ghcTags,
37 haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp,
38 integerSimple, iservBin, libffi, mkUserGuidePart, parallel, pretty,
39 primitive, process, rts, runGhc, stm, templateHaskell, terminfo, time,
40 touchy, transformers, unix, win32, xhtml :: Package
41
42 array = library "array"
43 base = library "base"
44 binary = library "binary"
45 bytestring = library "bytestring"
46 cabal = library "Cabal" `setPath` "libraries/Cabal/Cabal"
47 compiler = topLevel "ghc" `setPath` "compiler"
48 containers = library "containers"
49 compareSizes = utility "compareSizes" `setPath` "utils/compare_sizes"
50 deepseq = library "deepseq"
51 deriveConstants = utility "deriveConstants"
52 directory = library "directory"
53 dllSplit = utility "dll-split"
54 filepath = library "filepath"
55 genapply = utility "genapply"
56 genprimopcode = utility "genprimopcode"
57 ghc = topLevel "ghc-bin" `setPath` "ghc" `setType` Program
58 ghcBoot = library "ghc-boot"
59 ghcCabal = utility "ghc-cabal"
60 ghci = library "ghci"
61 ghcPkg = utility "ghc-pkg"
62 ghcPrim = library "ghc-prim"
63 ghcTags = utility "ghctags"
64 haddock = utility "haddock"
65 haskeline = library "haskeline"
66 hsc2hs = utility "hsc2hs"
67 hoopl = library "hoopl"
68 hp2ps = utility "hp2ps"
69 hpc = library "hpc"
70 hpcBin = utility "hpc-bin" `setPath` "utils/hpc"
71 integerGmp = library "integer-gmp"
72 integerSimple = library "integer-simple"
73 iservBin = topLevel "iserv-bin" `setPath` "iserv" `setType` Program
74 libffi = topLevel "libffi"
75 mkUserGuidePart = utility "mkUserGuidePart"
76 parallel = library "parallel"
77 pretty = library "pretty"
78 primitive = library "primitive"
79 process = library "process"
80 rts = topLevel "rts"
81 runGhc = utility "runghc"
82 stm = library "stm"
83 templateHaskell = library "template-haskell"
84 terminfo = library "terminfo"
85 time = library "time"
86 touchy = utility "touchy"
87 transformers = library "transformers"
88 unix = library "unix"
89 win32 = library "Win32"
90 xhtml = library "xhtml"
91
92 -- TODO: The following utils are not implemented yet: unlit, driver/ghc-split
93 -- TODO: The following utils are not included into the build system because
94 -- they seem to be unused or unrelated to the build process: checkUniques,
95 -- completion, count_lines, coverity, debugNGC, describe-unexpected, genargs,
96 -- lndir, mkdirhier, testremove, vagrant
97
98 -- | GHC build results will be placed into target directories with the
99 -- following typical structure:
100
101 -- * @build/@ contains compiled object code
102 -- * @doc/@ is produced by haddock
103 -- * @package-data.mk@ contains output of ghc-cabal applied to pkgCabal
104 defaultTargetDirectory :: Stage -> Package -> FilePath
105 defaultTargetDirectory stage _ = stageString stage
106
107 -- TODO: simplify, add programInplaceLibPath
108 -- | The relative path to the program executable
109 defaultProgramPath :: Stage -> Package -> Maybe FilePath
110 defaultProgramPath stage pkg
111 | pkg == ghc = Just . inplaceProgram $ "ghc-stage" ++ show (fromEnum stage + 1)
112 | pkg == haddock || pkg == ghcTags = case stage of
113 Stage2 -> Just . inplaceProgram $ pkgNameString pkg
114 _ -> Nothing
115 | pkg == touchy = case stage of
116 Stage0 -> Just $ "inplace/lib/bin" -/- pkgNameString pkg <.> exe
117 _ -> Nothing
118 | isProgram pkg = case stage of
119 Stage0 -> Just . inplaceProgram $ pkgNameString pkg
120 _ -> Just . installProgram $ pkgNameString pkg
121 | otherwise = Nothing
122 where
123 inplaceProgram name = programInplacePath -/- name <.> exe
124 installProgram name = pkgPath pkg -/- defaultTargetDirectory stage pkg
125 -/- "build/tmp" -/- name <.> exe