[commit: ghc] wip/nfs-locking: Split the GMP build rule even further (d12066d)
git at git.haskell.org
git at git.haskell.org
Fri Oct 27 01:09:23 UTC 2017
Repository : ssh://git@git.haskell.org/ghc
On branch : wip/nfs-locking
Link : http://ghc.haskell.org/trac/ghc/changeset/d12066d8d457e2ea7dbc4afa37e8acaac6afa413/ghc
>---------------------------------------------------------------
commit d12066d8d457e2ea7dbc4afa37e8acaac6afa413
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date: Sun Oct 2 03:23:42 2016 +0100
Split the GMP build rule even further
See #289.
>---------------------------------------------------------------
d12066d8d457e2ea7dbc4afa37e8acaac6afa413
src/Rules/Gmp.hs | 36 +++++++++++++++++++++---------------
1 file changed, 21 insertions(+), 15 deletions(-)
diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index 66d6c0b..0a53102 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -23,6 +23,9 @@ gmpLibraryInTreeH = gmpBuildPath -/- "include/gmp.h"
gmpLibrary :: FilePath
gmpLibrary = gmpBuildPath -/- ".libs/libgmp.a"
+gmpMakefile :: FilePath
+gmpMakefile = gmpBuildPath -/- "Makefile"
+
gmpPatches :: [FilePath]
gmpPatches = (gmpBase -/-) <$> ["gmpsrc.patch", "tarball/gmp-5.0.4.patch"]
@@ -33,24 +36,27 @@ configureEnvironment = sequence [ builderEnvironment "CC" $ Cc CompileC Stage1
gmpRules :: Rules ()
gmpRules = do
- gmpLibraryH %> \_ -> do
+ -- Copy appropriate GMP header and object files
+ gmpLibraryH %> \header -> do
+ createDirectory $ takeDirectory header
windows <- windowsHost
configMk <- readFile' $ gmpBase -/- "config.mk"
if not windows && -- TODO: We don't use system GMP on Windows. Fix?
any (`isInfixOf` configMk) [ "HaveFrameworkGMP = YES", "HaveLibGmp = YES" ]
then do
putBuild "| GMP library/framework detected and will be used"
- createDirectory $ takeDirectory gmpLibraryH
- copyFile (gmpBase -/- "ghc-gmp.h") gmpLibraryH
+ copyFile (gmpBase -/- "ghc-gmp.h") header
else do
putBuild "| No GMP library/framework detected; in tree GMP will be built"
- build $ Target gmpContext (Make gmpBuildPath) [] []
- createDirectory $ takeDirectory gmpLibraryH
- copyFile (gmpBuildPath -/- "gmp.h") gmpLibraryH
- copyFile (gmpBuildPath -/- "gmp.h") gmpLibraryInTreeH
+ need [gmpLibrary]
createDirectory gmpObjects
build $ Target gmpContext Ar [gmpLibrary] [gmpObjects]
+ copyFile (gmpBuildPath -/- "gmp.h") header
+ copyFile (gmpBuildPath -/- "gmp.h") gmpLibraryInTreeH
+ -- Build in-tree GMP library
+ gmpLibrary %> \lib -> do
+ build $ Target gmpContext (Make gmpBuildPath) [gmpMakefile] [lib]
putSuccess "| Successfully built custom library 'gmp'"
-- In-tree GMP header is built in the gmpLibraryH rule
@@ -60,8 +66,15 @@ gmpRules = do
[gmpBase -/- "config.mk", gmpBuildInfoPath] &%> \_ ->
need [pkgDataFile gmpContext]
+ -- Run GMP's configure script
+ gmpMakefile %> \mk -> do
+ env <- configureEnvironment
+ need [mk <.> "in"]
+ buildWithCmdOptions env $
+ Target gmpContext (Configure gmpBuildPath) [mk <.> "in"] [mk]
+
-- Extract in-tree GMP sources and apply patches
- gmpBuildPath -/- "Makefile.in" %> \_ -> do
+ gmpMakefile <.> "in" %> \_ -> do
removeDirectory gmpBuildPath
-- 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.
@@ -89,10 +102,3 @@ gmpRules = do
libName = unpack $ stripSuffix "-nodoc-patched" name
moveDirectory (tmp -/- libName) gmpBuildPath
-
- -- Run GMP's configure script
- gmpBuildPath -/- "Makefile" %> \mk -> do
- env <- configureEnvironment
- need [mk <.> "in"]
- buildWithCmdOptions env $
- Target gmpContext (Configure gmpBuildPath) [mk <.> "in"] [mk]
More information about the ghc-commits
mailing list