nixpkgs/pkgs/development/compilers/ghcjs/8.10/generate_host_version.hs
Divam ba25b274f4 ghcjs: init at 8.10.7
The src points to the obsidiansystems repo as it has the ghcjs ported from
8.10.5 to 8.10.7, and a bunch of other fixes (#812, #811, #809)
2021-09-15 12:51:34 +09:00

54 lines
1.7 KiB
Haskell

-- 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"
, " }"
]