Commit c8260540 authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Add buildPackageCompile rule.

parent ccb58488
......@@ -2,6 +2,7 @@ module Package (packageRules) where
import Package.Base
import Package.Data
import Package.Compile
import Package.Dependencies
-- See Package.Base for definitions of basic types
......@@ -15,11 +16,13 @@ buildPackage :: Package -> TodoItem -> Rules ()
buildPackage pkg todoItem = do
buildPackageData pkg todoItem
buildPackageDependencies pkg todoItem
buildPackageCompile pkg todoItem
packageRules :: Rules ()
packageRules = do
-- TODO: control targets from commang line arguments
want ["libraries/deepseq/dist-install/build/deepseq.m"]
want [ "libraries/deepseq/dist-install/build/Control/DeepSeq.o"
, "libraries/deepseq/dist-install/build/Control/DeepSeq.p_o" ]
forM_ packages $ \pkg -> do
forM_ (pkgTodo pkg) $ \todoItem -> do
buildPackage pkg todoItem
......@@ -38,7 +38,7 @@ configureArgs stage settings =
<> argConf "--with-cc" Gcc
buildPackageData :: Package -> TodoItem -> Rules ()
buildPackageData pkg @ (Package name path _) (stage, dist, settings) =
buildPackageData (Package name path _) (stage, dist, settings) =
let buildDir = path </> dist
cabalArgs = arg ["configure", path, dist]
-- this is a positional argument, hence:
......
......@@ -3,34 +3,8 @@ module Package.Dependencies (buildPackageDependencies) where
import Package.Base
packageArgs :: Stage -> FilePath -> Args
packageArgs stage pkgData = do
usePackageKey <- SupportsPackageKey || stage /= Stage0
arg ["-hide-all-packages", "-no-user-package-db", "-include-pkg-deps"]
<> when (stage == Stage0) (arg "-package-db libraries/bootstrapping.conf")
<> keyArgs usePackageKey
where
keyArgs True = prefixArgs "-this-package-key" (PackageKey pkgData) <>
prefixArgs "-package-key" (DepKeys pkgData)
keyArgs False = prefixArgs "-package-name" (PackageKey pkgData) <>
prefixArgs "-package" (Deps pkgData)
includeArgs :: ShowArgs a => String -> FilePath -> a -> Args
includeArgs prefix path as = map includePath <$> arg as
where
includePath dir | isRelative dir = prefix ++ path </> dir
| isAbsolute dir = prefix </> dir
srcArgs :: FilePath -> FilePath -> Args
srcArgs path pkgData = do
mods <- map (replaceEq '.' pathSeparator) <$> arg (Modules pkgData)
dirs <- arg (SrcDirs pkgData)
srcs <- getDirectoryFiles ""
[path </> dir </> mPath <.> ext | dir <- dirs, mPath <- mods, ext <- ["hs", "lhs"]]
arg (map normalise srcs)
buildPackageDependencies :: Package -> TodoItem -> Rules ()
buildPackageDependencies pkg @ (Package name path _) (stage, dist, settings) =
buildPackageDependencies (Package name path _) (stage, dist, settings) =
let buildDir = path </> dist
pkgData = buildDir </> "package-data.mk"
in
......
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