Commit aee30889 authored by Moritz Angermann's avatar Moritz Angermann
Browse files

ghcPkg Wrapper

parent d9d00b86
......@@ -55,6 +55,7 @@ executable ghc-shake
, Rules.Program
, Rules.Resources
, Rules.Wrappers.Ghc
, Rules.Wrappers.GhcPkg
, Settings
, Settings.Args
, Settings.Builders.Alex
......
......@@ -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
......
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+\"$@\"}" ]
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment