diff options
Diffstat (limited to 'hadrian/src/Settings')
38 files changed, 0 insertions, 1424 deletions
diff --git a/hadrian/src/Settings/Builders/Alex.hs b/hadrian/src/Settings/Builders/Alex.hs deleted file mode 100644 index e0ef1367f7..0000000000 --- a/hadrian/src/Settings/Builders/Alex.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Settings.Builders.Alex (alexBuilderArgs) where - -import Settings.Builders.Common - -alexBuilderArgs :: Args -alexBuilderArgs = builder Alex ? mconcat [ arg "-g" - , arg =<< getInput - , arg "-o", arg =<< getOutput ] diff --git a/hadrian/src/Settings/Builders/Cc.hs b/hadrian/src/Settings/Builders/Cc.hs deleted file mode 100644 index 70d043f76d..0000000000 --- a/hadrian/src/Settings/Builders/Cc.hs +++ /dev/null @@ -1,26 +0,0 @@ -module Settings.Builders.Cc (ccBuilderArgs) where - -import Settings.Builders.Common - -ccBuilderArgs :: Args -ccBuilderArgs = do - way <- getWay - builder Cc ? mconcat - [ getPkgDataList CcArgs - , getStagedSettingList ConfCcArgs - , cIncludeArgs - - , builder (Cc CompileC) ? mconcat - [ pure ["-Wall", "-Werror"] - , Dynamic `wayUnit` way ? pure [ "-fPIC", "-DDYNAMIC" ] - , arg "-c", arg =<< getInput - , arg "-o", arg =<< getOutput ] - - , builder (Cc FindCDependencies) ? do - output <- getOutput - mconcat [ arg "-E" - , arg "-MM", arg "-MG" - , arg "-MF", arg output - , arg "-MT", arg $ dropExtension output -<.> "o" - , arg "-x", arg "c" - , arg =<< getInput ] ] diff --git a/hadrian/src/Settings/Builders/Common.hs b/hadrian/src/Settings/Builders/Common.hs deleted file mode 100644 index 340239acd6..0000000000 --- a/hadrian/src/Settings/Builders/Common.hs +++ /dev/null @@ -1,58 +0,0 @@ -module Settings.Builders.Common ( - module Base, - module Expression, - module Oracles.Flag, - module Oracles.PackageData, - module Oracles.Setting, - module Settings, - module UserSettings, - cIncludeArgs, ldArgs, cArgs, cWarnings, bootPackageDatabaseArgs - ) where - -import Base -import Expression -import Oracles.Flag -import Oracles.PackageData -import Oracles.Setting -import Settings -import UserSettings - -cIncludeArgs :: Args -cIncludeArgs = do - pkg <- getPackage - root <- getBuildRoot - path <- getBuildPath - incDirs <- getPkgDataList IncludeDirs - depDirs <- getPkgDataList DepIncludeDirs - cross <- expr crossCompiling - compilerOrGhc <- package compiler ||^ package ghc - mconcat [ not (cross && compilerOrGhc) ? arg "-Iincludes" - , arg $ "-I" ++ root -/- generatedDir - , arg $ "-I" ++ path - , pure [ "-I" ++ pkgPath pkg -/- dir | dir <- incDirs ] - , pure [ "-I" ++ unifyPath dir | dir <- depDirs ] ] - -ldArgs :: Args -ldArgs = mempty - -cArgs :: Args -cArgs = mempty - --- TODO: should be in a different file -cWarnings :: Args -cWarnings = - mconcat [ arg "-Wall" - , flag GccIsClang ? arg "-Wno-unknown-pragmas" - , notM (flag GccIsClang) ? notM windowsHost ? arg "-Werror=unused-but-set-variable" - , notM (flag GccIsClang) ? arg "-Wno-error=inline" ] - -bootPackageDatabaseArgs :: Args -bootPackageDatabaseArgs = do - stage <- getStage - dbPath <- expr $ packageDbPath stage - expr $ need [dbPath -/- packageDbStamp] - stage0 ? do - top <- expr topDirectory - root <- getBuildRoot - prefix <- ifM (builder Ghc) (return "-package-db ") (return "--package-db=") - arg $ prefix ++ top -/- root -/- stage0PackageDbDir diff --git a/hadrian/src/Settings/Builders/Configure.hs b/hadrian/src/Settings/Builders/Configure.hs deleted file mode 100644 index 93225b5405..0000000000 --- a/hadrian/src/Settings/Builders/Configure.hs +++ /dev/null @@ -1,25 +0,0 @@ -module Settings.Builders.Configure (configureBuilderArgs) where - -import Rules.Gmp -import Rules.Libffi -import Settings.Builders.Common - -configureBuilderArgs :: Args -configureBuilderArgs = do - gmpPath <- expr gmpBuildPath - libffiPath <- expr libffiBuildPath - mconcat [ builder (Configure gmpPath) ? do - hostPlatform <- getSetting HostPlatform - buildPlatform <- getSetting BuildPlatform - pure [ "--enable-shared=no" - , "--host=" ++ hostPlatform - , "--build=" ++ buildPlatform ] - - , builder (Configure libffiPath) ? do - top <- expr topDirectory - targetPlatform <- getSetting TargetPlatform - pure [ "--prefix=" ++ top -/- libffiPath -/- "inst" - , "--libdir=" ++ top -/- libffiPath -/- "inst/lib" - , "--enable-static=yes" - , "--enable-shared=no" -- TODO: add support for yes - , "--host=" ++ targetPlatform ] ] diff --git a/hadrian/src/Settings/Builders/DeriveConstants.hs b/hadrian/src/Settings/Builders/DeriveConstants.hs deleted file mode 100644 index 7a6e863e9c..0000000000 --- a/hadrian/src/Settings/Builders/DeriveConstants.hs +++ /dev/null @@ -1,39 +0,0 @@ -module Settings.Builders.DeriveConstants (deriveConstantsBuilderArgs) where - -import Settings.Builders.Common - --- TODO: do we need to support `includes_CC_OPTS += -DDYNAMIC_BY_DEFAULT`? -deriveConstantsBuilderArgs :: Args -deriveConstantsBuilderArgs = builder DeriveConstants ? do - cFlags <- includeCcArgs - outs <- getOutputs - let (outputFile, tempDir) = case outs of - [a, b] -> (a, b) - _ -> error $ "DeriveConstants: expected two outputs, got " ++ show outs - mconcat - [ output "//DerivedConstants.h" ? arg "--gen-header" - , output "//GHCConstantsHaskellType.hs" ? arg "--gen-haskell-type" - , output "//platformConstants" ? arg "--gen-haskell-value" - , output "//GHCConstantsHaskellWrappers.hs" ? arg "--gen-haskell-wrappers" - , output "//GHCConstantsHaskellExports.hs" ? arg "--gen-haskell-exports" - , arg "-o", arg outputFile - , arg "--tmpdir", arg tempDir - , arg "--gcc-program", arg =<< getBuilderPath (Cc CompileC Stage1) - , pure $ concatMap (\a -> ["--gcc-flag", a]) cFlags - , arg "--nm-program", arg =<< getBuilderPath Nm - , isSpecified Objdump ? mconcat [ arg "--objdump-program" - , arg =<< getBuilderPath Objdump ] - , arg "--target-os", arg =<< getSetting TargetOs ] - -includeCcArgs :: Args -includeCcArgs = do - root <- getBuildRoot - mconcat [ cArgs - , cWarnings - , getSettingList $ ConfCcArgs Stage1 - , flag GhcUnregisterised ? arg "-DUSE_MINIINTERPRETER" - , arg "-Irts" - , arg "-Iincludes" - , arg $ "-I" ++ root -/- generatedDir - , notM ghcWithSMP ? arg "-DNOSMP" - , arg "-fcommon" ] diff --git a/hadrian/src/Settings/Builders/GenPrimopCode.hs b/hadrian/src/Settings/Builders/GenPrimopCode.hs deleted file mode 100644 index e616ed3b43..0000000000 --- a/hadrian/src/Settings/Builders/GenPrimopCode.hs +++ /dev/null @@ -1,24 +0,0 @@ -module Settings.Builders.GenPrimopCode (genPrimopCodeBuilderArgs) where - -import Settings.Builders.Common - -genPrimopCodeBuilderArgs :: Args -genPrimopCodeBuilderArgs = builder GenPrimopCode ? mconcat - [ output "//PrimopWrappers.hs" ? arg "--make-haskell-wrappers" - , output "//Prim.hs" ? arg "--make-haskell-source" - , output "//primop-data-decl.hs-incl" ? arg "--data-decl" - , output "//primop-tag.hs-incl" ? arg "--primop-tag" - , output "//primop-list.hs-incl" ? arg "--primop-list" - , output "//primop-has-side-effects.hs-incl" ? arg "--has-side-effects" - , output "//primop-out-of-line.hs-incl" ? arg "--out-of-line" - , output "//primop-commutable.hs-incl" ? arg "--commutable" - , output "//primop-code-size.hs-incl" ? arg "--code-size" - , output "//primop-can-fail.hs-incl" ? arg "--can-fail" - , output "//primop-strictness.hs-incl" ? arg "--strictness" - , output "//primop-fixity.hs-incl" ? arg "--fixity" - , output "//primop-primop-info.hs-incl" ? arg "--primop-primop-info" - , output "//primop-vector-uniques.hs-incl" ? arg "--primop-vector-uniques" - , output "//primop-vector-tys.hs-incl" ? arg "--primop-vector-tys" - , output "//primop-vector-tys-exports.hs-incl" ? arg "--primop-vector-tys-exports" - , output "//primop-vector-tycons.hs-incl" ? arg "--primop-vector-tycons" - , output "//primop-usage.hs-incl" ? arg "--usage" ] diff --git a/hadrian/src/Settings/Builders/Ghc.hs b/hadrian/src/Settings/Builders/Ghc.hs deleted file mode 100644 index af78b74637..0000000000 --- a/hadrian/src/Settings/Builders/Ghc.hs +++ /dev/null @@ -1,149 +0,0 @@ -module Settings.Builders.Ghc (ghcBuilderArgs, haddockGhcArgs) where - -import Hadrian.Haskell.Cabal - -import Flavour -import Rules.Gmp -import Settings.Builders.Common -import Settings.Warnings - -ghcBuilderArgs :: Args -ghcBuilderArgs = mconcat [compileAndLinkHs, compileC, findHsDependencies] - -compileAndLinkHs :: Args -compileAndLinkHs = (builder (Ghc CompileHs) ||^ builder (Ghc LinkHs)) ? do - needTouchy - mconcat [ arg "-Wall" - , commonGhcArgs - , splitObjectsArgs - , ghcLinkArgs - , defaultGhcWarningsArgs - , builder (Ghc CompileHs) ? arg "-c" - , getInputs - , arg "-o", arg =<< getOutput ] - -needTouchy :: Expr () -needTouchy = notStage0 ? windowsHost ? do - touchyPath <- expr $ programPath (vanillaContext Stage0 touchy) - expr $ need [touchyPath] - -compileC :: Args -compileC = builder (Ghc CompileCWithGhc) ? do - way <- getWay - let ccArgs = [ getPkgDataList CcArgs - , getStagedSettingList ConfCcArgs - , cIncludeArgs - , Dynamic `wayUnit` way ? pure [ "-fPIC", "-DDYNAMIC" ] ] - mconcat [ arg "-Wall" - , ghcLinkArgs - , commonGhcArgs - , mconcat (map (map ("-optc" ++) <$>) ccArgs) - , defaultGhcWarningsArgs - , arg "-c" - , getInputs - , arg "-o" - , arg =<< getOutput ] - -ghcLinkArgs :: Args -ghcLinkArgs = builder (Ghc LinkHs) ? do - stage <- getStage - way <- getWay - pkg <- getPackage - libs <- getPkgDataList DepExtraLibs - libDirs <- getPkgDataList DepLibDirs - intLib <- getIntegerPackage - gmpLibs <- if stage > Stage0 && intLib == integerGmp - then do -- TODO: get this data more gracefully - let strip = fromMaybe "" . stripPrefix "extra-libraries: " - buildInfo <- expr $ readFileLines gmpBuildInfoPath - return $ concatMap (words . strip) buildInfo - else return [] - mconcat [ (Dynamic `wayUnit` way) ? - pure [ "-shared", "-dynamic", "-dynload", "deploy" ] - , arg "-no-auto-link-packages" - , nonHsMainPackage pkg ? arg "-no-hs-main" - , not (nonHsMainPackage pkg) ? arg "-rtsopts" - , pure [ "-optl-l" ++ lib | lib <- libs ++ gmpLibs ] - , pure [ "-optl-L" ++ unifyPath dir | dir <- libDirs ] ] - -splitObjectsArgs :: Args -splitObjectsArgs = splitObjects <$> flavour ? do - expr $ need [ghcSplitPath] - arg "-split-objs" - -findHsDependencies :: Args -findHsDependencies = builder (Ghc FindHsDependencies) ? do - ways <- getLibraryWays - mconcat [ arg "-M" - , commonGhcArgs - , arg "-include-pkg-deps" - , arg "-dep-makefile", arg =<< getOutput - , pure $ concat [ ["-dep-suffix", wayPrefix w] | w <- ways ] - , getInputs ] - -haddockGhcArgs :: Args -haddockGhcArgs = mconcat [ commonGhcArgs, getPkgDataList HsArgs ] - --- Used in ghcBuilderArgs, ghcCBuilderArgs, ghcMBuilderArgs and haddockGhcArgs. -commonGhcArgs :: Args -commonGhcArgs = do - way <- getWay - path <- getBuildPath - pkg <- getPackage - when (pkg == rts) $ do - context <- getContext - conf <- expr $ pkgConfFile context - expr $ need [conf] - mconcat [ arg "-hisuf", arg $ hisuf way - , arg "-osuf" , arg $ osuf way - , arg "-hcsuf", arg $ hcsuf way - , wayGhcArgs - , packageGhcArgs - , includeGhcArgs - , map ("-optc" ++) <$> getStagedSettingList ConfCcArgs - , map ("-optP" ++) <$> getStagedSettingList ConfCppArgs - , map ("-optP" ++) <$> getPkgDataList CppArgs - , arg "-odir" , arg path - , arg "-hidir" , arg path - , arg "-stubdir" , arg path ] - --- TODO: Do '-ticky' in all debug ways? -wayGhcArgs :: Args -wayGhcArgs = do - way <- getWay - mconcat [ if (Dynamic `wayUnit` way) - then pure ["-fPIC", "-dynamic"] - else arg "-static" - , (Threaded `wayUnit` way) ? arg "-optc-DTHREADED_RTS" - , (Debug `wayUnit` way) ? arg "-optc-DDEBUG" - , (Profiling `wayUnit` way) ? arg "-prof" - , (Logging `wayUnit` way) ? arg "-eventlog" - , (way == debug || way == debugDynamic) ? - pure ["-ticky", "-DTICKY_TICKY"] ] - -packageGhcArgs :: Args -packageGhcArgs = withHsPackage $ \cabalFile -> do - pkgId <- expr $ pkgIdentifier cabalFile - mconcat [ arg "-hide-all-packages" - , arg "-no-user-package-db" - , bootPackageDatabaseArgs - , libraryPackage ? arg ("-this-unit-id " ++ pkgId) - , map ("-package-id " ++) <$> getPkgDataList DepIds ] - -includeGhcArgs :: Args -includeGhcArgs = do - pkg <- getPackage - path <- getBuildPath - root <- getBuildRoot - context <- getContext - srcDirs <- getPkgDataList SrcDirs - autogen <- expr $ autogenPath context - mconcat [ arg "-i" - , arg $ "-i" ++ path - , arg $ "-i" ++ autogen - , pure [ "-i" ++ pkgPath pkg -/- dir | dir <- srcDirs ] - , cIncludeArgs - , arg $ "-I" ++ root -/- generatedDir - , arg $ "-optc-I" ++ root -/- generatedDir - , (not $ nonCabalContext context) ? - pure [ "-optP-include", "-optP" ++ autogen -/- "cabal_macros.h" ] ] diff --git a/hadrian/src/Settings/Builders/GhcCabal.hs b/hadrian/src/Settings/Builders/GhcCabal.hs deleted file mode 100644 index bfb84a76ec..0000000000 --- a/hadrian/src/Settings/Builders/GhcCabal.hs +++ /dev/null @@ -1,118 +0,0 @@ -module Settings.Builders.GhcCabal ( - ghcCabalBuilderArgs - ) where - -import Hadrian.Haskell.Cabal - -import Context -import Flavour -import Settings.Builders.Common - -ghcCabalBuilderArgs :: Args -ghcCabalBuilderArgs = builder GhcCabal ? do - verbosity <- expr getVerbosity - top <- expr topDirectory - path <- getBuildPath - notStage0 ? expr (need inplaceLibCopyTargets) - mconcat [ arg "configure" - , arg =<< pkgPath <$> getPackage - , arg $ top -/- path - , withStaged $ Ghc CompileHs - , withStaged (GhcPkg Update) - , bootPackageDatabaseArgs - , libraryArgs - , configureArgs - , bootPackageConstraints - , withStaged $ Cc CompileC - , notStage0 ? with Ld - , withStaged (Ar Pack) - , with Alex - , with Happy - , verbosity < Chatty ? pure [ "-v0", "--configure-option=--quiet" - , "--configure-option=--disable-option-checking" ] ] - --- TODO: Isn't vanilla always built? If yes, some conditions are redundant. --- TODO: Need compiler_stage1_CONFIGURE_OPTS += --disable-library-for-ghci? -libraryArgs :: Args -libraryArgs = do - ways <- getLibraryWays - withGhci <- expr ghcWithInterpreter - dynPrograms <- dynamicGhcPrograms <$> expr flavour - pure [ if vanilla `elem` ways - then "--enable-library-vanilla" - else "--disable-library-vanilla" - , if vanilla `elem` ways && withGhci && not dynPrograms - then "--enable-library-for-ghci" - else "--disable-library-for-ghci" - , if profiling `elem` ways - then "--enable-library-profiling" - else "--disable-library-profiling" - , if dynamic `elem` ways - then "--enable-shared" - else "--disable-shared" ] - --- TODO: LD_OPTS? -configureArgs :: Args -configureArgs = do - top <- expr topDirectory - root <- getBuildRoot - let conf key expr = do - values <- unwords <$> expr - not (null values) ? - arg ("--configure-option=" ++ key ++ "=" ++ values) - cFlags = mconcat [ remove ["-Werror"] cArgs - , getStagedSettingList ConfCcArgs - , arg $ "-I" ++ top -/- root -/- generatedDir ] - ldFlags = ldArgs <> (getStagedSettingList ConfGccLinkerArgs) - cppFlags = cppArgs <> (getStagedSettingList ConfCppArgs) - cldFlags <- unwords <$> (cFlags <> ldFlags) - mconcat - [ conf "CFLAGS" cFlags - , conf "LDFLAGS" ldFlags - , conf "CPPFLAGS" cppFlags - , not (null cldFlags) ? arg ("--gcc-options=" ++ cldFlags) - , conf "--with-iconv-includes" $ arg =<< getSetting IconvIncludeDir - , conf "--with-iconv-libraries" $ arg =<< getSetting IconvLibDir - , conf "--with-gmp-includes" $ arg =<< getSetting GmpIncludeDir - , conf "--with-gmp-libraries" $ arg =<< getSetting GmpLibDir - , conf "--with-curses-libraries" $ arg =<< getSetting CursesLibDir - , crossCompiling ? (conf "--host" $ arg =<< getSetting TargetPlatformFull) - , conf "--with-cc" $ arg =<< getBuilderPath . (Cc CompileC) =<< getStage ] - -bootPackageConstraints :: Args -bootPackageConstraints = stage0 ? do - bootPkgs <- expr $ stagePackages Stage0 - let pkgs = filter (\p -> p /= compiler && isLibrary p) bootPkgs - constraints <- expr $ fmap catMaybes $ forM (sort pkgs) $ \pkg -> do - version <- traverse pkgVersion (pkgCabalFile pkg) - return $ fmap ((pkgName pkg ++ " == ") ++) version - pure $ concat [ ["--constraint", c] | c <- constraints ] - -cppArgs :: Args -cppArgs = do - root <- getBuildRoot - arg $ "-I" ++ root -/- generatedDir - -withBuilderKey :: Builder -> String -withBuilderKey b = case b of - Ar _ _ -> "--with-ar=" - Ld -> "--with-ld=" - Cc _ _ -> "--with-gcc=" - Ghc _ _ -> "--with-ghc=" - Alex -> "--with-alex=" - Happy -> "--with-happy=" - GhcPkg _ _ -> "--with-ghc-pkg=" - _ -> error $ "withBuilderKey: not supported builder " ++ show b - --- Expression 'with Alex' appends "--with-alex=/path/to/alex" and needs Alex. -with :: Builder -> Args -with b = do - path <- getBuilderPath b - if (null path) then mempty else do - top <- expr topDirectory - expr $ needBuilder b - arg $ withBuilderKey b ++ unifyPath (top </> path) - -withStaged :: (Stage -> Builder) -> Args -withStaged sb = with . sb =<< getStage - diff --git a/hadrian/src/Settings/Builders/GhcPkg.hs b/hadrian/src/Settings/Builders/GhcPkg.hs deleted file mode 100644 index ba705c6892..0000000000 --- a/hadrian/src/Settings/Builders/GhcPkg.hs +++ /dev/null @@ -1,17 +0,0 @@ -module Settings.Builders.GhcPkg (ghcPkgBuilderArgs) where - -import Settings.Builders.Common - -ghcPkgBuilderArgs :: Args -ghcPkgBuilderArgs = mconcat - [ builder (GhcPkg Init) ? mconcat [ arg "init", arg =<< getOutput ] - - , builder (GhcPkg Update) ? do - verbosity <- expr getVerbosity - context <- getContext - config <- expr $ pkgInplaceConfig context - mconcat [ arg "update" - , arg "--force" - , verbosity < Chatty ? arg "-v0" - , bootPackageDatabaseArgs - , arg config ] ] diff --git a/hadrian/src/Settings/Builders/Haddock.hs b/hadrian/src/Settings/Builders/Haddock.hs deleted file mode 100644 index b3810476ad..0000000000 --- a/hadrian/src/Settings/Builders/Haddock.hs +++ /dev/null @@ -1,63 +0,0 @@ -module Settings.Builders.Haddock (haddockBuilderArgs) where - -import Hadrian.Utilities -import Hadrian.Haskell.Cabal - -import Rules.Documentation -import Settings.Builders.Common -import Settings.Builders.Ghc - --- | Given a version string such as "2.16.2" produce an integer equivalent. -versionToInt :: String -> Int -versionToInt s = case map read . words $ replaceEq '.' ' ' s of - [major, minor, patch] -> major * 1000 + minor * 10 + patch - _ -> error "versionToInt: cannot parse version." - -haddockBuilderArgs :: Args -haddockBuilderArgs = withHsPackage $ \cabalFile -> mconcat - [ builder (Haddock BuildIndex) ? do - output <- getOutput - inputs <- getInputs - mconcat - [ arg "--gen-index" - , arg "--gen-contents" - , arg "-o", arg $ takeDirectory output - , arg "-t", arg "Haskell Hierarchical Libraries" - , arg "-p", arg "libraries/prologue.txt" - , pure [ "--read-interface=" - ++ (takeFileName . takeDirectory) haddock - ++ "," ++ haddock | haddock <- inputs ] ] - - , builder (Haddock BuildPackage) ? do - output <- getOutput - pkg <- getPackage - path <- getBuildPath - version <- expr $ pkgVersion cabalFile - synopsis <- expr $ pkgSynopsis cabalFile - deps <- getPkgDataList DepNames - haddocks <- expr . haddockDependencies =<< getContext - hVersion <- expr $ pkgVersion (unsafePkgCabalFile haddock) -- TODO: improve - ghcOpts <- haddockGhcArgs - mconcat - [ arg $ "--odir=" ++ takeDirectory output - , arg "--verbosity=0" - , arg "--no-tmp-comp-dir" - , arg $ "--dump-interface=" ++ output - , arg "--html" - , arg "--hyperlinked-source" - , arg "--hoogle" - , arg $ "--title=" ++ pkgName pkg ++ "-" ++ version - ++ ": " ++ synopsis - , arg $ "--prologue=" ++ path -/- "haddock-prologue.txt" - , arg $ "--optghc=-D__HADDOCK_VERSION__=" - ++ show (versionToInt hVersion) - , map ("--hide=" ++) <$> getPkgDataList HiddenModules - , pure [ "--read-interface=../" ++ dep - ++ ",../" ++ dep ++ "/src/%{MODULE}.html#%{NAME}," - ++ haddock | (dep, haddock) <- zip deps haddocks ] - , pure [ "--optghc=" ++ opt | opt <- ghcOpts ] - , getInputs - , arg "+RTS" - , arg $ "-t" ++ path -/- "haddock.t" - , arg "--machine-readable" - , arg "-RTS" ] ] diff --git a/hadrian/src/Settings/Builders/Happy.hs b/hadrian/src/Settings/Builders/Happy.hs deleted file mode 100644 index 5ffb2614cc..0000000000 --- a/hadrian/src/Settings/Builders/Happy.hs +++ /dev/null @@ -1,9 +0,0 @@ -module Settings.Builders.Happy (happyBuilderArgs) where - -import Settings.Builders.Common - -happyBuilderArgs :: Args -happyBuilderArgs = builder Happy ? mconcat [ arg "-agc" - , arg "--strict" - , arg =<< getInput - , arg "-o", arg =<< getOutput ] diff --git a/hadrian/src/Settings/Builders/HsCpp.hs b/hadrian/src/Settings/Builders/HsCpp.hs deleted file mode 100644 index aeb5255990..0000000000 --- a/hadrian/src/Settings/Builders/HsCpp.hs +++ /dev/null @@ -1,16 +0,0 @@ -module Settings.Builders.HsCpp (hsCppBuilderArgs) where - -import Settings.Builders.Common - -hsCppBuilderArgs :: Args -hsCppBuilderArgs = builder HsCpp ? do - stage <- getStage - root <- getBuildRoot - ghcPath <- expr $ buildPath (vanillaContext stage compiler) - mconcat [ getSettingList HsCppArgs - , arg "-P" - , arg "-Iincludes" - , arg $ "-I" ++ root -/- generatedDir - , arg $ "-I" ++ ghcPath - , arg "-x", arg "c" - , arg =<< getInput ] diff --git a/hadrian/src/Settings/Builders/Hsc2Hs.hs b/hadrian/src/Settings/Builders/Hsc2Hs.hs deleted file mode 100644 index 6185f6bec3..0000000000 --- a/hadrian/src/Settings/Builders/Hsc2Hs.hs +++ /dev/null @@ -1,56 +0,0 @@ -module Settings.Builders.Hsc2Hs (hsc2hsBuilderArgs) where - -import Settings.Builders.Common - -hsc2hsBuilderArgs :: Args -hsc2hsBuilderArgs = builder Hsc2Hs ? do - stage <- getStage - ccPath <- getBuilderPath $ Cc CompileC stage - gmpDir <- getSetting GmpIncludeDir - top <- expr topDirectory - hArch <- getSetting HostArch - hOs <- getSetting HostOs - tArch <- getSetting TargetArch - tOs <- getSetting TargetOs - version <- if stage == Stage0 - then expr ghcCanonVersion - else getSetting ProjectVersionInt - mconcat [ arg $ "--cc=" ++ ccPath - , arg $ "--ld=" ++ ccPath - , notM windowsHost ? arg "--cross-safe" - , pure $ map ("-I" ++) (words gmpDir) - , map ("--cflag=" ++) <$> getCFlags - , map ("--lflag=" ++) <$> getLFlags - , notStage0 ? crossCompiling ? arg "--cross-compile" - , stage0 ? arg ("--cflag=-D" ++ hArch ++ "_HOST_ARCH=1") - , stage0 ? arg ("--cflag=-D" ++ hOs ++ "_HOST_OS=1" ) - , notStage0 ? arg ("--cflag=-D" ++ tArch ++ "_HOST_ARCH=1") - , notStage0 ? arg ("--cflag=-D" ++ tOs ++ "_HOST_OS=1" ) - , arg $ "--cflag=-D__GLASGOW_HASKELL__=" ++ version - , arg $ "--template=" ++ top -/- templateHscPath - , arg $ "-I" ++ top -/- "inplace/lib/include/" - , arg =<< getInput - , arg "-o", arg =<< getOutput ] - -getCFlags :: Expr [String] -getCFlags = do - context <- getContext - autogen <- expr $ autogenPath context - mconcat [ remove ["-O"] (cArgs <> getStagedSettingList ConfCcArgs) - , getStagedSettingList ConfCppArgs - , cIncludeArgs - , getPkgDataList CppArgs - , getPkgDataList DepCcArgs - , cWarnings - , arg "-include", arg $ autogen -/- "cabal_macros.h" ] - -getLFlags :: Expr [String] -getLFlags = do - libDirs <- getPkgDataList DepLibDirs - extraLibs <- getPkgDataList DepExtraLibs - mconcat [ getStagedSettingList ConfGccLinkerArgs - , ldArgs - , getPkgDataList LdArgs - , pure [ "-L" ++ unifyPath dir | dir <- libDirs ] - , pure [ "-l" ++ unifyPath dir | dir <- extraLibs ] - , getPkgDataList DepLdArgs ] diff --git a/hadrian/src/Settings/Builders/Ld.hs b/hadrian/src/Settings/Builders/Ld.hs deleted file mode 100644 index 2715bbb20c..0000000000 --- a/hadrian/src/Settings/Builders/Ld.hs +++ /dev/null @@ -1,9 +0,0 @@ -module Settings.Builders.Ld (ldBuilderArgs) where - -import Settings.Builders.Common - -ldBuilderArgs :: Args -ldBuilderArgs = builder Ld ? mconcat [ getStagedSettingList ConfLdLinkerArgs - , arg "-r" - , arg "-o", arg =<< getOutput - , getInputs ] diff --git a/hadrian/src/Settings/Builders/Make.hs b/hadrian/src/Settings/Builders/Make.hs deleted file mode 100644 index cc350df508..0000000000 --- a/hadrian/src/Settings/Builders/Make.hs +++ /dev/null @@ -1,16 +0,0 @@ -module Settings.Builders.Make (makeBuilderArgs) where - -import Rules.Gmp -import Rules.Libffi -import Settings.Builders.Common - -makeBuilderArgs :: Args -makeBuilderArgs = do - threads <- shakeThreads <$> expr getShakeOptions - gmpPath <- expr gmpBuildPath - libffiPath <- expr libffiBuildPath - let t = show $ max 4 (threads - 2) -- Don't use all Shake's threads - mconcat - [ builder (Make gmpPath ) ? pure ["MAKEFLAGS=-j" ++ t] - , builder (Make libffiPath ) ? pure ["MAKEFLAGS=-j" ++ t, "install"] - , builder (Make "testsuite/tests") ? pure ["THREADS=" ++ t, "fast"] ] diff --git a/hadrian/src/Settings/Builders/Xelatex.hs b/hadrian/src/Settings/Builders/Xelatex.hs deleted file mode 100644 index 5623284ed5..0000000000 --- a/hadrian/src/Settings/Builders/Xelatex.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Settings.Builders.Xelatex (xelatexBuilderArgs) where - -import Settings.Builders.Common - -xelatexBuilderArgs :: Args -xelatexBuilderArgs = builder Xelatex ? mconcat [ arg "-halt-on-error" - , arg =<< getInput ] diff --git a/hadrian/src/Settings/Default.hs b/hadrian/src/Settings/Default.hs deleted file mode 100644 index dc58f22160..0000000000 --- a/hadrian/src/Settings/Default.hs +++ /dev/null @@ -1,173 +0,0 @@ -module Settings.Default ( - SourceArgs (..), sourceArgs, defaultBuilderArgs, defaultPackageArgs, - defaultArgs, defaultLibraryWays, defaultRtsWays, - defaultFlavour, defaultSplitObjects - ) where - -import qualified Hadrian.Builder.Ar -import qualified Hadrian.Builder.Sphinx -import qualified Hadrian.Builder.Tar - -import CommandLine -import Expression -import Flavour -import Oracles.Flag -import Oracles.PackageData -import Settings -import Settings.Builders.Alex -import Settings.Builders.DeriveConstants -import Settings.Builders.Cc -import Settings.Builders.Configure -import Settings.Builders.GenPrimopCode -import Settings.Builders.Ghc -import Settings.Builders.GhcCabal -import Settings.Builders.GhcPkg -import Settings.Builders.Haddock -import Settings.Builders.Happy -import Settings.Builders.Hsc2Hs -import Settings.Builders.HsCpp -import Settings.Builders.Ld -import Settings.Builders.Make -import Settings.Builders.Xelatex -import Settings.Packages.Base -import Settings.Packages.Cabal -import Settings.Packages.Compiler -import Settings.Packages.Ghc -import Settings.Packages.GhcCabal -import Settings.Packages.Ghci -import Settings.Packages.GhcPkg -import Settings.Packages.GhcPrim -import Settings.Packages.Haddock -import Settings.Packages.Haskeline -import Settings.Packages.IntegerGmp -import Settings.Packages.Rts -import Settings.Packages.RunGhc -import Settings.Warnings - --- TODO: Move C source arguments here --- | Default and package-specific source arguments. -data SourceArgs = SourceArgs - { hsDefault :: Args - , hsLibrary :: Args - , hsCompiler :: Args - , hsGhc :: Args } - --- | Concatenate source arguments in appropriate order. -sourceArgs :: SourceArgs -> Args -sourceArgs SourceArgs {..} = builder Ghc ? mconcat - [ hsDefault - , getPkgDataList HsArgs - , libraryPackage ? hsLibrary - , package compiler ? hsCompiler - , package ghc ? hsGhc ] - --- | All default command line arguments. -defaultArgs :: Args -defaultArgs = mconcat - [ defaultBuilderArgs - , sourceArgs defaultSourceArgs - , defaultPackageArgs ] - --- | Default source arguments, e.g. optimisation settings. -defaultSourceArgs :: SourceArgs -defaultSourceArgs = SourceArgs - { hsDefault = mconcat [ stage0 ? arg "-O" - , notStage0 ? arg "-O2" - , arg "-H32m" ] - , hsLibrary = mempty - , hsCompiler = mempty - , hsGhc = mempty } - --- | Default build ways for library packages: --- * We always build 'vanilla' way. --- * We build 'profiling' way when stage > Stage0. --- * We build 'dynamic' way when stage > Stage0 and the platform supports it. -defaultLibraryWays :: Ways -defaultLibraryWays = mconcat - [ pure [vanilla] - , notStage0 ? pure [profiling] - , notStage0 ? platformSupportsSharedLibs ? pure [dynamic] ] - --- | Default build ways for the RTS. -defaultRtsWays :: Ways -defaultRtsWays = do - ways <- getLibraryWays - mconcat - [ pure [ logging, debug, threaded, threadedDebug, threadedLogging ] - , (profiling `elem` ways) ? pure [threadedProfiling] - , (dynamic `elem` ways) ? - pure [ dynamic, debugDynamic, threadedDynamic, threadedDebugDynamic - , loggingDynamic, threadedLoggingDynamic ] ] - --- Please update doc/flavours.md when changing the default build flavour. --- | Default build flavour. Other build flavours are defined in modules --- @Settings.Flavours.*@. Users can add new build flavours in "UserSettings". -defaultFlavour :: Flavour -defaultFlavour = Flavour - { name = "default" - , args = defaultArgs - , packages = defaultPackages - , integerLibrary = (\x -> if x then integerSimple else integerGmp) <$> cmdIntegerSimple - , libraryWays = defaultLibraryWays - , rtsWays = defaultRtsWays - , splitObjects = defaultSplitObjects - , dynamicGhcPrograms = False - , ghciWithDebugger = False - , ghcProfiled = False - , ghcDebugged = False } - --- | Default condition for building split objects. -defaultSplitObjects :: Predicate -defaultSplitObjects = do - goodStage <- notStage0 -- We don't split bootstrap (stage 0) packages - pkg <- getPackage - supported <- expr supportsSplitObjects - split <- expr cmdSplitObjects - let goodPackage = isLibrary pkg && pkg /= compiler && pkg /= rts - return $ split && goodStage && goodPackage && supported - --- | All 'Builder'-dependent command line arguments. -defaultBuilderArgs :: Args -defaultBuilderArgs = mconcat - -- GHC-specific builders: - [ alexBuilderArgs - , ccBuilderArgs - , configureBuilderArgs - , deriveConstantsBuilderArgs - , genPrimopCodeBuilderArgs - , ghcBuilderArgs - , ghcCabalBuilderArgs - , ghcPkgBuilderArgs - , haddockBuilderArgs - , happyBuilderArgs - , hsc2hsBuilderArgs - , hsCppBuilderArgs - , ldBuilderArgs - , makeBuilderArgs - , xelatexBuilderArgs - -- Generic builders from the Hadrian library: - , builder (Ar Pack ) ? Hadrian.Builder.Ar.args Pack - , builder (Ar Unpack ) ? Hadrian.Builder.Ar.args Unpack - , builder (Sphinx Html ) ? Hadrian.Builder.Sphinx.args Html - , builder (Sphinx Latex) ? Hadrian.Builder.Sphinx.args Latex - , builder (Sphinx Man ) ? Hadrian.Builder.Sphinx.args Man - , builder (Tar Create ) ? Hadrian.Builder.Tar.args Create - , builder (Tar Extract ) ? Hadrian.Builder.Tar.args Extract ] - --- | All 'Package'-dependent command line arguments. -defaultPackageArgs :: Args -defaultPackageArgs = mconcat - [ basePackageArgs - , cabalPackageArgs - , compilerPackageArgs - , ghcCabalPackageArgs - , ghciPackageArgs - , ghcPackageArgs - , ghcPkgPackageArgs - , ghcPrimPackageArgs - , haddockPackageArgs - , haskelinePackageArgs - , integerGmpPackageArgs - , rtsPackageArgs - , runGhcPackageArgs - , warningArgs ] diff --git a/hadrian/src/Settings/Default.hs-boot b/hadrian/src/Settings/Default.hs-boot deleted file mode 100644 index 468c5cae3e..0000000000 --- a/hadrian/src/Settings/Default.hs-boot +++ /dev/null @@ -1,20 +0,0 @@ -module Settings.Default ( - SourceArgs (..), sourceArgs, defaultBuilderArgs, defaultPackageArgs, - defaultArgs, defaultLibraryWays, defaultRtsWays, defaultFlavour, defaultSplitObjects - ) where - -import Flavour -import Expression - -data SourceArgs = SourceArgs - { hsDefault :: Args - , hsLibrary :: Args - , hsCompiler :: Args - , hsGhc :: Args } - -sourceArgs :: SourceArgs -> Args - -defaultBuilderArgs, defaultPackageArgs, defaultArgs :: Args -defaultLibraryWays, defaultRtsWays :: Ways -defaultFlavour :: Flavour -defaultSplitObjects :: Predicate diff --git a/hadrian/src/Settings/Flavours/Development.hs b/hadrian/src/Settings/Flavours/Development.hs deleted file mode 100644 index 5919026cb0..0000000000 --- a/hadrian/src/Settings/Flavours/Development.hs +++ /dev/null @@ -1,20 +0,0 @@ -module Settings.Flavours.Development (developmentFlavour) where - -import Expression -import Flavour -import {-# SOURCE #-} Settings.Default - --- Please update doc/flavours.md when changing this file. -developmentFlavour :: Stage -> Flavour -developmentFlavour ghcStage = defaultFlavour - { name = "devel" ++ show (fromEnum ghcStage) - , args = defaultBuilderArgs <> developmentArgs ghcStage <> defaultPackageArgs } - -developmentArgs :: Stage -> Args -developmentArgs ghcStage = do - stage <- getStage - sourceArgs SourceArgs - { hsDefault = pure ["-O", "-H64m"] - , hsLibrary = notStage0 ? arg "-dcore-lint" - , hsCompiler = succ stage == ghcStage ? pure ["-O0", "-DDEBUG"] - , hsGhc = succ stage == ghcStage ? pure ["-O0", "-DDEBUG"] } diff --git a/hadrian/src/Settings/Flavours/Performance.hs b/hadrian/src/Settings/Flavours/Performance.hs deleted file mode 100644 index 64ab4bce9d..0000000000 --- a/hadrian/src/Settings/Flavours/Performance.hs +++ /dev/null @@ -1,18 +0,0 @@ -module Settings.Flavours.Performance (performanceFlavour) where - -import Expression -import Flavour -import {-# SOURCE #-} Settings.Default - --- Please update doc/flavours.md when changing this file. -performanceFlavour :: Flavour -performanceFlavour = defaultFlavour - { name = "perf" - , args = defaultBuilderArgs <> performanceArgs <> defaultPackageArgs } - -performanceArgs :: Args -performanceArgs = sourceArgs SourceArgs - { hsDefault = pure ["-O", "-H64m"] - , hsLibrary = notStage0 ? arg "-O2" - , hsCompiler = mconcat [stage0 ? arg "-O", notStage0 ? arg "-O2"] - , hsGhc = mconcat [stage0 ? arg "-O", notStage0 ? arg "-O2"] } diff --git a/hadrian/src/Settings/Flavours/Profiled.hs b/hadrian/src/Settings/Flavours/Profiled.hs deleted file mode 100644 index d56cc10055..0000000000 --- a/hadrian/src/Settings/Flavours/Profiled.hs +++ /dev/null @@ -1,19 +0,0 @@ -module Settings.Flavours.Profiled (profiledFlavour) where - -import Expression -import Flavour -import {-# SOURCE #-} Settings.Default - --- Please update doc/flavours.md when changing this file. -profiledFlavour :: Flavour -profiledFlavour = defaultFlavour - { name = "prof" - , args = defaultBuilderArgs <> profiledArgs <> defaultPackageArgs - , ghcProfiled = True } - -profiledArgs :: Args -profiledArgs = sourceArgs SourceArgs - { hsDefault = pure ["-O0", "-H64m"] - , hsLibrary = notStage0 ? arg "-O" - , hsCompiler = arg "-O" - , hsGhc = arg "-O" } diff --git a/hadrian/src/Settings/Flavours/Quick.hs b/hadrian/src/Settings/Flavours/Quick.hs deleted file mode 100644 index 99dade9bf1..0000000000 --- a/hadrian/src/Settings/Flavours/Quick.hs +++ /dev/null @@ -1,22 +0,0 @@ -module Settings.Flavours.Quick (quickFlavour) where - -import Expression -import Flavour -import Oracles.Flag -import {-# SOURCE #-} Settings.Default - --- Please update doc/flavours.md when changing this file. -quickFlavour :: Flavour -quickFlavour = defaultFlavour - { name = "quick" - , args = defaultBuilderArgs <> quickArgs <> defaultPackageArgs - , libraryWays = mconcat - [ pure [vanilla] - , notStage0 ? platformSupportsSharedLibs ? pure [dynamic] ] } - -quickArgs :: Args -quickArgs = sourceArgs SourceArgs - { hsDefault = pure ["-O0", "-H64m"] - , hsLibrary = notStage0 ? arg "-O" - , hsCompiler = stage0 ? arg "-O" - , hsGhc = stage0 ? arg "-O" } diff --git a/hadrian/src/Settings/Flavours/QuickCross.hs b/hadrian/src/Settings/Flavours/QuickCross.hs deleted file mode 100644 index 3d0c410bea..0000000000 --- a/hadrian/src/Settings/Flavours/QuickCross.hs +++ /dev/null @@ -1,24 +0,0 @@ -module Settings.Flavours.QuickCross (quickCrossFlavour) where - -import Expression -import Flavour -import Oracles.Flag -import {-# SOURCE #-} Settings.Default - --- Please update doc/flavours.md when changing this file. -quickCrossFlavour :: Flavour -quickCrossFlavour = defaultFlavour - { name = "quick-cross" - , args = defaultBuilderArgs <> quickCrossArgs <> defaultPackageArgs - , libraryWays = mconcat - [ pure [vanilla] - , notStage0 ? platformSupportsSharedLibs ? pure [dynamic] ] } - -quickCrossArgs :: Args -quickCrossArgs = sourceArgs SourceArgs - { hsDefault = pure ["-O0", "-H64m"] - , hsLibrary = notStage0 ? mconcat [ arg "-O", arg "-fllvm" ] - , hsCompiler = stage0 ? arg "-O" - , hsGhc = mconcat - [ stage0 ? arg "-O" - , stage1 ? mconcat [ arg "-O0", arg "-fllvm" ] ] } diff --git a/hadrian/src/Settings/Flavours/Quickest.hs b/hadrian/src/Settings/Flavours/Quickest.hs deleted file mode 100644 index a9dfb7087f..0000000000 --- a/hadrian/src/Settings/Flavours/Quickest.hs +++ /dev/null @@ -1,23 +0,0 @@ -module Settings.Flavours.Quickest (quickestFlavour) where - -import Expression -import Flavour -import {-# SOURCE #-} Settings.Default - --- Please update doc/flavours.md when changing this file. -quickestFlavour :: Flavour -quickestFlavour = defaultFlavour - { name = "quickest" - , args = defaultBuilderArgs <> quickestArgs <> defaultPackageArgs - , libraryWays = pure [vanilla] - , rtsWays = quickestRtsWays } - -quickestArgs :: Args -quickestArgs = sourceArgs SourceArgs - { hsDefault = pure ["-O0", "-H64m"] - , hsLibrary = mempty - , hsCompiler = stage0 ? arg "-O" - , hsGhc = stage0 ? arg "-O" } - -quickestRtsWays :: Ways -quickestRtsWays = pure [vanilla, threaded] diff --git a/hadrian/src/Settings/Packages/Base.hs b/hadrian/src/Settings/Packages/Base.hs deleted file mode 100644 index 2e0ced4c26..0000000000 --- a/hadrian/src/Settings/Packages/Base.hs +++ /dev/null @@ -1,12 +0,0 @@ -module Settings.Packages.Base (basePackageArgs) where - -import Expression -import Settings - -basePackageArgs :: Args -basePackageArgs = package base ? do - integerLibraryName <- pkgName <$> getIntegerPackage - mconcat [ builder GhcCabal ? arg ("--flags=" ++ integerLibraryName) - -- This fixes the 'unknown symbol stat' issue. - -- See: https://github.com/snowleopard/hadrian/issues/259. - , builder (Ghc CompileCWithGhc) ? arg "-optc-O2" ] diff --git a/hadrian/src/Settings/Packages/Cabal.hs b/hadrian/src/Settings/Packages/Cabal.hs deleted file mode 100644 index c01be4b3ed..0000000000 --- a/hadrian/src/Settings/Packages/Cabal.hs +++ /dev/null @@ -1,10 +0,0 @@ -module Settings.Packages.Cabal where - -import Expression - -cabalPackageArgs :: Args -cabalPackageArgs = package cabal ? - -- Cabal is a rather large library and quite slow to compile. Moreover, we - -- build it for stage0 only so we can link ghc-pkg against it, so there is - -- little reason to spend the effort to optimize it. - stage0 ? builder Ghc ? arg "-O0" diff --git a/hadrian/src/Settings/Packages/Compiler.hs b/hadrian/src/Settings/Packages/Compiler.hs deleted file mode 100644 index 6b329d7b4f..0000000000 --- a/hadrian/src/Settings/Packages/Compiler.hs +++ /dev/null @@ -1,45 +0,0 @@ -module Settings.Packages.Compiler (compilerPackageArgs) where - -import Base -import Expression -import Flavour -import Oracles.Flag -import Oracles.Setting -import Settings - -compilerPackageArgs :: Args -compilerPackageArgs = package compiler ? do - stage <- getStage - rtsWays <- getRtsWays - path <- getBuildPath - mconcat [ builder Alex ? arg "--latin1" - - , builder (Ghc CompileHs) ? mconcat - [ inputs ["//GHC.hs", "//GhcMake.hs"] ? arg "-fprof-auto" - , input "//Parser.hs" ? - pure ["-O0", "-fno-ignore-interface-pragmas", "-fcmm-sink" ] ] - - , builder GhcCabal ? mconcat - [ arg $ "--ghc-option=-DSTAGE=" ++ show (fromEnum stage + 1) - , arg "--disable-library-for-ghci" - , anyTargetOs ["openbsd"] ? arg "--ld-options=-E" - , flag GhcUnregisterised ? arg "--ghc-option=-DNO_REGS" - , notM ghcWithSMP ? arg "--ghc-option=-DNOSMP" - , notM ghcWithSMP ? arg "--ghc-option=-optc-DNOSMP" - , (threaded `elem` rtsWays) ? - notStage0 ? arg "--ghc-option=-optc-DTHREADED_RTS" - , ghcWithNativeCodeGen ? arg "--flags=ncg" - , ghcWithInterpreter ? - notStage0 ? arg "--flags=ghci" - , crossCompiling ? arg "-f-terminfo" - , ghcWithInterpreter ? - ghcEnableTablesNextToCode ? - notM (flag GhcUnregisterised) ? - notStage0 ? arg "--ghc-option=-DGHCI_TABLES_NEXT_TO_CODE" - , ghcWithInterpreter ? - ghciWithDebugger <$> flavour ? - notStage0 ? arg "--ghc-option=-DDEBUGGER" - , ghcProfiled <$> flavour ? - notStage0 ? arg "--ghc-pkg-option=--force" ] - - , builder (Haddock BuildPackage) ? arg ("--optghc=-I" ++ path) ] diff --git a/hadrian/src/Settings/Packages/Ghc.hs b/hadrian/src/Settings/Packages/Ghc.hs deleted file mode 100644 index d7b1d78ddd..0000000000 --- a/hadrian/src/Settings/Packages/Ghc.hs +++ /dev/null @@ -1,13 +0,0 @@ -module Settings.Packages.Ghc (ghcPackageArgs) where - -import Expression -import Oracles.Setting -import Oracles.Flag (crossCompiling) - -ghcPackageArgs :: Args -ghcPackageArgs = package ghc ? do - stage <- getStage - path <- expr $ buildPath (vanillaContext stage compiler) - mconcat [ builder Ghc ? arg ("-I" ++ path) - , builder GhcCabal ? ghcWithInterpreter ? notStage0 ? arg "--flags=ghci" - , builder GhcCabal ? crossCompiling ? arg "-f-terminfo" ] diff --git a/hadrian/src/Settings/Packages/GhcCabal.hs b/hadrian/src/Settings/Packages/GhcCabal.hs deleted file mode 100644 index c88617b97f..0000000000 --- a/hadrian/src/Settings/Packages/GhcCabal.hs +++ /dev/null @@ -1,32 +0,0 @@ -module Settings.Packages.GhcCabal (ghcCabalPackageArgs) where - -import Hadrian.Haskell.Cabal - -import Base -import Expression -import Utilities - -ghcCabalPackageArgs :: Args -ghcCabalPackageArgs = stage0 ? package ghcCabal ? builder Ghc ? do - cabalDeps <- expr $ stage1Dependencies cabal - let bootDeps = cabalDeps \\ [integerGmp, integerSimple, mtl, parsec, text] - cabalVersion <- expr $ pkgVersion (unsafePkgCabalFile cabal) -- TODO: improve - mconcat - [ pure [ "-package " ++ pkgName pkg | pkg <- bootDeps ] - , arg "--make" - , arg "-j" - , pure ["-Wall", "-fno-warn-unused-imports", "-fno-warn-warnings-deprecations"] - , arg ("-DCABAL_VERSION=" ++ replace "." "," cabalVersion) - , arg "-DCABAL_PARSEC" - , arg "-DBOOTSTRAPPING" - , arg "-DMIN_VERSION_binary_0_8_0" - , arg "libraries/text/cbits/cbits.c" - , arg "-ilibraries/Cabal/Cabal" - , arg "-ilibraries/binary/src" - , arg "-ilibraries/filepath" - , arg "-ilibraries/hpc" - , arg "-ilibraries/mtl" - , arg "-ilibraries/text" - , arg "-Ilibraries/text/include" - , arg "-ilibraries/parsec" ] - diff --git a/hadrian/src/Settings/Packages/GhcPkg.hs b/hadrian/src/Settings/Packages/GhcPkg.hs deleted file mode 100644 index a13a9dab7e..0000000000 --- a/hadrian/src/Settings/Packages/GhcPkg.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Settings.Packages.GhcPkg (ghcPkgPackageArgs) where - -import Expression -import Oracles.Flag (crossCompiling) - -ghcPkgPackageArgs :: Args -ghcPkgPackageArgs = package ghcPkg ? builder GhcCabal ? crossCompiling ? arg "-f-terminfo" diff --git a/hadrian/src/Settings/Packages/GhcPrim.hs b/hadrian/src/Settings/Packages/GhcPrim.hs deleted file mode 100644 index aed8f2ff73..0000000000 --- a/hadrian/src/Settings/Packages/GhcPrim.hs +++ /dev/null @@ -1,12 +0,0 @@ -module Settings.Packages.GhcPrim (ghcPrimPackageArgs) where - -import Oracles.Flag -import Expression - -ghcPrimPackageArgs :: Args -ghcPrimPackageArgs = package ghcPrim ? mconcat - [ builder GhcCabal ? arg "--flag=include-ghc-prim" - - , builder (Cc CompileC) ? - (not <$> flag GccIsClang) ? - input "//cbits/atomic.c" ? arg "-Wno-sync-nand" ] diff --git a/hadrian/src/Settings/Packages/Ghci.hs b/hadrian/src/Settings/Packages/Ghci.hs deleted file mode 100644 index 47e7d38deb..0000000000 --- a/hadrian/src/Settings/Packages/Ghci.hs +++ /dev/null @@ -1,6 +0,0 @@ -module Settings.Packages.Ghci (ghciPackageArgs) where - -import Expression - -ghciPackageArgs :: Args -ghciPackageArgs = package ghci ? notStage0 ? builder GhcCabal ? arg "--flags=ghci" diff --git a/hadrian/src/Settings/Packages/Haddock.hs b/hadrian/src/Settings/Packages/Haddock.hs deleted file mode 100644 index c8d667ecb4..0000000000 --- a/hadrian/src/Settings/Packages/Haddock.hs +++ /dev/null @@ -1,7 +0,0 @@ -module Settings.Packages.Haddock (haddockPackageArgs) where - -import Expression - -haddockPackageArgs :: Args -haddockPackageArgs = package haddock ? - builder GhcCabal ? pure ["--flag", "in-ghc-tree"] diff --git a/hadrian/src/Settings/Packages/Haskeline.hs b/hadrian/src/Settings/Packages/Haskeline.hs deleted file mode 100644 index 254c6b704c..0000000000 --- a/hadrian/src/Settings/Packages/Haskeline.hs +++ /dev/null @@ -1,8 +0,0 @@ -module Settings.Packages.Haskeline (haskelinePackageArgs) where - -import Expression -import Oracles.Flag (crossCompiling) - -haskelinePackageArgs :: Args -haskelinePackageArgs = - package haskeline ? builder GhcCabal ? crossCompiling ? arg "-f-terminfo" diff --git a/hadrian/src/Settings/Packages/IntegerGmp.hs b/hadrian/src/Settings/Packages/IntegerGmp.hs deleted file mode 100644 index 7c2b5f635b..0000000000 --- a/hadrian/src/Settings/Packages/IntegerGmp.hs +++ /dev/null @@ -1,24 +0,0 @@ -module Settings.Packages.IntegerGmp (integerGmpPackageArgs) where - -import Base -import Expression -import Oracles.Setting -import Rules.Gmp - --- TODO: Is this needed? --- ifeq "$(GMP_PREFER_FRAMEWORK)" "YES" --- libraries/integer-gmp_CONFIGURE_OPTS += --with-gmp-framework-preferred --- endif -integerGmpPackageArgs :: Args -integerGmpPackageArgs = package integerGmp ? do - path <- expr gmpBuildPath - let includeGmp = "-I" ++ path -/- "include" - gmpIncludeDir <- getSetting GmpIncludeDir - gmpLibDir <- getSetting GmpLibDir - mconcat [ builder Cc ? arg includeGmp - - , builder GhcCabal ? mconcat - [ (null gmpIncludeDir && null gmpLibDir) ? - arg "--configure-option=--with-intree-gmp" - , arg ("--configure-option=CFLAGS=" ++ includeGmp) - , arg ("--gcc-options=" ++ includeGmp) ] ] diff --git a/hadrian/src/Settings/Packages/Rts.hs b/hadrian/src/Settings/Packages/Rts.hs deleted file mode 100644 index cdc89dae56..0000000000 --- a/hadrian/src/Settings/Packages/Rts.hs +++ /dev/null @@ -1,224 +0,0 @@ -module Settings.Packages.Rts ( - rtsContext, rtsBuildPath, rtsConfIn, rtsPackageArgs, rtsLibffiLibrary - ) where - -import Base -import Expression -import Oracles.Flag -import Oracles.Setting -import Settings - --- | RTS is considered a Stage1 package. This determines RTS build directory. -rtsContext :: Context -rtsContext = vanillaContext Stage1 rts - --- | Path to the RTS build directory. -rtsBuildPath :: Action FilePath -rtsBuildPath = buildPath rtsContext - --- | Path to RTS package configuration file, to be processed by HsCpp. -rtsConfIn :: FilePath -rtsConfIn = pkgPath rts -/- "package.conf.in" - --- These numbers can be found at: --- https://msdn.microsoft.com/en-us/library/windows/desktop/aa383745(v=vs.85).aspx --- If we're compiling on windows, enforce that we only support Vista SP1+ --- Adding this here means it doesn't have to be done in individual .c files --- and also centralizes the versioning. --- | Minimum supported Windows version. -windowsVersion :: String -windowsVersion = "0x06000100" - -libffiLibraryName :: Action FilePath -libffiLibraryName = do - useSystemFfi <- flag UseSystemFfi - windows <- windowsHost - return $ case (useSystemFfi, windows) of - (True , False) -> "ffi" - (False, False) -> "Cffi" - (_ , True ) -> "Cffi-6" - -rtsLibffiLibrary :: Way -> Action FilePath -rtsLibffiLibrary way = do - name <- libffiLibraryName - suf <- libsuf way - rtsPath <- rtsBuildPath - return $ rtsPath -/- "lib" ++ name ++ suf - --- Compile various performance-critical pieces *without* -fPIC -dynamic --- even when building a shared library. If we don't do this, then the --- GC runs about 50% slower on x86 due to the overheads of PIC. The --- cost of doing this is a little runtime linking and less sharing, but --- not much. --- --- On x86_64 this doesn't work, because all objects in a shared library --- must be compiled with -fPIC (since the 32-bit relocations generated --- by the default small memory can't be resolved at runtime). So we --- only do this on i386. --- --- This apparently doesn't work on OS X (Darwin) nor on Solaris. --- On Darwin we get errors of the form --- --- ld: absolute addressing (perhaps -mdynamic-no-pic) used in _stg_ap_0_fast from rts/dist/build/Apply.dyn_o not allowed in slidable image --- --- and lots of these warnings: --- --- ld: warning codegen in _stg_ap_pppv_fast (offset 0x0000005E) prevents image from loading in dyld shared cache --- --- On Solaris we get errors like: --- --- Text relocation remains referenced --- against symbol offset in file --- .rodata (section) 0x11 rts/dist/build/Apply.dyn_o --- ... --- ld: fatal: relocations remain against allocatable but non-writable sections --- collect2: ld returned 1 exit status -speedHack :: Action Bool -speedHack = do - i386 <- anyTargetArch ["i386"] - goodOS <- not <$> anyTargetOs ["darwin", "solaris2"] - return $ i386 && goodOS - -rtsPackageArgs :: Args -rtsPackageArgs = package rts ? do - projectVersion <- getSetting ProjectVersion - hostPlatform <- getSetting HostPlatform - hostArch <- getSetting HostArch - hostOs <- getSetting HostOs - hostVendor <- getSetting HostVendor - buildPlatform <- getSetting BuildPlatform - buildArch <- getSetting BuildArch - buildOs <- getSetting BuildOs - buildVendor <- getSetting BuildVendor - targetPlatform <- getSetting TargetPlatform - targetArch <- getSetting TargetArch - targetOs <- getSetting TargetOs - targetVendor <- getSetting TargetVendor - ghcUnreg <- expr $ yesNo <$> flag GhcUnregisterised - ghcEnableTNC <- expr $ yesNo <$> ghcEnableTablesNextToCode - way <- getWay - path <- getBuildPath - top <- expr topDirectory - libffiName <- expr libffiLibraryName - ffiIncludeDir <- getSetting FfiIncludeDir - ffiLibraryDir <- getSetting FfiLibDir - ghclibDir <- expr installGhcLibDir - destDir <- expr getDestDir - let cArgs = mconcat - [ arg "-Irts" - , rtsWarnings - , arg $ "-I" ++ path - , flag UseSystemFfi ? arg ("-I" ++ ffiIncludeDir) - , arg $ "-DRtsWay=\"rts_" ++ show way ++ "\"" - -- RTS *must* be compiled with optimisations. The INLINE_HEADER macro - -- requires that functions are inlined to work as expected. Inlining - -- only happens for optimised builds. Otherwise we can assume that - -- there is a non-inlined variant to use instead. But RTS does not - -- provide non-inlined alternatives and hence needs the function to - -- be inlined. See https://github.com/snowleopard/hadrian/issues/90. - , arg "-O2" - - , Debug `wayUnit` way ? arg "-DDEBUG" - , way `elem` [debug, debugDynamic] ? arg "-DTICKY_TICKY" - , Profiling `wayUnit` way ? arg "-DPROFILING" - , Threaded `wayUnit` way ? arg "-DTHREADED_RTS" - - , inputs ["//RtsMessages.c", "//Trace.c"] ? - arg ("-DProjectVersion=" ++ show projectVersion) - - , input "//RtsUtils.c" ? pure - [ "-DProjectVersion=" ++ show projectVersion - , "-DHostPlatform=" ++ show hostPlatform - , "-DHostArch=" ++ show hostArch - , "-DHostOS=" ++ show hostOs - , "-DHostVendor=" ++ show hostVendor - , "-DBuildPlatform=" ++ show buildPlatform - , "-DBuildArch=" ++ show buildArch - , "-DBuildOS=" ++ show buildOs - , "-DBuildVendor=" ++ show buildVendor - , "-DTargetPlatform=" ++ show targetPlatform - , "-DTargetArch=" ++ show targetArch - , "-DTargetOS=" ++ show targetOs - , "-DTargetVendor=" ++ show targetVendor - , "-DGhcUnregisterised=" ++ show ghcUnreg - , "-DGhcEnableTablesNextToCode=" ++ show ghcEnableTNC ] - - , inputs ["//Evac.c", "//Evac_thr.c"] ? arg "-funroll-loops" - - , speedHack ? - inputs [ "//Evac.c", "//Evac_thr.c" - , "//Scav.c", "//Scav_thr.c" - , "//Compact.c", "//GC.c" ] ? arg "-fno-PIC" - -- -static is also necessary for these bits, otherwise the NCG - -- generates dynamic references: - , speedHack ? - inputs [ "//Updates.c", "//StgMiscClosures.c" - , "//PrimOps.c", "//Apply.c" - , "//AutoApply.c" ] ? pure ["-fno-PIC", "-static"] - - -- inlining warnings happen in Compact - , inputs ["//Compact.c"] ? arg "-Wno-inline" - - -- emits warnings about call-clobbered registers on x86_64 - , inputs [ "//RetainerProfile.c", "//StgCRun.c" - , "//win32/ConsoleHandler.c", "//win32/ThrIOManager.c"] ? arg "-w" - , inputs ["//RetainerSet.c"] ? arg "-Wno-format" - -- The above warning suppression flags are a temporary kludge. - -- While working on this module you are encouraged to remove it and fix - -- any warnings in the module. See: - -- http://ghc.haskell.org/trac/ghc/wiki/WorkingConventions#Warnings - - , (not <$> flag GccIsClang) ? - inputs ["//Compact.c"] ? arg "-finline-limit=2500" - - , inputs ["//Evac_thr.c", "//Scav_thr.c"] ? - pure ["-DPARALLEL_GC", "-Irts/sm"] - - , input "//StgCRun.c" ? windowsHost ? arg "-Wno-return-local-addr" - , input "//RetainerProfile.c" ? flag GccIsClang ? - arg "-Wno-incompatible-pointer-types" - , windowsHost ? arg ("-DWINVER=" ++ windowsVersion) - - -- libffi's ffi.h triggers various warnings - , inputs [ "//Interpreter.c", "//Storage.c", "//Adjustor.c" ] ? - arg "-Wno-strict-prototypes" - , inputs ["//Interpreter.c", "//Adjustor.c", "//sm/Storage.c"] ? - anyTargetArch ["powerpc"] ? arg "-Wno-undef" - ] - - mconcat - [ builder (Cc FindCDependencies) ? cArgs - , builder (Ghc CompileCWithGhc) ? map ("-optc" ++) <$> cArgs - , builder Ghc ? arg "-Irts" - - , builder HsCpp ? pure - [ "-DTOP=" ++ show top - , "-DFFI_INCLUDE_DIR=" ++ show ffiIncludeDir - , "-DFFI_LIB_DIR=" ++ show ffiLibraryDir - , "-DFFI_LIB=" ++ show libffiName ] - - , builder HsCpp ? - input "//package.conf.in" ? - output "//package.conf.install.raw" ? - pure [ "-DINSTALLING" - , "-DLIB_DIR=\"" ++ destDir ++ ghclibDir ++ "\"" - , "-DINCLUDE_DIR=\"" ++ destDir ++ ghclibDir -/- "include\"" ] - - , builder HsCpp ? flag HaveLibMingwEx ? arg "-DHAVE_LIBMINGWEX" ] - --- See @rts/ghc.mk@. -rtsWarnings :: Args -rtsWarnings = mconcat - [ pure ["-Wall", "-Werror"] - , arg "-Wextra" - , arg "-Wstrict-prototypes" - , arg "-Wmissing-prototypes" - , arg "-Wmissing-declarations" - , arg "-Winline" - , arg "-Waggregate-return" - , arg "-Wpointer-arith" - , arg "-Wmissing-noreturn" - , arg "-Wnested-externs" - , arg "-Wredundant-decls" - , arg "-Wundef" - , arg "-fno-strict-aliasing" ] diff --git a/hadrian/src/Settings/Packages/RunGhc.hs b/hadrian/src/Settings/Packages/RunGhc.hs deleted file mode 100644 index 03a19c8373..0000000000 --- a/hadrian/src/Settings/Packages/RunGhc.hs +++ /dev/null @@ -1,9 +0,0 @@ -module Settings.Packages.RunGhc (runGhcPackageArgs) where - -import Oracles.Setting -import Expression - -runGhcPackageArgs :: Args -runGhcPackageArgs = package runGhc ? builder Ghc ? input "//Main.hs" ? do - version <- getSetting ProjectVersion - pure ["-cpp", "-DVERSION=" ++ show version] diff --git a/hadrian/src/Settings/Warnings.hs b/hadrian/src/Settings/Warnings.hs deleted file mode 100644 index abbc814291..0000000000 --- a/hadrian/src/Settings/Warnings.hs +++ /dev/null @@ -1,56 +0,0 @@ -module Settings.Warnings (defaultGhcWarningsArgs, warningArgs) where - -import Expression -import Oracles.Flag -import Oracles.Setting -import Settings - --- See @mk/warnings.mk@ for warning-related arguments in the Make build system. - --- | Default Haskell warning-related arguments. -defaultGhcWarningsArgs :: Args -defaultGhcWarningsArgs = mconcat - [ notStage0 ? pure [ "-Werror", "-Wnoncanonical-monad-instances" ] - , (not <$> flag GccIsClang) ? mconcat - [ (not <$> windowsHost ) ? arg "-optc-Werror=unused-but-set-variable" - , arg "-optc-Wno-error=inline" ] - , flag GccIsClang ? arg "-optc-Wno-unknown-pragmas" ] - --- | Package-specific warnings-related arguments, mostly suppressing various warnings. -warningArgs :: Args -warningArgs = builder Ghc ? do - isIntegerSimple <- (== integerSimple) <$> getIntegerPackage - mconcat - [ stage0 ? mconcat - [ libraryPackage ? pure [ "-fno-warn-deprecated-flags" ] - , package terminfo ? pure [ "-fno-warn-unused-imports" ] - , package transformers ? pure [ "-fno-warn-unused-matches" - , "-fno-warn-unused-imports" ] ] - , notStage0 ? mconcat - [ libraryPackage ? pure [ "-Wno-deprecated-flags" ] - , package base ? pure [ "-Wno-trustworthy-safe" ] - , package binary ? pure [ "-Wno-deprecations" ] - , package bytestring ? pure [ "-Wno-inline-rule-shadowing" ] - , package compiler ? pure [ "-Wcpp-undef" ] - , package directory ? pure [ "-Wno-unused-imports" ] - , package ghc ? pure [ "-Wcpp-undef" ] - , package ghcPrim ? pure [ "-Wno-trustworthy-safe" ] - , package haddock ? pure [ "-Wno-unused-imports" - , "-Wno-deprecations" ] - , package haskeline ? pure [ "-Wno-deprecations" - , "-Wno-unused-imports" - , "-Wno-redundant-constraints" - , "-Wno-simplifiable-class-constraints" ] - , package pretty ? pure [ "-Wno-unused-imports" ] - , package primitive ? pure [ "-Wno-unused-imports" - , "-Wno-deprecations" ] - , package rts ? pure [ "-Wcpp-undef" ] - , package terminfo ? pure [ "-Wno-unused-imports" ] - , isIntegerSimple ? - package text ? pure [ "-Wno-unused-imports" ] - , package transformers ? pure [ "-Wno-unused-matches" - , "-Wno-unused-imports" - , "-Wno-redundant-constraints" - , "-Wno-orphans" ] - , package win32 ? pure [ "-Wno-trustworthy-safe" ] - , package xhtml ? pure [ "-Wno-unused-imports" ] ] ] |