[commit: ghc] wip/nfs-locking: Add support for compiling programs with Ghc builder. (d7b3d34)
git at git.haskell.org
git at git.haskell.org
Fri Oct 27 00:09:55 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/d7b3d34b16e2519f2fa2d1eae96dd469d29e5824/ghc
>---------------------------------------------------------------
commit d7b3d34b16e2519f2fa2d1eae96dd469d29e5824
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Mon Dec 7 01:42:30 2015 +0000
Add support for compiling programs with Ghc builder.
>---------------------------------------------------------------
d7b3d34b16e2519f2fa2d1eae96dd469d29e5824
src/Settings/Builders/Ghc.hs | 32 +++++++++++++++++++++-----------
1 file changed, 21 insertions(+), 11 deletions(-)
diff --git a/src/Settings/Builders/Ghc.hs b/src/Settings/Builders/Ghc.hs
index ad34e19..8ab4357 100644
--- a/src/Settings/Builders/Ghc.hs
+++ b/src/Settings/Builders/Ghc.hs
@@ -2,24 +2,32 @@ module Settings.Builders.Ghc (ghcArgs, ghcMArgs, commonGhcArgs) where
import Expression
import Oracles
-import Predicates (stagedBuilder, splitObjects, stage0, notStage0)
+import GHC
+import Predicates (package, stagedBuilder, splitObjects, stage0, notStage0)
import Settings
-- TODO: add support for -dyno
+-- TODO: consider adding a new builder for programs (e.g. GhcLink?)
-- $1/$2/build/%.$$($3_o-bootsuf) : $1/$4/%.hs-boot
-- $$(call cmd,$1_$2_HC) $$($1_$2_$3_ALL_HC_OPTS) -c $$< -o $$@
-- $$(if $$(findstring YES,$$($1_$2_DYNAMIC_TOO)),-dyno
-- $$(addsuffix .$$(dyn_osuf)-boot,$$(basename $$@)))
ghcArgs :: Args
-ghcArgs = stagedBuilder Ghc ? mconcat [ commonGhcArgs
- , arg "-H32m"
- , stage0 ? arg "-O"
- , notStage0 ? arg "-O2"
- , arg "-Wall"
- , arg "-fwarn-tabs"
- , splitObjects ? arg "-split-objs"
- , arg "-c", append =<< getInputs
- , arg "-o", arg =<< getOutput ]
+ghcArgs = stagedBuilder Ghc ? do
+ output <- getOutput
+ way <- getWay
+ let buildObj = ("//*." ++ osuf way) ?== output || ("//*." ++ obootsuf way) ?== output
+ mconcat [ commonGhcArgs
+ , arg "-H32m"
+ , stage0 ? arg "-O"
+ , notStage0 ? arg "-O2"
+ , arg "-Wall"
+ , arg "-fwarn-tabs"
+ , buildObj ? splitObjects ? arg "-split-objs"
+ , package ghc ? arg "-no-hs-main"
+ , buildObj ? arg "-c"
+ , append =<< getInputs
+ , arg "-o", arg =<< getOutput ]
ghcMArgs :: Args
ghcMArgs = stagedBuilder GhcM ? do
@@ -71,6 +79,7 @@ wayGhcArgs = do
packageGhcArgs :: Args
packageGhcArgs = do
stage <- getStage
+ pkg <- getPackage
supportsPackageKey <- getFlag SupportsPackageKey
pkgKey <- getPkgData PackageKey
pkgDepIds <- getPkgDataList DepIds
@@ -78,7 +87,8 @@ packageGhcArgs = do
[ arg "-hide-all-packages"
, arg "-no-user-package-db"
, stage0 ? arg "-package-db libraries/bootstrapping.conf"
- , if supportsPackageKey || stage /= Stage0
+ , isLibrary pkg ?
+ if supportsPackageKey || stage /= Stage0
then arg $ "-this-package-key " ++ pkgKey
else arg $ "-package-name " ++ pkgKey
, append $ map ("-package-id " ++) pkgDepIds ]
More information about the ghc-commits
mailing list