Commit e37a5f77 authored by Andrey Mokhov's avatar Andrey Mokhov

Drop append, simplify

parent 65c5d7c6
...@@ -3,7 +3,7 @@ module Expression ( ...@@ -3,7 +3,7 @@ module Expression (
Expr, Predicate, Args, Ways, Packages, Expr, Predicate, Args, Ways, Packages,
-- ** Construction and modification -- ** Construction and modification
expr, exprIO, append, arg, remove, expr, exprIO, arg, remove,
-- ** Predicates -- ** Predicates
(?), stage, stage0, stage1, stage2, notStage0, package, notPackage, (?), stage, stage0, stage1, stage2, notStage0, package, notPackage,
...@@ -17,7 +17,7 @@ module Expression ( ...@@ -17,7 +17,7 @@ module Expression (
-- * Convenient accessors -- * Convenient accessors
getContext, getStage, getPackage, getBuilder, getOutputs, getInputs, getWay, getContext, getStage, getPackage, getBuilder, getOutputs, getInputs, getWay,
getInput, getOutput, getSetting, getSettingList, getFlag, getInput, getOutput, getSetting, getSettingList, getStagedSettingList, getFlag,
-- * Re-exports -- * Re-exports
module Data.Semigroup, module Data.Semigroup,
...@@ -57,16 +57,15 @@ type Ways = Expr [Way] ...@@ -57,16 +57,15 @@ type Ways = Expr [Way]
-- Basic operations on expressions: -- Basic operations on expressions:
-- | Append something to an expression.
append :: a -> Expr a
append = pure
getSetting :: Setting -> Expr String getSetting :: Setting -> Expr String
getSetting = expr . setting getSetting = expr . setting
getSettingList :: SettingList -> Expr [String] getSettingList :: SettingList -> Expr [String]
getSettingList = expr . settingList getSettingList = expr . settingList
getStagedSettingList :: (Stage -> SettingList) -> Expr [String]
getStagedSettingList f = getSettingList . f =<< getStage
getFlag :: Flag -> Predicate getFlag :: Flag -> Predicate
getFlag = expr . flag getFlag = expr . flag
...@@ -105,4 +104,3 @@ notPackage = notM . package ...@@ -105,4 +104,3 @@ notPackage = notM . package
-- | Is a library package currently being built? -- | Is a library package currently being built?
libraryPackage :: Predicate libraryPackage :: Predicate
libraryPackage = isLibrary <$> getPackage libraryPackage = isLibrary <$> getPackage
...@@ -140,4 +140,4 @@ output f = any (f ?==) <$> getOutputs ...@@ -140,4 +140,4 @@ output f = any (f ?==) <$> getOutputs
-- | Does any of the output files match any of the given patterns? -- | Does any of the output files match any of the given patterns?
outputs :: [FilePattern] -> Predicate c b outputs :: [FilePattern] -> Predicate c b
outputs = anyM output outputs = anyM output
\ No newline at end of file
...@@ -28,7 +28,7 @@ configureEnvironment :: Action [CmdOption] ...@@ -28,7 +28,7 @@ configureEnvironment :: Action [CmdOption]
configureEnvironment = do configureEnvironment = do
cFlags <- interpretInContext libffiContext $ mconcat cFlags <- interpretInContext libffiContext $ mconcat
[ cArgs [ cArgs
, argStagedSettingList ConfCcArgs ] , getStagedSettingList ConfCcArgs ]
ldFlags <- interpretInContext libffiContext ldArgs ldFlags <- interpretInContext libffiContext ldArgs
sequence [ builderEnvironment "CC" $ Cc CompileC Stage1 sequence [ builderEnvironment "CC" $ Cc CompileC Stage1
, builderEnvironment "CXX" $ Cc CompileC Stage1 , builderEnvironment "CXX" $ Cc CompileC Stage1
......
...@@ -5,7 +5,7 @@ import Settings.Builders.Common ...@@ -5,7 +5,7 @@ import Settings.Builders.Common
arBuilderArgs :: Args arBuilderArgs :: Args
arBuilderArgs = builder Ar ? mconcat [ arg "q" arBuilderArgs = builder Ar ? mconcat [ arg "q"
, arg =<< getOutput , arg =<< getOutput
, append =<< getInputs ] , getInputs ]
-- This count includes arg "q" and arg file parameters in arBuilderArgs. -- This count includes arg "q" and arg file parameters in arBuilderArgs.
-- Update this value appropriately when changing arBuilderArgs. -- Update this value appropriately when changing arBuilderArgs.
......
...@@ -6,13 +6,13 @@ ccBuilderArgs :: Args ...@@ -6,13 +6,13 @@ ccBuilderArgs :: Args
ccBuilderArgs = do ccBuilderArgs = do
way <- getWay way <- getWay
builder Cc ? mconcat builder Cc ? mconcat
[ append =<< getPkgDataList CcArgs [ getPkgDataList CcArgs
, getSettingList . ConfCcArgs =<< getStage , getStagedSettingList ConfCcArgs
, cIncludeArgs , cIncludeArgs
, builder (Cc CompileC) ? mconcat , builder (Cc CompileC) ? mconcat
[ arg "-Werror" [ arg "-Werror"
, Dynamic `wayUnit` way ? append [ "-fPIC", "-DDYNAMIC" ] , Dynamic `wayUnit` way ? pure [ "-fPIC", "-DDYNAMIC" ]
-- ref: mk/warning.mk: -- ref: mk/warning.mk:
-- SRC_CC_OPTS += -Wall $(WERROR) -- SRC_CC_OPTS += -Wall $(WERROR)
, arg "-c", arg =<< getInput , arg "-c", arg =<< getInput
......
...@@ -8,8 +8,7 @@ module Settings.Builders.Common ( ...@@ -8,8 +8,7 @@ module Settings.Builders.Common (
module Settings, module Settings,
module Settings.Path, module Settings.Path,
module UserSettings, module UserSettings,
cIncludeArgs, ldArgs, cArgs, cWarnings, argStagedBuilderPath, cIncludeArgs, ldArgs, cArgs, cWarnings, bootPackageDatabaseArgs
argStagedSettingList, bootPackageDatabaseArgs
) where ) where
import Base import Base
...@@ -31,8 +30,8 @@ cIncludeArgs = do ...@@ -31,8 +30,8 @@ cIncludeArgs = do
mconcat [ arg "-Iincludes" mconcat [ arg "-Iincludes"
, arg $ "-I" ++ generatedPath , arg $ "-I" ++ generatedPath
, arg $ "-I" ++ path , arg $ "-I" ++ path
, append [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ] , pure [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ]
, append [ "-I" ++ unifyPath dir | dir <- depDirs ] ] , pure [ "-I" ++ unifyPath dir | dir <- depDirs ] ]
ldArgs :: Args ldArgs :: Args
ldArgs = mempty ldArgs = mempty
...@@ -49,18 +48,6 @@ cWarnings = do ...@@ -49,18 +48,6 @@ cWarnings = do
, gccGe46 ? notM windowsHost ? arg "-Werror=unused-but-set-variable" , gccGe46 ? notM windowsHost ? arg "-Werror=unused-but-set-variable"
, gccGe46 ? arg "-Wno-error=inline" ] , gccGe46 ? arg "-Wno-error=inline" ]
argSettingList :: SettingList -> Args
argSettingList = (append =<<) . getSettingList
argStagedSettingList :: (Stage -> SettingList) -> Args
argStagedSettingList ss = argSettingList . ss =<< getStage
argStagedBuilderPath :: (Stage -> Builder) -> Args
argStagedBuilderPath sb = do
stage <- getStage
path <- expr $ builderPath (sb stage)
arg path
bootPackageDatabaseArgs :: Args bootPackageDatabaseArgs :: Args
bootPackageDatabaseArgs = do bootPackageDatabaseArgs = do
stage <- getStage stage <- getStage
......
...@@ -7,15 +7,15 @@ configureBuilderArgs = mconcat ...@@ -7,15 +7,15 @@ configureBuilderArgs = mconcat
[ builder (Configure gmpBuildPath) ? do [ builder (Configure gmpBuildPath) ? do
hostPlatform <- getSetting HostPlatform hostPlatform <- getSetting HostPlatform
buildPlatform <- getSetting BuildPlatform buildPlatform <- getSetting BuildPlatform
append [ "--enable-shared=no" pure [ "--enable-shared=no"
, "--host=" ++ hostPlatform , "--host=" ++ hostPlatform
, "--build=" ++ buildPlatform ] , "--build=" ++ buildPlatform ]
, builder (Configure libffiBuildPath) ? do , builder (Configure libffiBuildPath) ? do
top <- expr topDirectory top <- expr topDirectory
targetPlatform <- getSetting TargetPlatform targetPlatform <- getSetting TargetPlatform
append [ "--prefix=" ++ top -/- libffiBuildPath -/- "inst" pure [ "--prefix=" ++ top -/- libffiBuildPath -/- "inst"
, "--libdir=" ++ top -/- libffiBuildPath -/- "inst/lib" , "--libdir=" ++ top -/- libffiBuildPath -/- "inst/lib"
, "--enable-static=yes" , "--enable-static=yes"
, "--enable-shared=no" -- TODO: add support for yes , "--enable-shared=no" -- TODO: add support for yes
, "--host=" ++ targetPlatform ] ] , "--host=" ++ targetPlatform ] ]
...@@ -16,11 +16,11 @@ deriveConstantsBuilderArgs = builder DeriveConstants ? do ...@@ -16,11 +16,11 @@ deriveConstantsBuilderArgs = builder DeriveConstants ? do
, arg "-o", arg outputFile , arg "-o", arg outputFile
, arg "--tmpdir", arg tempDir , arg "--tmpdir", arg tempDir
, arg "--gcc-program", arg =<< getBuilderPath (Cc CompileC Stage1) , arg "--gcc-program", arg =<< getBuilderPath (Cc CompileC Stage1)
, append $ concatMap (\a -> ["--gcc-flag", a]) cFlags , pure $ concatMap (\a -> ["--gcc-flag", a]) cFlags
, arg "--nm-program", arg =<< getBuilderPath Nm , arg "--nm-program", arg =<< getBuilderPath Nm
, isSpecified Objdump ? mconcat [ arg "--objdump-program" , isSpecified Objdump ? mconcat [ arg "--objdump-program"
, arg =<< getBuilderPath Objdump ] , arg =<< getBuilderPath Objdump ]
, arg "--target-os", return <$> getSetting TargetOs ] , arg "--target-os", arg =<< getSetting TargetOs ]
includeCcArgs :: Args includeCcArgs :: Args
includeCcArgs = mconcat includeCcArgs = mconcat
......
...@@ -15,25 +15,25 @@ ghcBuilderArgs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do ...@@ -15,25 +15,25 @@ ghcBuilderArgs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do
, splitObjectsArgs , splitObjectsArgs
, ghcLinkArgs , ghcLinkArgs
, builder (Ghc CompileHs) ? arg "-c" , builder (Ghc CompileHs) ? arg "-c"
, append =<< getInputs , getInputs
, arg "-o", arg =<< getOutput ] , arg "-o", arg =<< getOutput ]
ghcCbuilderArgs :: Args ghcCbuilderArgs :: Args
ghcCbuilderArgs = ghcCbuilderArgs =
builder (Ghc CompileCWithGhc) ? do builder (Ghc CompileCWithGhc) ? do
way <- getWay way <- getWay
let ccArgs = [ append =<< getPkgDataList CcArgs let ccArgs = [ getPkgDataList CcArgs
, getSettingList . ConfCcArgs =<< getStage , getStagedSettingList ConfCcArgs
, cIncludeArgs , cIncludeArgs
, arg "-Werror" , arg "-Werror"
, Dynamic `wayUnit` way ? append [ "-fPIC", "-DDYNAMIC" ] ] , Dynamic `wayUnit` way ? pure [ "-fPIC", "-DDYNAMIC" ] ]
mconcat [ arg "-Wall" mconcat [ arg "-Wall"
, ghcLinkArgs , ghcLinkArgs
, commonGhcArgs , commonGhcArgs
, mconcat (map (map ("-optc" ++) <$>) ccArgs) , mconcat (map (map ("-optc" ++) <$>) ccArgs)
, arg "-c" , arg "-c"
, append =<< getInputs , getInputs
, arg "-o" , arg "-o"
, arg =<< getOutput ] , arg =<< getOutput ]
...@@ -51,12 +51,12 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do ...@@ -51,12 +51,12 @@ ghcLinkArgs = builder (Ghc LinkHs) ? do
return $ concatMap (words . strip) buildInfo return $ concatMap (words . strip) buildInfo
else return [] else return []
mconcat [ (Dynamic `wayUnit` way) ? mconcat [ (Dynamic `wayUnit` way) ?
append [ "-shared", "-dynamic", "-dynload", "deploy" ] pure [ "-shared", "-dynamic", "-dynload", "deploy" ]
, arg "-no-auto-link-packages" , arg "-no-auto-link-packages"
, nonHsMainPackage pkg ? arg "-no-hs-main" , nonHsMainPackage pkg ? arg "-no-hs-main"
, not (nonHsMainPackage pkg) ? arg "-rtsopts" , not (nonHsMainPackage pkg) ? arg "-rtsopts"
, append [ "-optl-l" ++ lib | lib <- libs ++ gmpLibs ] , pure [ "-optl-l" ++ lib | lib <- libs ++ gmpLibs ]
, append [ "-optl-L" ++ unifyPath dir | dir <- libDirs ] ] , pure [ "-optl-L" ++ unifyPath dir | dir <- libDirs ] ]
needTouchy :: Expr () needTouchy :: Expr ()
needTouchy = notStage0 ? do needTouchy = notStage0 ? do
...@@ -75,29 +75,26 @@ ghcMBuilderArgs = builder (Ghc FindHsDependencies) ? do ...@@ -75,29 +75,26 @@ ghcMBuilderArgs = builder (Ghc FindHsDependencies) ? do
, commonGhcArgs , commonGhcArgs
, arg "-include-pkg-deps" , arg "-include-pkg-deps"
, arg "-dep-makefile", arg =<< getOutput , arg "-dep-makefile", arg =<< getOutput
, append $ concat [ ["-dep-suffix", wayPrefix w] | w <- ways ] , pure $ concat [ ["-dep-suffix", wayPrefix w] | w <- ways ]
, append =<< getInputs ] , getInputs ]
haddockGhcArgs :: Args haddockGhcArgs :: Args
haddockGhcArgs = mconcat [ commonGhcArgs, append =<< getPkgDataList HsArgs ] haddockGhcArgs = mconcat [ commonGhcArgs, getPkgDataList HsArgs ]
-- This is included into ghcBuilderArgs, ghcMBuilderArgs and haddockGhcArgs. -- This is included into ghcBuilderArgs, ghcMBuilderArgs and haddockGhcArgs.
commonGhcArgs :: Args commonGhcArgs :: Args
commonGhcArgs = do commonGhcArgs = do
way <- getWay way <- getWay
path <- getBuildPath path <- getBuildPath
confCc <- getSettingList . ConfCcArgs =<< getStage
confCpp <- getSettingList . ConfCppArgs =<< getStage
cppArgs <- getPkgDataList CppArgs
mconcat [ arg "-hisuf", arg $ hisuf way mconcat [ arg "-hisuf", arg $ hisuf way
, arg "-osuf" , arg $ osuf way , arg "-osuf" , arg $ osuf way
, arg "-hcsuf", arg $ hcsuf way , arg "-hcsuf", arg $ hcsuf way
, wayGhcArgs , wayGhcArgs
, packageGhcArgs , packageGhcArgs
, includeGhcArgs , includeGhcArgs
, append $ map ("-optc" ++) confCc , map ("-optc" ++) <$> getStagedSettingList ConfCcArgs
, append $ map ("-optP" ++) confCpp , map ("-optP" ++) <$> getStagedSettingList ConfCppArgs
, append $ map ("-optP" ++) cppArgs , map ("-optP" ++) <$> getPkgDataList CppArgs
, arg "-odir" , arg path , arg "-odir" , arg path
, arg "-hidir" , arg path , arg "-hidir" , arg path
, arg "-stubdir" , arg path ] , arg "-stubdir" , arg path ]
...@@ -107,20 +104,19 @@ wayGhcArgs :: Args ...@@ -107,20 +104,19 @@ wayGhcArgs :: Args
wayGhcArgs = do wayGhcArgs = do
way <- getWay way <- getWay
mconcat [ if (Dynamic `wayUnit` way) mconcat [ if (Dynamic `wayUnit` way)
then append ["-fPIC", "-dynamic"] then pure ["-fPIC", "-dynamic"]
else arg "-static" else arg "-static"
, (Threaded `wayUnit` way) ? arg "-optc-DTHREADED_RTS" , (Threaded `wayUnit` way) ? arg "-optc-DTHREADED_RTS"
, (Debug `wayUnit` way) ? arg "-optc-DDEBUG" , (Debug `wayUnit` way) ? arg "-optc-DDEBUG"
, (Profiling `wayUnit` way) ? arg "-prof" , (Profiling `wayUnit` way) ? arg "-prof"
, (Logging `wayUnit` way) ? arg "-eventlog" , (Logging `wayUnit` way) ? arg "-eventlog"
, (way == debug || way == debugDynamic) ? , (way == debug || way == debugDynamic) ?
append ["-ticky", "-DTICKY_TICKY"] ] pure ["-ticky", "-DTICKY_TICKY"] ]
-- FIXME: Get rid of to-be-deprecated -this-package-key.
packageGhcArgs :: Args packageGhcArgs :: Args
packageGhcArgs = do packageGhcArgs = do
compId <- getPkgData ComponentId compId <- getPkgData ComponentId
pkgDepIds <- getPkgDataList DepIds
-- FIXME: Get rid of to-be-deprecated -this-package-key.
thisArg <- do thisArg <- do
not0 <- notStage0 not0 <- notStage0
unit <- getFlag SupportsThisUnitId unit <- getFlag SupportsThisUnitId
...@@ -129,7 +125,7 @@ packageGhcArgs = do ...@@ -129,7 +125,7 @@ packageGhcArgs = do
, arg "-no-user-package-db" , arg "-no-user-package-db"
, bootPackageDatabaseArgs , bootPackageDatabaseArgs
, libraryPackage ? arg (thisArg ++ compId) , libraryPackage ? arg (thisArg ++ compId)
, append $ map ("-package-id " ++) pkgDepIds ] , map ("-package-id " ++) <$> getPkgDataList DepIds ]
includeGhcArgs :: Args includeGhcArgs :: Args
includeGhcArgs = do includeGhcArgs = do
...@@ -140,10 +136,10 @@ includeGhcArgs = do ...@@ -140,10 +136,10 @@ includeGhcArgs = do
mconcat [ arg "-i" mconcat [ arg "-i"
, arg $ "-i" ++ path , arg $ "-i" ++ path
, arg $ "-i" ++ autogenPath context , arg $ "-i" ++ autogenPath context
, append [ "-i" ++ pkgPath pkg -/- dir | dir <- srcDirs ] , pure [ "-i" ++ pkgPath pkg -/- dir | dir <- srcDirs ]
, cIncludeArgs , cIncludeArgs
, arg $ "-I" ++ generatedPath , arg $ "-I" ++ generatedPath
, arg $ "-optc-I" ++ generatedPath , arg $ "-optc-I" ++ generatedPath
, (not $ nonCabalContext context) ? , (not $ nonCabalContext context) ?
append [ "-optP-include" pure [ "-optP-include"
, "-optP" ++ autogenPath context -/- "cabal_macros.h" ] ] , "-optP" ++ autogenPath context -/- "cabal_macros.h" ] ]
...@@ -29,7 +29,7 @@ ghcCabalBuilderArgs = builder GhcCabal ? do ...@@ -29,7 +29,7 @@ ghcCabalBuilderArgs = builder GhcCabal ? do
, withStaged Ar , withStaged Ar
, with Alex , with Alex
, with Happy , with Happy
, verbosity < Chatty ? append [ "-v0", "--configure-option=--quiet" , verbosity < Chatty ? pure [ "-v0", "--configure-option=--quiet"
, "--configure-option=--disable-option-checking" ] ] , "--configure-option=--disable-option-checking" ] ]
ghcCabalHsColourBuilderArgs :: Args ghcCabalHsColourBuilderArgs :: Args
...@@ -37,7 +37,7 @@ ghcCabalHsColourBuilderArgs = builder GhcCabalHsColour ? do ...@@ -37,7 +37,7 @@ ghcCabalHsColourBuilderArgs = builder GhcCabalHsColour ? do
path <- getPackagePath path <- getPackagePath
top <- expr topDirectory top <- expr topDirectory
context <- getContext context <- getContext
append [ "hscolour", path, top -/- buildPath context ] pure [ "hscolour", path, top -/- buildPath context ]
-- TODO: Isn't vanilla always built? If yes, some conditions are redundant. -- TODO: Isn't vanilla always built? If yes, some conditions are redundant.
-- TODO: Need compiler_stage1_CONFIGURE_OPTS += --disable-library-for-ghci? -- TODO: Need compiler_stage1_CONFIGURE_OPTS += --disable-library-for-ghci?
...@@ -45,18 +45,18 @@ libraryArgs :: Args ...@@ -45,18 +45,18 @@ libraryArgs :: Args
libraryArgs = do libraryArgs = do
ways <- getLibraryWays ways <- getLibraryWays
withGhci <- expr ghcWithInterpreter withGhci <- expr ghcWithInterpreter
append [ if vanilla `elem` ways pure [ if vanilla `elem` ways
then "--enable-library-vanilla" then "--enable-library-vanilla"
else "--disable-library-vanilla" else "--disable-library-vanilla"
, if vanilla `elem` ways && withGhci && not (dynamicGhcPrograms flavour) , if vanilla `elem` ways && withGhci && not (dynamicGhcPrograms flavour)
then "--enable-library-for-ghci" then "--enable-library-for-ghci"
else "--disable-library-for-ghci" else "--disable-library-for-ghci"
, if profiling `elem` ways , if profiling `elem` ways
then "--enable-library-profiling" then "--enable-library-profiling"
else "--disable-library-profiling" else "--disable-library-profiling"
, if dynamic `elem` ways , if dynamic `elem` ways
then "--enable-shared" then "--enable-shared"
else "--disable-shared" ] else "--disable-shared" ]
-- TODO: LD_OPTS? -- TODO: LD_OPTS?
configureArgs :: Args configureArgs :: Args
...@@ -67,28 +67,28 @@ configureArgs = do ...@@ -67,28 +67,28 @@ configureArgs = do
not (null values) ? not (null values) ?
arg ("--configure-option=" ++ key ++ "=" ++ values) arg ("--configure-option=" ++ key ++ "=" ++ values)
cFlags = mconcat [ remove ["-Werror"] cArgs cFlags = mconcat [ remove ["-Werror"] cArgs
, argStagedSettingList ConfCcArgs , getStagedSettingList ConfCcArgs
, arg $ "-I" ++ top -/- generatedPath ] , arg $ "-I" ++ top -/- generatedPath ]
ldFlags = ldArgs <> (argStagedSettingList ConfGccLinkerArgs) ldFlags = ldArgs <> (getStagedSettingList ConfGccLinkerArgs)
cppFlags = cppArgs <> (argStagedSettingList ConfCppArgs) cppFlags = cppArgs <> (getStagedSettingList ConfCppArgs)
cldFlags <- unwords <$> (cFlags <> ldFlags) cldFlags <- unwords <$> (cFlags <> ldFlags)
mconcat mconcat
[ conf "CFLAGS" cFlags [ conf "CFLAGS" cFlags
, conf "LDFLAGS" ldFlags , conf "LDFLAGS" ldFlags
, conf "CPPFLAGS" cppFlags , conf "CPPFLAGS" cppFlags
, not (null cldFlags) ? arg ("--gcc-options=" ++ cldFlags) , not (null cldFlags) ? arg ("--gcc-options=" ++ cldFlags)
, conf "--with-iconv-includes" $ return <$> getSetting IconvIncludeDir , conf "--with-iconv-includes" $ arg =<< getSetting IconvIncludeDir
, conf "--with-iconv-libraries" $ return <$> getSetting IconvLibDir , conf "--with-iconv-libraries" $ arg =<< getSetting IconvLibDir
, conf "--with-gmp-includes" $ return <$> getSetting GmpIncludeDir , conf "--with-gmp-includes" $ arg =<< getSetting GmpIncludeDir
, conf "--with-gmp-libraries" $ return <$> getSetting GmpLibDir , conf "--with-gmp-libraries" $ arg =<< getSetting GmpLibDir
, conf "--with-curses-libraries" $ return <$> getSetting CursesLibDir , conf "--with-curses-libraries" $ arg =<< getSetting CursesLibDir
, crossCompiling ? (conf "--host" $ return <$> getSetting TargetPlatformFull) , crossCompiling ? (conf "--host" $ arg =<< getSetting TargetPlatformFull)
, conf "--with-cc" $ argStagedBuilderPath (Cc CompileC) ] , conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage ]
packageConstraints :: Args packageConstraints :: Args
packageConstraints = stage0 ? do packageConstraints = stage0 ? do
constraints <- expr . readFileLines $ bootPackageConstraints constraints <- expr . readFileLines $ bootPackageConstraints
append $ concat [ ["--constraint", c] | c <- constraints ] pure $ concat [ ["--constraint", c] | c <- constraints ]
cppArgs :: Args cppArgs :: Args
cppArgs = arg $ "-I" ++ generatedPath cppArgs = arg $ "-I" ++ generatedPath
......
...@@ -32,18 +32,18 @@ haddockBuilderArgs = builder Haddock ? do ...@@ -32,18 +32,18 @@ haddockBuilderArgs = builder Haddock ? do
, arg $ "--title=" ++ pkgNameString pkg ++ "-" ++ version ++ ": " ++ synopsis , arg $ "--title=" ++ pkgNameString pkg ++ "-" ++ version ++ ": " ++ synopsis
, arg $ "--prologue=" ++ path -/- "haddock-prologue.txt" , arg $ "--prologue=" ++ path -/- "haddock-prologue.txt"
, arg $ "--optghc=-D__HADDOCK_VERSION__=" ++ show (versionToInt hVersion) , arg $ "--optghc=-D__HADDOCK_VERSION__=" ++ show (versionToInt hVersion)
, append . map ("--hide=" ++) =<< getPkgDataList HiddenModules , map ("--hide=" ++) <$> getPkgDataList HiddenModules
, append $ [ "--read-interface=../" ++ dep , pure [ "--read-interface=../" ++ dep
++ ",../" ++ dep ++ "/src/%{MODULE/./-}.html\\#%{NAME}," ++ ",../" ++ dep ++ "/src/%{MODULE/./-}.html\\#%{NAME},"
++ pkgHaddockFile (vanillaContext Stage1 depPkg) ++ pkgHaddockFile (vanillaContext Stage1 depPkg)
| (dep, depName) <- zip deps depNames | (dep, depName) <- zip deps depNames
, Just depPkg <- [findKnownPackage $ PackageName depName] , Just depPkg <- [findKnownPackage $ PackageName depName]
, depPkg /= rts ] , depPkg /= rts ]
, append [ "--optghc=" ++ opt | opt <- ghcOpts ] , pure [ "--optghc=" ++ opt | opt <- ghcOpts ]
, isSpecified HsColour ? , isSpecified HsColour ?
append [ "--source-module=src/%{MODULE/./-}.html" pure [ "--source-module=src/%{MODULE/./-}.html"
, "--source-entity=src/%{MODULE/./-}.html\\#%{NAME}" ] , "--source-entity=src/%{MODULE/./-}.html\\#%{NAME}" ]
, append =<< getInputs , getInputs
, arg "+RTS" , arg "+RTS"
, arg $ "-t" ++ path -/- "haddock.t" , arg $ "-t" ++ path -/- "haddock.t"
, arg "--machine-readable" , arg "--machine-readable"
......
...@@ -7,8 +7,6 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do ...@@ -7,8 +7,6 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do
stage <- getStage stage <- getStage
ccPath <- getBuilderPath $ Cc CompileC stage ccPath <- getBuilderPath $ Cc CompileC stage
gmpDir <- getSetting GmpIncludeDir gmpDir <- getSetting GmpIncludeDir
cFlags <- getCFlags
lFlags <- getLFlags
top <- expr topDirectory top <- expr topDirectory
hArch <- getSetting HostArch hArch <- getSetting HostArch
hOs <- getSetting HostOs hOs <- getSetting HostOs
...@@ -20,9 +18,9 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do ...@@ -20,9 +18,9 @@ hsc2hsBuilderArgs = builder Hsc2Hs ? do
mconcat [ arg $ "--cc=" ++ ccPath mconcat [ arg $ "--cc=" ++ ccPath
, arg $ "--ld=" ++ ccPath , arg $ "--ld=" ++ ccPath
, notM windowsHost ? arg "--cross-safe" , notM windowsHost ? arg "--cross-safe"
, append . map ("-I" ++) $ words gmpDir , pure $ map ("-I" ++) (words gmpDir)
, append $ map ("--cflag=" ++) cFlags , map ("--cflag=" ++) <$> getCFlags
, append $ map ("--lflag=" ++) lFlags , map ("--lflag=" ++) <$> getLFlags