[commit: ghc] wip/nfs-locking: ghcPkg Wrapper (aee3088)
git at git.haskell.org
git at git.haskell.org
Thu Oct 26 23:33:39 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/aee308892e923e8f2ba24d912fc3197599ef47a8/ghc
>---------------------------------------------------------------
commit aee308892e923e8f2ba24d912fc3197599ef47a8
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date: Thu Dec 31 20:21:13 2015 +0800
ghcPkg Wrapper
>---------------------------------------------------------------
aee308892e923e8f2ba24d912fc3197599ef47a8
shaking-up-ghc.cabal | 1 +
src/Rules/Program.hs | 4 +++-
src/Rules/Wrappers/GhcPkg.hs | 20 ++++++++++++++++++++
3 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/shaking-up-ghc.cabal b/shaking-up-ghc.cabal
index cfa55ff..2c75566 100644
--- a/shaking-up-ghc.cabal
+++ b/shaking-up-ghc.cabal
@@ -55,6 +55,7 @@ executable ghc-shake
, Rules.Program
, Rules.Resources
, Rules.Wrappers.Ghc
+ , Rules.Wrappers.GhcPkg
, Settings
, Settings.Args
, Settings.Builders.Alex
diff --git a/src/Rules/Program.hs b/src/Rules/Program.hs
index a1aaa2f..75314c3 100644
--- a/src/Rules/Program.hs
+++ b/src/Rules/Program.hs
@@ -10,6 +10,7 @@ import Rules.Actions
import Rules.Library
import Rules.Resources
import Rules.Wrappers.Ghc
+import Rules.Wrappers.GhcPkg
import Settings
import Settings.Builders.GhcCabal
@@ -22,7 +23,8 @@ type Wrapper = FilePath -> Expr String
-- List of wrappers we build
wrappers :: [(PartialTarget, Wrapper)]
-wrappers = [(PartialTarget Stage0 ghc, ghcWrapper)]
+wrappers = [ (PartialTarget Stage0 ghc, ghcWrapper)
+ , (PartialTarget Stage0 ghcPkg, ghcPkgWrapper)]
buildProgram :: Resources -> PartialTarget -> Rules ()
buildProgram _ target @ (PartialTarget stage pkg) = do
diff --git a/src/Rules/Wrappers/GhcPkg.hs b/src/Rules/Wrappers/GhcPkg.hs
new file mode 100644
index 0000000..7edc43c
--- /dev/null
+++ b/src/Rules/Wrappers/GhcPkg.hs
@@ -0,0 +1,20 @@
+module Rules.Wrappers.GhcPkg (ghcPkgWrapper) where
+
+import Base
+import Expression
+import Oracles
+
+-- Note about wrapper:
+-- bindir is usually GhcSourcePath / inplace / bin
+-- topdir is usually GhcSourcePath / inplace / lib
+-- datadir is usually the same as topdir
+
+ghcPkgWrapper :: FilePath -> Expr String
+ghcPkgWrapper program = do
+ lift $ need [sourcePath -/- "Rules/Wrappers/GhcPkg.hs"]
+ top <- getSetting GhcSourcePath
+ let pkgConf = top -/- "inplace" -/- "lib" -/- "package.conf.d"
+ return $ unlines
+ [ "#!/bin/bash"
+ , "exec " ++ (top -/- program)
+ ++ " --global-package-db " ++ pkgConf ++ " ${1+\"$@\"}" ]
More information about the ghc-commits
mailing list