summaryrefslogtreecommitdiff
path: root/hadrian/src/Settings/Builders
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/src/Settings/Builders')
-rw-r--r--hadrian/src/Settings/Builders/Alex.hs8
-rw-r--r--hadrian/src/Settings/Builders/Cc.hs26
-rw-r--r--hadrian/src/Settings/Builders/Common.hs58
-rw-r--r--hadrian/src/Settings/Builders/Configure.hs25
-rw-r--r--hadrian/src/Settings/Builders/DeriveConstants.hs39
-rw-r--r--hadrian/src/Settings/Builders/GenPrimopCode.hs24
-rw-r--r--hadrian/src/Settings/Builders/Ghc.hs149
-rw-r--r--hadrian/src/Settings/Builders/GhcCabal.hs118
-rw-r--r--hadrian/src/Settings/Builders/GhcPkg.hs17
-rw-r--r--hadrian/src/Settings/Builders/Haddock.hs63
-rw-r--r--hadrian/src/Settings/Builders/Happy.hs9
-rw-r--r--hadrian/src/Settings/Builders/HsCpp.hs16
-rw-r--r--hadrian/src/Settings/Builders/Hsc2Hs.hs56
-rw-r--r--hadrian/src/Settings/Builders/Ld.hs9
-rw-r--r--hadrian/src/Settings/Builders/Make.hs16
-rw-r--r--hadrian/src/Settings/Builders/Xelatex.hs7
16 files changed, 0 insertions, 640 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 ]