Add support for non-library packages.
[hadrian.git] / src / GHC.hs
1 module GHC (
2 array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
3 deepseq, directory, filepath, ghc, ghcPrim, haskeline, hoopl, hpc,
4 integerGmp, integerSimple, parallel, pretty, primitive, process, stm,
5 templateHaskell, terminfo, time, transformers, unix, win32, xhtml,
6
7 defaultKnownPackages, defaultTargetDirectory, defaultProgramPath
8 ) where
9
10 import Base
11 import Package
12 import Stage
13
14 -- These are all GHC packages we know about. Build rules will be generated for
15 -- all of them. However, not all of these packages will be built. For example,
16 -- package 'win32' is built only on Windows.
17 -- Settings/Packages.hs defines default conditions for building each package,
18 -- which can be overridden in Settings/User.hs.
19 defaultKnownPackages :: [Package]
20 defaultKnownPackages =
21 [ array, base, binPackageDb, binary, bytestring, cabal, compiler
22 , containers, deepseq, directory, filepath, ghc, ghcPrim, haskeline, hoopl
23 , hpc, integerGmp, integerSimple, parallel, pretty, primitive, process, stm
24 , templateHaskell, terminfo, time, transformers, unix, win32, xhtml ]
25
26 -- Package definitions
27 array, base, binPackageDb, binary, bytestring, cabal, compiler, containers,
28 deepseq, directory, filepath, ghc, ghcPrim, haskeline, hoopl, hpc,
29 integerGmp, integerSimple, parallel, pretty, primitive, process, stm,
30 templateHaskell, terminfo, time, transformers, unix, win32, xhtml :: Package
31
32 array = library "array"
33 base = library "base"
34 binPackageDb = library "bin-package-db"
35 binary = library "binary"
36 bytestring = library "bytestring"
37 cabal = library "Cabal" `setPath` "libraries/Cabal/Cabal"
38 compiler = topLevel "ghc" `setPath` "compiler"
39 containers = library "containers"
40 deepseq = library "deepseq"
41 directory = library "directory"
42 filepath = library "filepath"
43 ghc = topLevel "ghc-bin" `setPath` "ghc"
44 ghcPrim = library "ghc-prim"
45 haskeline = library "haskeline"
46 hoopl = library "hoopl"
47 hpc = library "hpc"
48 integerGmp = library "integer-gmp"
49 integerSimple = library "integer-simple"
50 parallel = library "parallel"
51 pretty = library "pretty"
52 primitive = library "primitive"
53 process = library "process"
54 stm = library "stm"
55 templateHaskell = library "template-haskell"
56 terminfo = library "terminfo"
57 time = library "time"
58 transformers = library "transformers"
59 unix = library "unix"
60 win32 = library "Win32"
61 xhtml = library "xhtml"
62
63 -- GHC build results will be placed into target directories with the following
64 -- typical structure:
65 -- * build/ : contains compiled object code
66 -- * doc/ : produced by haddock
67 -- * package-data.mk : contains output of ghc-cabal applied to pkgCabal
68 -- TODO: simplify to just 'show stage'?
69 defaultTargetDirectory :: Stage -> Package -> FilePath
70 defaultTargetDirectory stage pkg
71 | pkg == compiler = "stage" ++ show (fromEnum stage + 1)
72 | pkg == ghc = "stage" ++ show (fromEnum stage + 1)
73 | stage == Stage0 = "dist-boot"
74 | otherwise = "dist-install"
75
76 defaultProgramPath :: Stage -> Package -> Maybe FilePath
77 defaultProgramPath stage pkg
78 | pkg == ghc = program $ "ghc-stage" ++ show (fromEnum stage + 1)
79 | otherwise = Nothing
80 where
81 program name = Just $ pkgPath pkg -/- defaultTargetDirectory stage pkg
82 -/- "build/tmp" -/- name <.> exe