Unverified Commit c8666605 authored by Andrey Mokhov's avatar Andrey Mokhov Committed by GitHub

Minor revision (#619)

See #540 
parent c51b92b5
{-# OPTIONS_GHC -fno-warn-missing-signatures #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-}
module GHC ( module GHC (
-- * GHC packages -- * GHC packages
array, base, binary, bytestring, cabal, checkApiAnnotations, checkPpr, array, base, binary, bytestring, cabal, checkApiAnnotations, checkPpr,
compareSizes, compiler, containers, deepseq, deriveConstants, directory, compareSizes, compiler, containers, deepseq, deriveConstants, directory,
filepath, genapply, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCabal, filepath, genapply, genprimopcode, ghc, ghcBoot, ghcBootTh, ghcCabal,
ghcCompact, ghcHeap, ghci, ghcPkg, ghcPrim, ghcTags, ghcSplit, haddock, ghcCompact, ghcHeap, ghci, ghcPkg, ghcPrim, ghcTags, ghcSplit, haddock,
haskeline, hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv, haskeline, hsc2hs, hp2ps, hpc, hpcBin, integerGmp, integerSimple, iserv,
libffi, libiserv, mtl, parsec, parallel, pretty, primitive, process, rts, libffi, libiserv, mtl, parsec, parallel, pretty, primitive, process, rts,
runGhc, stm, templateHaskell, terminfo, text, time, touchy, transformers, runGhc, stm, templateHaskell, terminfo, text, time, touchy, transformers,
unlit, unix, win32, xhtml, ghcPackages, isGhcPackage, defaultPackages, unlit, unix, win32, xhtml, ghcPackages, isGhcPackage, defaultPackages,
testsuitePackages, testsuitePackages,
-- * Package information -- * Package information
...@@ -36,7 +36,7 @@ defaultPackages Stage3 = return [] ...@@ -36,7 +36,7 @@ defaultPackages Stage3 = return []
stage0Packages :: Action [Package] stage0Packages :: Action [Package]
stage0Packages = do stage0Packages = do
win <- windowsHost win <- windowsHost
cross <- crossCompiling cross <- flag CrossCompiling
return $ [ binary return $ [ binary
, cabal , cabal
, compareSizes , compareSizes
...@@ -68,7 +68,7 @@ stage1Packages = do ...@@ -68,7 +68,7 @@ stage1Packages = do
win <- windowsHost win <- windowsHost
intLib <- integerLibrary =<< flavour intLib <- integerLibrary =<< flavour
libraries0 <- filter isLibrary <$> stage0Packages libraries0 <- filter isLibrary <$> stage0Packages
cross <- crossCompiling cross <- flag CrossCompiling
return $ libraries0 -- Build all Stage0 libraries in Stage1 return $ libraries0 -- Build all Stage0 libraries in Stage1
++ [ array ++ [ array
, base , base
...@@ -106,7 +106,7 @@ stage2Packages = return [haddock] ...@@ -106,7 +106,7 @@ stage2Packages = return [haddock]
testsuitePackages :: Action [Package] testsuitePackages :: Action [Package]
testsuitePackages = return [ checkApiAnnotations testsuitePackages = return [ checkApiAnnotations
, checkPpr , checkPpr
, hp2ps ] , hp2ps ]
-- | Given a 'Context', compute the name of the program that is built in it -- | Given a 'Context', compute the name of the program that is built in it
-- assuming that the corresponding package's type is 'Program'. For example, GHC -- assuming that the corresponding package's type is 'Program'. For example, GHC
...@@ -114,7 +114,7 @@ testsuitePackages = return [ checkApiAnnotations ...@@ -114,7 +114,7 @@ testsuitePackages = return [ checkApiAnnotations
-- 'Library', the function simply returns its name. -- 'Library', the function simply returns its name.
programName :: Context -> Action String programName :: Context -> Action String
programName Context {..} = do programName Context {..} = do
cross <- crossCompiling cross <- flag CrossCompiling
targetPlatform <- setting TargetPlatformFull targetPlatform <- setting TargetPlatformFull
let prefix = if cross then targetPlatform ++ "-" else "" let prefix = if cross then targetPlatform ++ "-" else ""
in return $ prefix ++ case package of in return $ prefix ++ case package of
......
...@@ -4,43 +4,42 @@ import Development.Shake.Classes ...@@ -4,43 +4,42 @@ import Development.Shake.Classes
import Hadrian.Package.Type import Hadrian.Package.Type
import GHC.Generics import GHC.Generics
-- | Most of these fields used to be provided in @package-data.mk@ files.
data PackageData = PackageData data PackageData = PackageData
{ dependencies :: [PackageName] { dependencies :: [PackageName]
, name :: PackageName , name :: PackageName
, version :: String , version :: String
-- * used to be pkg Data , componentId :: String
, componentId :: String , modules :: [String]
, modules :: [String] , otherModules :: [String]
, otherModules :: [String] , synopsis :: String
, synopsis :: String , description :: String
, description :: String , srcDirs :: [String]
, srcDirs :: [String] , deps :: [String]
, deps :: [String] , depIpIds :: [String]
, depIpIds :: [String] , depNames :: [String]
, depNames :: [String] , depCompIds :: [String]
, depCompIds :: [String] , includeDirs :: [String]
, includeDirs :: [String] , includes :: [String]
, includes :: [String]
, installIncludes :: [String] , installIncludes :: [String]
, extraLibs :: [String] , extraLibs :: [String]
, extraLibDirs :: [String] , extraLibDirs :: [String]
, asmSrcs :: [String] , asmSrcs :: [String]
, cSrcs :: [String] , cSrcs :: [String]
, cmmSrcs :: [String] , cmmSrcs :: [String]
, dataFiles :: [String] , dataFiles :: [String]
, hcOpts :: [String] , hcOpts :: [String]
, asmOpts :: [String] , asmOpts :: [String]
, ccOpts :: [String] , ccOpts :: [String]
, cmmOpts :: [String] , cmmOpts :: [String]
, cppOpts :: [String] , cppOpts :: [String]
, ldOpts :: [String] , ldOpts :: [String]
, depIncludeDirs :: [String] , depIncludeDirs :: [String]
, depCcOpts :: [String] , depCcOpts :: [String]
, depLdOpts :: [String] , depLdOpts :: [String]
, buildGhciLib :: Bool , buildGhciLib :: Bool
} deriving (Eq, Read, Show, Typeable, Generic) } deriving (Eq, Read, Show, Typeable, Generic)
instance Binary PackageData instance Binary PackageData
instance Hashable PackageData instance Hashable PackageData
instance NFData PackageData instance NFData PackageData
...@@ -147,12 +147,12 @@ configurePackage context@Context {..} = do ...@@ -147,12 +147,12 @@ configurePackage context@Context {..} = do
pure $ C.simpleUserHooks { C.postConf = \_ _ _ _ -> return () } pure $ C.simpleUserHooks { C.postConf = \_ _ _ _ -> return () }
| otherwise -> pure C.simpleUserHooks | otherwise -> pure C.simpleUserHooks
-- Compute the list of flags
-- Compute the Cabal configurartion arguments
flavourArgs <- args <$> flavour flavourArgs <- args <$> flavour
-- Compute the list of flags. flagList <- interpret (target context (CabalFlags stage) [] []) flavourArgs
flagList <- interpret (target context (CabalFlags stage) [] []) flavourArgs argList <- interpret (target context (GhcCabal Conf stage) [] []) flavourArgs
-- Compute the Cabal configurartion arguments. verbosity <- getVerbosity
argList <- interpret (target context (GhcCabal Conf stage) [] []) flavourArgs
verbosity <- getVerbosity
let v = if verbosity >= Loud then "-v3" else "-v0" let v = if verbosity >= Loud then "-v3" else "-v0"
liftIO $ C.defaultMainWithHooksNoReadArgs hooks gpd liftIO $ C.defaultMainWithHooksNoReadArgs hooks gpd
(argList ++ ["--flags=" ++ unwords flagList, v]) (argList ++ ["--flags=" ++ unwords flagList, v])
...@@ -184,10 +184,10 @@ registerPackage context@Context {..} = do ...@@ -184,10 +184,10 @@ registerPackage context@Context {..} = do
-- | Parse the 'PackageData' of the 'Package' of a given 'Context'. -- | Parse the 'PackageData' of the 'Package' of a given 'Context'.
parsePackageData :: Context -> Action PackageData parsePackageData :: Context -> Action PackageData
parsePackageData context@Context {..} = do parsePackageData context@Context {..} = do
-- XXX: This is conceptually wrong! -- TODO: This is conceptually wrong!
-- We should use the gpd, the flagAssignment and compiler, hostPlatform, ... -- We should use the gpd, the flagAssignment and compiler, hostPlatform, and
-- information from the lbi. And then compute the finalised PD (flags, -- other information from the lbi. And then compute the finalised PD (flags,
-- satisfiable dependencies, platform, compiler info, deps, gpd.) -- satisfiable dependencies, platform, compiler info, deps, gpd).
-- --
-- let (Right (pd,_)) = C.finalizePackageDescription flags (const True) platform (compilerInfo compiler) [] gpd -- let (Right (pd,_)) = C.finalizePackageDescription flags (const True) platform (compilerInfo compiler) [] gpd
-- --
...@@ -199,7 +199,7 @@ parsePackageData context@Context {..} = do ...@@ -199,7 +199,7 @@ parsePackageData context@Context {..} = do
lbi <- liftIO $ C.getPersistBuildConfig cPath lbi <- liftIO $ C.getPersistBuildConfig cPath
-- XXX: move this into its own rule for "build/autogen/cabal_macros.h", and -- TODO: Move this into its own rule for "build/autogen/cabal_macros.h", and
-- "build/autogen/Path_*.hs" and 'need' them here. -- "build/autogen/Path_*.hs" and 'need' them here.
-- create the cabal_macros.h, ... -- create the cabal_macros.h, ...
-- Note: the `cPath` is ignored. The path that's used is the 'buildDir' path -- Note: the `cPath` is ignored. The path that's used is the 'buildDir' path
...@@ -211,26 +211,25 @@ parsePackageData context@Context {..} = do ...@@ -211,26 +211,25 @@ parsePackageData context@Context {..} = do
-- TODO: Get rid of deprecated 'externalPackageDeps' and drop -Wno-deprecations -- TODO: Get rid of deprecated 'externalPackageDeps' and drop -Wno-deprecations
-- See: https://github.com/snowleopard/hadrian/issues/548 -- See: https://github.com/snowleopard/hadrian/issues/548
let extDeps = C.externalPackageDeps lbi' let extDeps = C.externalPackageDeps lbi'
deps = map (C.display . snd) extDeps deps = map (C.display . snd) extDeps
dep_direct = map (fromMaybe (error "dep_keys failed") dep_direct = map (fromMaybe (error "parsePackageData: dep_keys failed")
. C.lookupUnitId (C.installedPkgs lbi') . C.lookupUnitId (C.installedPkgs lbi') . fst) extDeps
. fst) extDeps dep_ipids = map (C.display . Installed.installedUnitId) dep_direct
dep_ipids = map (C.display . Installed.installedUnitId) dep_direct
Just ghcProg = C.lookupProgram C.ghcProgram (C.withPrograms lbi') Just ghcProg = C.lookupProgram C.ghcProgram (C.withPrograms lbi')
dep_pkgs = C.topologicalOrder (packageHacks (C.installedPkgs lbi'))
dep_pkgs = C.topologicalOrder (packageHacks (C.installedPkgs lbi')) forDeps f = concatMap f dep_pkgs
forDeps f = concatMap f dep_pkgs
-- Copied from Distribution.Simple.PreProcess.ppHsc2Hs -- Copied from Distribution.Simple.PreProcess.ppHsc2Hs
packageHacks = case C.compilerFlavor (C.compiler lbi') of packageHacks = case C.compilerFlavor (C.compiler lbi') of
C.GHC | C.pkgName (C.package pd') /= (C.mkPackageName "rts") -> hackRtsPackage C.GHC | C.pkgName (C.package pd') /= (C.mkPackageName "rts") -> hackRtsPackage
_ -> id _ -> id
-- TODO: Get rid of this hack.
-- We don't link in the actual Haskell libraries of our dependencies, so -- We don't link in the actual Haskell libraries of our dependencies, so
-- the -u flags in the ldOptions of the rts package mean linking fails -- the "-u" flags in @ldOptions@ of the @rts@ package mean linking fails
-- on OS X (it's ld is a tad stricter than gnu ld). Thus we remove the -- on OS X (its @ld@ is a tad stricter than GNU @ld@). Thus we remove
-- ldOptions for GHC's rts package: -- @ldOptions@ for the @rts@ package. With one exception (see below).
hackRtsPackage index | null (C.allPackages index) = index hackRtsPackage index | null (C.allPackages index) = index
-- ^ do not hack the empty index -- ^ do not hack the empty index
hackRtsPackage index = case C.lookupPackageName index (C.mkPackageName "rts") of hackRtsPackage index = case C.lookupPackageName index (C.mkPackageName "rts") of
...@@ -244,50 +243,52 @@ parsePackageData context@Context {..} = do ...@@ -244,50 +243,52 @@ parsePackageData context@Context {..} = do
-- there. So we filter out gcc-lib from the RTS's library-dirs here. -- there. So we filter out gcc-lib from the RTS's library-dirs here.
_ -> error "No (or multiple) GHC rts package is registered!" _ -> error "No (or multiple) GHC rts package is registered!"
buildInfo = fst (biModules pd')
in return $ PackageData in return $ PackageData
{ dependencies = deps { dependencies = deps
, name = C.unPackageName . C.pkgName . C.package $ pd' , name = C.unPackageName . C.pkgName . C.package $ pd'
, version = C.display . C.pkgVersion . C.package $ pd' , version = C.display . C.pkgVersion . C.package $ pd'
, componentId = C.localCompatPackageKey lbi' , componentId = C.localCompatPackageKey lbi'
, modules = map C.display . snd . biModules $ pd' , modules = map C.display . snd . biModules $ pd'
, otherModules = map C.display . C.otherModules . fst . biModules $ pd' , otherModules = map C.display . C.otherModules $ buildInfo
, synopsis = C.synopsis pd' , synopsis = C.synopsis pd'
, description = C.description pd' , description = C.description pd'
, srcDirs = C.hsSourceDirs . fst . biModules $ pd' , srcDirs = C.hsSourceDirs buildInfo
, deps = deps , deps = deps
, depIpIds = dep_ipids , depIpIds = dep_ipids
, depNames = map (C.display . C.mungedName . snd) extDeps , depNames = map (C.display . C.mungedName . snd) extDeps
, depCompIds = if C.packageKeySupported (C.compiler lbi') , depCompIds = if C.packageKeySupported (C.compiler lbi')
then dep_ipids then dep_ipids
else deps else deps
, includeDirs = C.includeDirs . fst . biModules $ pd' , includeDirs = C.includeDirs buildInfo
, includes = C.includes . fst . biModules $ pd' , includes = C.includes buildInfo
, installIncludes = C.installIncludes . fst . biModules $ pd' , installIncludes = C.installIncludes buildInfo
, extraLibs = C.extraLibs . fst . biModules $ pd' , extraLibs = C.extraLibs buildInfo
, extraLibDirs = C.extraLibDirs . fst . biModules $ pd' , extraLibDirs = C.extraLibDirs buildInfo
, asmSrcs = C.asmSources . fst . biModules $ pd' , asmSrcs = C.asmSources buildInfo
, cSrcs = C.cSources . fst . biModules $ pd' , cSrcs = C.cSources buildInfo
, cmmSrcs = C.cmmSources . fst . biModules $ pd' , cmmSrcs = C.cmmSources buildInfo
, dataFiles = C.dataFiles pd' , dataFiles = C.dataFiles pd'
, hcOpts = C.programDefaultArgs ghcProg , hcOpts = C.programDefaultArgs ghcProg
++ (C.hcOptions C.GHC . fst . biModules $ pd') ++ C.hcOptions C.GHC buildInfo
++ C.languageToFlags (C.compiler lbi') (C.defaultLanguage . fst $ biModules pd') ++ C.languageToFlags (C.compiler lbi') (C.defaultLanguage buildInfo)
++ C.extensionsToFlags (C.compiler lbi') (C.usedExtensions . fst $ biModules pd') ++ C.extensionsToFlags (C.compiler lbi') (C.usedExtensions buildInfo)
++ C.programOverrideArgs ghcProg ++ C.programOverrideArgs ghcProg
, asmOpts = C.asmOptions . fst $ biModules pd' , asmOpts = C.asmOptions buildInfo
, ccOpts = C.ccOptions . fst $ biModules pd' , ccOpts = C.ccOptions buildInfo
, cmmOpts = C.cmmOptions . fst $ biModules pd' , cmmOpts = C.cmmOptions buildInfo
, cppOpts = C.cppOptions . fst $ biModules pd' , cppOpts = C.cppOptions buildInfo
, ldOpts = C.ldOptions . fst $ biModules pd' , ldOpts = C.ldOptions buildInfo
, depIncludeDirs = forDeps Installed.includeDirs , depIncludeDirs = forDeps Installed.includeDirs
, depCcOpts = forDeps Installed.ccOptions , depCcOpts = forDeps Installed.ccOptions
, depLdOpts = forDeps Installed.ldOptions , depLdOpts = forDeps Installed.ldOptions
, buildGhciLib = C.withGHCiLib lbi' } , buildGhciLib = C.withGHCiLib lbi' }
getHookedBuildInfo :: FilePath -> IO C.HookedBuildInfo getHookedBuildInfo :: FilePath -> IO C.HookedBuildInfo
getHookedBuildInfo baseDir = do getHookedBuildInfo baseDir = do
-- TODO: We should probably better generate this in the build dir, rather then -- TODO: We should probably better generate this in the build dir, rather
-- in the base dir? However `configure` is run in the baseDir. -- than in the base dir? However, @configure@ is run in the baseDir.
maybeInfoFile <- C.findHookedPackageDesc baseDir maybeInfoFile <- C.findHookedPackageDesc baseDir
case maybeInfoFile of case maybeInfoFile of
Nothing -> return C.emptyHookedBuildInfo Nothing -> return C.emptyHookedBuildInfo
......
module Oracles.Flag ( module Oracles.Flag (
Flag (..), flag, crossCompiling, platformSupportsSharedLibs, Flag (..), flag, getFlag, platformSupportsSharedLibs, ghcWithSMP,
ghcWithSMP, ghcWithNativeCodeGen, supportsSplitObjects ghcWithNativeCodeGen, supportsSplitObjects
) where ) where
import Hadrian.Oracles.TextFile import Hadrian.Oracles.TextFile
import Hadrian.Expression
import Base import Base
import Oracles.Setting import Oracles.Setting
...@@ -39,8 +40,9 @@ flag f = do ...@@ -39,8 +40,9 @@ flag f = do
++ quote (key ++ " = " ++ value) ++ " cannot be parsed." ++ quote (key ++ " = " ++ value) ++ " cannot be parsed."
return $ value == "YES" return $ value == "YES"
crossCompiling :: Action Bool -- | Get a configuration setting.
crossCompiling = flag CrossCompiling getFlag :: Flag -> Expr c b Bool
getFlag = expr . flag
platformSupportsSharedLibs :: Action Bool platformSupportsSharedLibs :: Action Bool
platformSupportsSharedLibs = do platformSupportsSharedLibs = do
......
...@@ -239,7 +239,7 @@ generateGhcPlatformH = do ...@@ -239,7 +239,7 @@ generateGhcPlatformH = do
targetArch <- getSetting TargetArch targetArch <- getSetting TargetArch
targetOs <- getSetting TargetOs targetOs <- getSetting TargetOs
targetVendor <- getSetting TargetVendor targetVendor <- getSetting TargetVendor
ghcUnreg <- expr $ flag GhcUnregisterised ghcUnreg <- getFlag GhcUnregisterised
return . unlines $ return . unlines $
[ "#ifndef __GHCPLATFORM_H__" [ "#ifndef __GHCPLATFORM_H__"
, "#define __GHCPLATFORM_H__" , "#define __GHCPLATFORM_H__"
...@@ -305,7 +305,7 @@ generateConfigHs = do ...@@ -305,7 +305,7 @@ generateConfigHs = do
cGHC_UNLIT_PGM <- fmap takeFileName $ getBuilderPath Unlit cGHC_UNLIT_PGM <- fmap takeFileName $ getBuilderPath Unlit
cLibFFI <- expr useLibFFIForAdjustors cLibFFI <- expr useLibFFIForAdjustors
rtsWays <- getRtsWays rtsWays <- getRtsWays
cGhcRtsWithLibdw <- expr $ flag WithLibdw cGhcRtsWithLibdw <- getFlag WithLibdw
let cGhcRTSWays = unwords $ map show rtsWays let cGhcRTSWays = unwords $ map show rtsWays
return $ unlines return $ unlines
[ "{-# LANGUAGE CPP #-}" [ "{-# LANGUAGE CPP #-}"
...@@ -381,7 +381,7 @@ generateGhcAutoconfH = do ...@@ -381,7 +381,7 @@ generateGhcAutoconfH = do
trackGenerateHs trackGenerateHs
configHContents <- expr $ map undefinePackage <$> readFileLines configH configHContents <- expr $ map undefinePackage <$> readFileLines configH
tablesNextToCode <- expr ghcEnableTablesNextToCode tablesNextToCode <- expr ghcEnableTablesNextToCode
ghcUnreg <- expr $ flag GhcUnregisterised ghcUnreg <- getFlag GhcUnregisterised
ccLlvmBackend <- getSetting CcLlvmBackend ccLlvmBackend <- getSetting CcLlvmBackend
ccClangBackend <- getSetting CcClangBackend ccClangBackend <- getSetting CcClangBackend
return . unlines $ return . unlines $
......
...@@ -7,8 +7,8 @@ import Base ...@@ -7,8 +7,8 @@ import Base
import Context import Context
import Expression hiding (stage, way) import Expression hiding (stage, way)
import GHC import GHC
import Oracles.Flag
import Oracles.ModuleFiles import Oracles.ModuleFiles
import Oracles.Flag (crossCompiling)
import Settings import Settings
import Settings.Packages.Rts import Settings.Packages.Rts
import Target import Target
...@@ -49,7 +49,7 @@ buildProgram rs = do ...@@ -49,7 +49,7 @@ buildProgram rs = do
-- @llvm-passes@. -- @llvm-passes@.
need =<< ghcDeps stage need =<< ghcDeps stage
cross <- crossCompiling cross <- flag CrossCompiling
-- For cross compiler, copy @stage0/bin/<pgm>@ to @stage1/bin/@. -- For cross compiler, copy @stage0/bin/<pgm>@ to @stage1/bin/@.
case (cross, stage) of case (cross, stage) of
(True, s) | s > Stage0 -> do (True, s) | s > Stage0 -> do
......
...@@ -25,7 +25,8 @@ ghcCabalBuilderArgs = mconcat ...@@ -25,7 +25,8 @@ ghcCabalBuilderArgs = mconcat
-- stripping as well. As it is now, I believe we might have issues with stripping on -- stripping as well. As it is now, I believe we might have issues with stripping on
-- windows, as I can't see a consumer of `stripCmdPath`. -- windows, as I can't see a consumer of `stripCmdPath`.
-- TODO: See https://github.com/snowleopard/hadrian/issues/549. -- TODO: See https://github.com/snowleopard/hadrian/issues/549.
, crossCompiling ? pure [ "--disable-executable-stripping", "--disable-library-stripping" ] , flag CrossCompiling ? pure [ "--disable-executable-stripping"
, "--disable-library-stripping" ]
, arg "--cabal-file" , arg "--cabal-file"
, arg =<< fromJust . pkgCabalFile <$> getPackage , arg =<< fromJust . pkgCabalFile <$> getPackage
, arg "--distdir" , arg "--distdir"
...@@ -103,7 +104,7 @@ configureArgs = do ...@@ -103,7 +104,7 @@ configureArgs = do
, conf "--with-gmp-includes" $ arg =<< getSetting GmpIncludeDir , conf "--with-gmp-includes" $ arg =<< getSetting GmpIncludeDir
, conf "--with-gmp-libraries" $ arg =<< getSetting GmpLibDir , conf "--with-gmp-libraries" $ arg =<< getSetting GmpLibDir
, conf "--with-curses-libraries" $ arg =<< getSetting CursesLibDir , conf "--with-curses-libraries" $ arg =<< getSetting CursesLibDir
, crossCompiling ? (conf "--host" $ arg =<< getSetting TargetPlatformFull) , flag CrossCompiling ? (conf "--host" $ arg =<< getSetting TargetPlatformFull)
, conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage , conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage
, notStage0 ? (arg =<< ("--ghc-option=-ghcversion-file=" ++) <$> expr ((-/-) <$> topDirectory <*> ghcVersionH))] , notStage0 ? (arg =<< ("--ghc-option=-ghcversion-file=" ++) <$> expr ((-/-) <$> topDirectory <*> ghcVersionH))]
......
...@@ -22,11 +22,11 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do ...@@ -22,11 +22,11 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do
tmpl <- (top -/-) <$> expr (templateHscPath Stage0) tmpl <- (top -/-) <$> expr (templateHscPath Stage0)
mconcat [ arg $ "--cc=" ++ ccPath mconcat [ arg $ "--cc=" ++ ccPath
, arg $ "--ld=" ++ ccPath , arg $ "--ld=" ++ ccPath
, notM windowsHost ? notM crossCompiling ? arg "--cross-safe" , notM windowsHost ? notM (flag CrossCompiling) ? arg "--cross-safe"
, pure $ map ("-I" ++) (words gmpDir) , pure $ map ("-I" ++) (words gmpDir)
, map ("--cflag=" ++) <$> getCFlags , map ("--cflag=" ++) <$> getCFlags
, map ("--lflag=" ++) <$> getLFlags , map ("--lflag=" ++) <$> getLFlags
, notStage0 ? crossCompiling ? arg "--cross-compile" , notStage0 ? flag CrossCompiling ? arg "--cross-compile"
, stage0 ? arg ("--cflag=-D" ++ hArch ++ "_HOST_ARCH=1") , stage0 ? arg ("--cflag=-D" ++ hArch ++ "_HOST_ARCH=1")
, stage0 ? arg ("--cflag=-D" ++ hOs ++ "_HOST_OS=1" ) , stage0 ? arg ("--cflag=-D" ++ hOs ++ "_HOST_OS=1" )
, notStage0 ? arg ("--cflag=-D" ++ tArch ++ "_HOST_ARCH=1") , notStage0 ? arg ("--cflag=-D" ++ tArch ++ "_HOST_ARCH=1")
......
...@@ -21,7 +21,7 @@ runTestBuilderArgs = builder RunTest ? do ...@@ -21,7 +21,7 @@ runTestBuilderArgs = builder RunTest ? do
withNativeCodeGen <- expr ghcWithNativeCodeGen withNativeCodeGen <- expr ghcWithNativeCodeGen
withInterpreter <- expr ghcWithInterpreter withInterpreter <- expr ghcWithInterpreter
unregisterised <- expr $ flag GhcUnregisterised unregisterised <- getFlag GhcUnregisterised
withSMP <- expr ghcWithSMP withSMP <- expr ghcWithSMP
windows <- expr windowsHost windows <- expr windowsHost
...@@ -78,8 +78,8 @@ runTestBuilderArgs = builder RunTest ? do ...@@ -78,8 +78,8 @@ runTestBuilderArgs = builder RunTest ? do
, arg "-e", arg $ "config.wordsize=\"64\"" , arg "-e", arg $ "config.wordsize=\"64\""
, arg "-e", arg $ "config.os=" ++ show os , arg "-e", arg $ "config.os=" ++ show os
, arg "-e", arg $ "config.arch=" ++ show arch , arg "-e", arg $ "config.arch=" ++ show arch
, arg "-e", arg $ "config.platform=" ++ show platform , arg "-e", arg $ "config.platform=" ++ show platform
, arg "--config-file=testsuite/config/ghc" , arg "--config-file=testsuite/config/ghc"
, arg "--config", arg $ "compiler=" ++ show (top -/- compiler) , arg "--config", arg $ "compiler=" ++ show (top -/- compiler)
, arg "--config", arg $ "ghc_pkg=" ++ show (top -/- ghcPkg) , arg "--config", arg $ "ghc_pkg=" ++ show (top -/- ghcPkg)
...@@ -117,11 +117,11 @@ getTestArgs = do ...@@ -117,11 +117,11 @@ getTestArgs = do
verbosityArg = case testVerbosity args of verbosityArg = case testVerbosity args of
Nothing -> Nothing Nothing -> Nothing
Just verbosity -> Just $ "--verbose=" ++ verbosity Just verbosity -> Just $ "--verbose=" ++ verbosity
wayArgs = map ("--way=" ++) (testWays args) wayArgs = map ("--way=" ++) (testWays args)
pure $ testOnlyArg pure $ testOnlyArg
++ speedArg ++ speedArg
++ catMaybes [ onlyPerfArg, skipPerfArg, summaryArg ++ catMaybes [ onlyPerfArg, skipPerfArg, summaryArg
, junitArg, verbosityArg ] , junitArg, verbosityArg ]
++ configArgs ++ configArgs
++ wayArgs ++ wayArgs
......
...@@ -8,118 +8,155 @@ import Oracles.Flag ...@@ -8,118 +8,155 @@ import Oracles.Flag
import Rules.Gmp import Rules.Gmp
import Settings import Settings
-- TODO: Finish migration of package-specific settings into a single file.
packageArgs :: Args packageArgs :: Args
packageArgs = do packageArgs = do
intLibPkg <- getIntegerPackage intLib <- getIntegerPackage
integerLibraryName <- pkgName <$> getIntegerPackage stage <- getStage
rtsWays <- getRtsWays
stage <- getStage path <- getBuildPath
rtsWays <- getRtsWays compilerBuildPath <- expr $ buildPath (vanillaContext stage compiler)
path <- getBuildPath gmpBuildPath <- expr gmpBuildPath
compilerBuildPath <- expr $ buildPath (vanillaContext stage compiler) let includeGmp = "-I" ++ gmpBuildPath -/- "include"
gmpBuildPath <- expr gmpBuildPath mconcat
let includeGmp = "-I" ++ gmpBuildPath -/- "include" --------------------------------- base ---------------------------------
[ package base ? mconcat
mconcat [ builder CabalFlags ? arg ('+' : pkgName intLib)
[ package base
? mconcat [ builder CabalFlags ? arg ('+':integerLibraryName) -- This fixes the 'unknown symbol stat' issue.
-- This fixes the 'unknown symbol stat' issue. -- See: https://github.com/snowleopard/hadrian/issues/259.
-- See: https://github.com/snowleopard/hadrian/issues/259. , builder (Ghc CompileCWithGhc) ? arg "-optc-O2" ]
, builder (Ghc CompileCWithGhc) ? arg "-optc-O2" ]
, package bytestring ------------------------------ bytestring ------------------------------
? builder CabalFlags ? intLibPkg == integerSimple ? arg "integer-simple" , package bytestring ?
, package text