Commit 35d9a072 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add targetPath.

parent f62f1668
......@@ -6,7 +6,6 @@ module Rules (
import Base hiding (arg, args, Args)
import Control.Monad
import Package
import Expression
import Rules.Package
import Settings.Packages
......@@ -19,8 +18,7 @@ generateTargets = action $
forM_ [Stage0 ..] $ \stage -> do
pkgs <- interpret (stageTarget stage) packages
forM_ pkgs $ \pkg -> do
let dir = targetDirectory stage pkg
need [pkgPath pkg </> dir </> "package-data.mk"]
need [targetPath stage pkg </> "package-data.mk"]
-- TODO: add Stage2 (compiler only?)
packageRules :: Rules ()
......
......@@ -18,9 +18,9 @@ buildPackageData :: Target -> Rules ()
buildPackageData target =
let stage = getStage target
pkg = getPackage target
dir = pkgPath pkg </> targetDirectory stage pkg
path = targetPath stage pkg
in
(dir </>) <$>
(path </>) <$>
[ "package-data.mk"
, "haddock-prologue.txt"
, "inplace-pkg-config"
......@@ -31,7 +31,7 @@ buildPackageData target =
] &%> \_ -> do
let configure = pkgPath pkg </> "configure"
-- TODO: 1) how to automate this? 2) handle multiple files?
newEnv = target { getFile = dir </> "package-data.mk" }
newEnv = target { getFile = path </> "package-data.mk" }
-- GhcCabal will run the configure script, so we depend on it
need [pkgPath pkg </> pkgCabal pkg]
-- We still don't know who built the configure script from configure.ac
......@@ -39,7 +39,7 @@ buildPackageData target =
run' newEnv GhcCabal
-- TODO: when (registerPackage settings) $
run' newEnv (GhcPkg stage)
postProcessPackageData $ dir </> "package-data.mk"
postProcessPackageData $ path </> "package-data.mk"
-- TODO: This should probably go to Oracles.Builder
run' :: Target -> Builder -> Action ()
......
......@@ -106,6 +106,7 @@ packageConstraints = do
args $ concatMap (\c -> ["--constraint", c]) $ constraints
-- TODO: should be in a different file
-- TODO: put all validating options together in one file
ccSettings :: Settings
ccSettings = validating ? do
let gccGe46 = liftM not gccLt46
......
......@@ -3,7 +3,6 @@ module Settings.GhcPkg (
) where
import Base hiding (arg, args)
import Package
import Switches
import Expression hiding (when, liftIO)
import Settings.Util
......@@ -15,9 +14,8 @@ ghcPkgSettings :: Settings
ghcPkgSettings = do
pkg <- asks getPackage
stage <- asks getStage
let dir = pkgPath pkg </> targetDirectory stage pkg
builder (GhcPkg stage) ? mconcat
[ arg "update"
, arg "--force"
, stage0 ? bootPackageDbSettings
, arg $ dir </> "inplace-pkg-config" ]
, arg $ targetPath stage pkg </> "inplace-pkg-config" ]
module Settings.TargetDirectory (
targetDirectory
targetDirectory, targetPath
) where
import Base
......@@ -9,3 +9,7 @@ import UserSettings
-- User can override the default target directory settings given below
targetDirectory :: Stage -> Package -> FilePath
targetDirectory = userTargetDirectory
-- Path to the target directory from GHC source root
targetPath :: Stage -> Package -> FilePath
targetPath stage pkg = pkgPath pkg </> targetDirectory stage pkg
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