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

Get rid of gmpLibNameCache.

Fix #206.
parent 27317cf1
......@@ -7,7 +7,6 @@ import Expression
import GHC
import Oracles.Config.Setting
import Rules.Actions
import Settings.Builders.Ghc
import Settings.Packages.IntegerGmp
import Settings.User
......@@ -67,7 +66,7 @@ gmpRules :: Rules ()
gmpRules = do
-- TODO: split into multiple rules
[gmpLibraryH, gmpLibNameCache] &%> \_ -> do
gmpLibraryH %> \_ -> do
when trackBuildSystem $ need [sourcePath -/- "Rules/Gmp.hs"]
liftIO $ removeFiles gmpBuildPath ["//*"]
......@@ -83,22 +82,16 @@ gmpRules = do
createDirectory $ takeDirectory gmpLibraryH
-- We don't use system GMP on Windows. TODO: fix?
-- TODO: we do not track "config.mk" and "integer-gmp.buildinfo", see #173
windows <- windowsHost
-- TODO: we don't track "config.mk" & "integer-gmp.buildinfo", see #173
windows <- windowsHost
configMk <- liftIO . readFile $ gmpBase -/- "config.mk"
if not windows && any (`isInfixOf` configMk) [ "HaveFrameworkGMP = YES", "HaveLibGmp = YES" ]
if not windows && any (`isInfixOf` configMk)
[ "HaveFrameworkGMP = YES", "HaveLibGmp = YES" ]
then do
putBuild "| GMP library/framework detected and will be used"
copyFile gmpLibraryFakeH gmpLibraryH
buildInfo <- liftIO . readFile $ pkgPath integerGmp -/- "integer-gmp.buildinfo"
let prefix = "extra-libraries: "
libs s = case stripPrefix prefix s of
Nothing -> []
Just value -> words value
writeFileChanged gmpLibNameCache . unlines . concatMap libs $ lines buildInfo
else do
putBuild "| No GMP library/framework detected; in tree GMP will be built"
writeFileChanged gmpLibNameCache ""
-- Note: We use a tarball like gmp-4.2.4-nodoc.tar.bz2, which is
-- gmp-4.2.4.tar.bz2 repacked without the doc/ directory contents.
......
module Settings.Builders.Ghc (
ghcBuilderArgs, ghcMBuilderArgs, commonGhcArgs, gmpLibNameCache
ghcBuilderArgs, ghcMBuilderArgs, commonGhcArgs
) where
import Base
......@@ -23,12 +23,12 @@ ghcBuilderArgs = stagedBuilder Ghc ? do
stage <- getStage
way <- getWay
when (stage > Stage0) . lift $ needTouchy
let buildObj = ("//*." ++ osuf way) ?== output || ("//*." ++ obootsuf way) ?== output
buildHi = ("//*." ++ hisuf way) ?== output || ("//*." ++ hibootsuf way) ?== output
let buildObj = any (\s -> ("//*." ++ s way) ?== output) [ osuf, obootsuf]
buildHi = any (\s -> ("//*." ++ s way) ?== output) [hisuf, hibootsuf]
buildProg = not (buildObj || buildHi)
libs <- getPkgDataList DepExtraLibs
gmpLibs <- if stage > Stage0 && buildProg
then lift $ readFileLines gmpLibNameCache -- TODO: use oracles
then words <$> getSetting GmpLibDir
else return []
libDirs <- getPkgDataList DepLibDirs
mconcat [ commonGhcArgs
......@@ -47,7 +47,7 @@ ghcBuilderArgs = stagedBuilder Ghc ? do
, not buildHi ? mconcat [ arg "-o", arg =<< getOutput ] ]
needTouchy :: Action ()
needTouchy = whenM windowsHost $ need [fromJust $ programPath Stage0 touchy ]
needTouchy = whenM windowsHost $ need [fromJust $ programPath Stage0 touchy]
splitObjectsArgs :: Args
splitObjectsArgs = splitObjects ? do
......
module Settings.Paths (
targetDirectory, targetPath, pkgDataFile, pkgHaddockFile, pkgLibraryFile,
pkgLibraryFile0, pkgGhciLibraryFile, gmpBuildPath, gmpLibNameCache,
packageDbDirectory, pkgConfFile
pkgLibraryFile0, pkgGhciLibraryFile, gmpBuildPath, packageDbDirectory,
pkgConfFile
) where
import Base
......@@ -51,10 +51,6 @@ pkgFile stage pkg prefix suffix = do
gmpBuildPath :: FilePath
gmpBuildPath = buildRootPath -/- "stage1/gmp"
-- GMP library names extracted from integer-gmp.buildinfo
gmpLibNameCache :: FilePath
gmpLibNameCache = gmpBuildPath -/- "gmp-lib-names"
-- TODO: move to buildRootPath, see #113
-- StageN, N > 0, share the same packageDbDirectory
packageDbDirectory :: Stage -> FilePath
......
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