1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
-- Generate the Host.hs and Version.hs as done by hadrian/src/Rules/Generate.hs
import GHC.Platform.Host
import GHC.Version
main = do
writeFile "Version.hs" versionHs
writeFile "Host.hs" platformHostHs
-- | Generate @Version.hs@ files.
versionHs :: String
versionHs = unlines
[ "module GHC.Version where"
, ""
, "import Prelude -- See Note [Why do we import Prelude here?]"
, ""
, "cProjectGitCommitId :: String"
, "cProjectGitCommitId = " ++ show cProjectGitCommitId
, ""
, "cProjectVersion :: String"
, "cProjectVersion = " ++ show cProjectVersion
, ""
, "cProjectVersionInt :: String"
, "cProjectVersionInt = " ++ show cProjectVersionInt
, ""
, "cProjectPatchLevel :: String"
, "cProjectPatchLevel = " ++ show cProjectPatchLevel
, ""
, "cProjectPatchLevel1 :: String"
, "cProjectPatchLevel1 = " ++ show cProjectPatchLevel1
, ""
, "cProjectPatchLevel2 :: String"
, "cProjectPatchLevel2 = " ++ show cProjectPatchLevel2
]
-- | Generate @Platform/Host.hs@ files.
platformHostHs :: String
platformHostHs = unlines
[ "module GHC.Platform.Host where"
, ""
, "import GHC.Platform"
, ""
, "cHostPlatformArch :: Arch"
, "cHostPlatformArch = " ++ show cHostPlatformArch
, ""
, "cHostPlatformOS :: OS"
, "cHostPlatformOS = " ++ show cHostPlatformOS
, ""
, "cHostPlatformMini :: PlatformMini"
, "cHostPlatformMini = PlatformMini"
, " { platformMini_arch = cHostPlatformArch"
, " , platformMini_os = cHostPlatformOS"
, " }"
]
|