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