Commit 6b358c3d authored by Andrey Mokhov's avatar Andrey Mokhov
Browse files

Fix parallel build, clean up code.

parent 59802180
......@@ -20,23 +20,24 @@ data PackageData = BuildGhciLib FilePath
| Synopsis FilePath
| Version FilePath
data PackageDataList = CcArgs FilePath
| CSrcs FilePath
| CppArgs FilePath
| DepCcArgs FilePath
| DepExtraLibs FilePath
| DepIds FilePath
| DepIncludeDirs FilePath
| DepLdArgs FilePath
| DepLibDirs FilePath
| DepNames FilePath
| Deps FilePath
| HiddenModules FilePath
| HsArgs FilePath
| IncludeDirs FilePath
| LdArgs FilePath
| Modules FilePath
| SrcDirs FilePath
data PackageDataList = CcArgs FilePath
| CSrcs FilePath
| CppArgs FilePath
| DepCcArgs FilePath
| DepExtraLibs FilePath
| DepIds FilePath
| DepIncludeDirs FilePath
| DepLdArgs FilePath
| DepLibDirs FilePath
| DepNames FilePath
| Deps FilePath
| HiddenModules FilePath
| HsArgs FilePath
| IncludeDirs FilePath
| LdArgs FilePath
| Modules FilePath
| SrcDirs FilePath
| TransitiveDepNames FilePath
newtype PackageDataKey = PackageDataKey (FilePath, String)
deriving (Show, Typeable, Eq, Hashable, Binary, NFData)
......@@ -60,23 +61,24 @@ pkgData packageData = case packageData of
pkgDataList :: PackageDataList -> Action [String]
pkgDataList packageData = fmap (map unquote . words) $ case packageData of
CcArgs path -> askPackageData path "CC_OPTS"
CSrcs path -> askPackageData path "C_SRCS"
CppArgs path -> askPackageData path "CPP_OPTS"
DepCcArgs path -> askPackageData path "DEP_CC_OPTS"
DepExtraLibs path -> askPackageData path "DEP_EXTRA_LIBS"
DepIds path -> askPackageData path "DEP_IPIDS"
DepIncludeDirs path -> askPackageData path "DEP_INCLUDE_DIRS_SINGLE_QUOTED"
DepLibDirs path -> askPackageData path "DEP_LIB_DIRS_SINGLE_QUOTED"
DepLdArgs path -> askPackageData path "DEP_LD_OPTS"
DepNames path -> askPackageData path "DEP_NAMES"
Deps path -> askPackageData path "DEPS"
HiddenModules path -> askPackageData path "HIDDEN_MODULES"
HsArgs path -> askPackageData path "HC_OPTS"
IncludeDirs path -> askPackageData path "INCLUDE_DIRS"
LdArgs path -> askPackageData path "LD_OPTS"
Modules path -> askPackageData path "MODULES"
SrcDirs path -> askPackageData path "HS_SRC_DIRS"
CcArgs path -> askPackageData path "CC_OPTS"
CSrcs path -> askPackageData path "C_SRCS"
CppArgs path -> askPackageData path "CPP_OPTS"
DepCcArgs path -> askPackageData path "DEP_CC_OPTS"
DepExtraLibs path -> askPackageData path "DEP_EXTRA_LIBS"
DepIds path -> askPackageData path "DEP_IPIDS"
DepIncludeDirs path -> askPackageData path "DEP_INCLUDE_DIRS_SINGLE_QUOTED"
DepLibDirs path -> askPackageData path "DEP_LIB_DIRS_SINGLE_QUOTED"
DepLdArgs path -> askPackageData path "DEP_LD_OPTS"
DepNames path -> askPackageData path "DEP_NAMES"
Deps path -> askPackageData path "DEPS"
HiddenModules path -> askPackageData path "HIDDEN_MODULES"
HsArgs path -> askPackageData path "HC_OPTS"
IncludeDirs path -> askPackageData path "INCLUDE_DIRS"
LdArgs path -> askPackageData path "LD_OPTS"
Modules path -> askPackageData path "MODULES"
SrcDirs path -> askPackageData path "HS_SRC_DIRS"
TransitiveDepNames path -> askPackageData path "TRANSITIVE_DEP_NAMES"
where
unquote = dropWhile (== '\'') . dropWhileEnd (== '\'')
......
......@@ -12,8 +12,7 @@ import Settings.Builders.GhcCabal
-- Build package-data.mk by using GhcCabal to process pkgCabal file
buildPackageData :: Resources -> PartialTarget -> Rules ()
buildPackageData rs target @ (PartialTarget stage pkg) = do
let path = targetPath stage pkg
cabalFile = pkgCabalFile pkg
let cabalFile = pkgCabalFile pkg
configure = pkgPath pkg -/- "configure"
dataFile = pkgDataFile stage pkg
......
......@@ -29,7 +29,7 @@ buildProgram _ target @ (PartialTarget stage pkg) = do
objs = cObjs ++ hObjs
pkgs <- interpretPartial target getPackages
ways <- interpretPartial target getWays
depNames <- interpretPartial target $ getPkgDataList DepNames
depNames <- interpretPartial target $ getPkgDataList TransitiveDepNames
ghciFlag <- interpretPartial target $ getPkgData BuildGhciLib
let deps = matchPackageNames (sort pkgs) (sort depNames)
ghci = ghciFlag == "YES" && stage == Stage1
......@@ -44,8 +44,8 @@ buildProgram _ target @ (PartialTarget stage pkg) = do
return $ libFiles ++ [ pkgGhciLibraryFile stage dep compId | ghci ]
let binDeps = if pkg == ghcCabal && stage == Stage0
then [ pkgPath pkg -/- src <.> "hs" | src <- hSrcs ]
else objs ++ libs
need binDeps
else objs
need $ binDeps ++ libs
build $ fullTargetWithWay target (Ghc stage) vanilla binDeps [bin]
synopsis <- interpretPartial target $ getPkgData Synopsis
putSuccess $ renderBox
......
......@@ -20,7 +20,7 @@ packagesStage0 :: Packages
packagesStage0 = mconcat
[ append [ binary, cabal, compiler, ghc, ghcBoot, ghcCabal, ghcPkg
, hsc2hs, hoopl, hpc, templateHaskell, transformers ]
, stage0 ? append [deriveConstants, genapply, genprimopcode, hp2ps]
, stage0 ? append [deriveConstants, dllSplit, genapply, genprimopcode, hp2ps]
, notM windowsHost ? notM (anyHostOs ["ios"]) ? append [terminfo] ]
-- TODO: what do we do with parallel, stm, random, primitive, vector and dph?
......@@ -28,9 +28,8 @@ packagesStage1 :: Packages
packagesStage1 = mconcat
[ packagesStage0
, append [ array, base, bytestring, containers, compareSizes, deepseq
, directory, dllSplit, filepath
, ghci, ghcPrim, ghcPwd, haskeline, hpcBin, integerLibrary
, mkUserGuidePart, pretty, process, runghc, time ]
, directory, filepath, ghci, ghcPrim, ghcPwd, haskeline, hpcBin
, integerLibrary, mkUserGuidePart, pretty, process, runghc, time ]
, windowsHost ? append [win32]
, notM windowsHost ? append [unix]
, notM windowsHost ? append [iservBin]
......
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