This repository has been archived by the owner on Aug 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move generators to a dedicated directory, and track their changes.
- Loading branch information
1 parent
bdb88c6
commit 8c3022d
Showing
6 changed files
with
195 additions
and
166 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,102 @@ | ||
module Rules.Generators.ConfigHs (generateConfigHs) where | ||
|
||
import Expression | ||
import GHC | ||
import Oracles | ||
import Settings | ||
|
||
-- TODO: do we need ghc-split? Always or is it platform specific? | ||
-- TODO: add tracking by moving these functions to separate tracked files | ||
generateConfigHs :: Expr String | ||
generateConfigHs = do | ||
lift $ need [sourcePath -/- "Rules/Generators/ConfigHs.hs"] | ||
cProjectName <- getSetting ProjectName | ||
cProjectGitCommitId <- getSetting ProjectGitCommitId | ||
cProjectVersion <- getSetting ProjectVersion | ||
cProjectVersionInt <- getSetting ProjectVersionInt | ||
cProjectPatchLevel <- getSetting ProjectPatchLevel | ||
cProjectPatchLevel1 <- getSetting ProjectPatchLevel1 | ||
cProjectPatchLevel2 <- getSetting ProjectPatchLevel2 | ||
cBooterVersion <- getSetting GhcVersion | ||
let cIntegerLibraryType | integerLibrary == integerGmp = "IntegerGMP" | ||
| integerLibrary == integerSimple = "IntegerSimple" | ||
| otherwise = error $ "Unknown integer library: " | ||
++ show integerLibrary ++ "." | ||
yesNo = lift . fmap (\x -> if x then "YES" else "NO") | ||
cSupportsSplitObjs <- yesNo supportsSplitObjects | ||
cGhcWithInterpreter <- yesNo ghcWithInterpreter | ||
cGhcWithNativeCodeGen <- yesNo ghcWithNativeCodeGen | ||
cGhcWithSMP <- yesNo ghcWithSMP | ||
cGhcEnableTablesNextToCode <- yesNo ghcEnableTablesNextToCode | ||
cLeadingUnderscore <- yesNo $ flag LeadingUnderscore | ||
cGHC_UNLIT_PGM <- fmap takeFileName $ getBuilderPath Unlit | ||
cGHC_SPLIT_PGM <- fmap takeBaseName $ getBuilderPath GhcSplit | ||
cLibFFI <- lift useLibFFIForAdjustors | ||
rtsWays <- getRtsWays | ||
cGhcRtsWithLibdw <- getFlag WithLibdw | ||
let cGhcRTSWays = unwords $ map show rtsWays | ||
return $ unlines | ||
[ "{-# LANGUAGE CPP #-}" | ||
, "module Config where" | ||
, "" | ||
, "#include \"ghc_boot_platform.h\"" | ||
, "" | ||
, "data IntegerLibrary = IntegerGMP" | ||
, " | IntegerSimple" | ||
, " deriving Eq" | ||
, "" | ||
, "cBuildPlatformString :: String" | ||
, "cBuildPlatformString = BuildPlatform_NAME" | ||
, "cHostPlatformString :: String" | ||
, "cHostPlatformString = HostPlatform_NAME" | ||
, "cTargetPlatformString :: String" | ||
, "cTargetPlatformString = TargetPlatform_NAME" | ||
, "" | ||
, "cProjectName :: String" | ||
, "cProjectName = " ++ quote cProjectName | ||
, "cProjectGitCommitId :: String" | ||
, "cProjectGitCommitId = " ++ quote cProjectGitCommitId | ||
, "cProjectVersion :: String" | ||
, "cProjectVersion = " ++ quote cProjectVersion | ||
, "cProjectVersionInt :: String" | ||
, "cProjectVersionInt = " ++ quote cProjectVersionInt | ||
, "cProjectPatchLevel :: String" | ||
, "cProjectPatchLevel = " ++ quote cProjectPatchLevel | ||
, "cProjectPatchLevel1 :: String" | ||
, "cProjectPatchLevel1 = " ++ quote cProjectPatchLevel1 | ||
, "cProjectPatchLevel2 :: String" | ||
, "cProjectPatchLevel2 = " ++ quote cProjectPatchLevel2 | ||
, "cBooterVersion :: String" | ||
, "cBooterVersion = " ++ quote cBooterVersion | ||
, "cStage :: String" | ||
, "cStage = show (STAGE :: Int)" | ||
, "cIntegerLibrary :: String" | ||
, "cIntegerLibrary = " ++ quote (pkgNameString integerLibrary) | ||
, "cIntegerLibraryType :: IntegerLibrary" | ||
, "cIntegerLibraryType = " ++ cIntegerLibraryType | ||
, "cSupportsSplitObjs :: String" | ||
, "cSupportsSplitObjs = " ++ quote cSupportsSplitObjs | ||
, "cGhcWithInterpreter :: String" | ||
, "cGhcWithInterpreter = " ++ quote cGhcWithInterpreter | ||
, "cGhcWithNativeCodeGen :: String" | ||
, "cGhcWithNativeCodeGen = " ++ quote cGhcWithNativeCodeGen | ||
, "cGhcWithSMP :: String" | ||
, "cGhcWithSMP = " ++ quote cGhcWithSMP | ||
, "cGhcRTSWays :: String" | ||
, "cGhcRTSWays = " ++ quote cGhcRTSWays | ||
, "cGhcEnableTablesNextToCode :: String" | ||
, "cGhcEnableTablesNextToCode = " ++ quote cGhcEnableTablesNextToCode | ||
, "cLeadingUnderscore :: String" | ||
, "cLeadingUnderscore = " ++ quote cLeadingUnderscore | ||
, "cGHC_UNLIT_PGM :: String" | ||
, "cGHC_UNLIT_PGM = " ++ quote cGHC_UNLIT_PGM | ||
, "cGHC_SPLIT_PGM :: String" | ||
, "cGHC_SPLIT_PGM = " ++ quote cGHC_SPLIT_PGM | ||
, "cLibFFI :: Bool" | ||
, "cLibFFI = " ++ show cLibFFI | ||
, "cGhcThreaded :: Bool" | ||
, "cGhcThreaded = " ++ show (threaded `elem` rtsWays) | ||
, "cGhcDebugged :: Bool" | ||
, "cGhcDebugged = " ++ show ghcDebugged | ||
, "cGhcRtsWithLibdw :: Bool" | ||
, "cGhcRtsWithLibdw = " ++ show cGhcRtsWithLibdw ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
module Rules.Generators.GhcPkgVersionHs (generateGhcPkgVersionHs) where | ||
|
||
import Expression | ||
import Oracles | ||
|
||
generateGhcPkgVersionHs :: Expr String | ||
generateGhcPkgVersionHs = do | ||
lift $ need [sourcePath -/- "Rules/Generators/GhcPkgVersionHs.hs"] | ||
projectVersion <- getSetting ProjectVersion | ||
targetOs <- getSetting TargetOs | ||
targetArch <- getSetting TargetArch | ||
return $ unlines | ||
[ "module Version where" | ||
, "version, targetOS, targetARCH :: String" | ||
, "version = " ++ quote projectVersion | ||
, "targetOS = " ++ quote targetOs | ||
, "targetARCH = " ++ quote targetArch ] |
Oops, something went wrong.