[commit: ghc] wip/nfs-locking: Call GMP's configure in gmpBuildPath. (a228b96)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:58:11 UTC 2017


Repository : ssh://git@git.haskell.org/ghc

On branch  : wip/nfs-locking
Link       : http://ghc.haskell.org/trac/ghc/changeset/a228b96c3ab519968384ff1a5f88353225ff3544/ghc

>---------------------------------------------------------------

commit a228b96c3ab519968384ff1a5f88353225ff3544
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Thu May 5 03:01:40 2016 +0100

    Call GMP's configure in gmpBuildPath.


>---------------------------------------------------------------

a228b96c3ab519968384ff1a5f88353225ff3544
 src/Rules/Gmp.hs                   | 54 ++++++++++++++++++++------------------
 src/Settings/Builders/Configure.hs |  2 +-
 2 files changed, 30 insertions(+), 26 deletions(-)

diff --git a/src/Rules/Gmp.hs b/src/Rules/Gmp.hs
index 1e962ec..cceda8e 100644
--- a/src/Rules/Gmp.hs
+++ b/src/Rules/Gmp.hs
@@ -52,8 +52,7 @@ gmpRules = do
     -- TODO: split into multiple rules
     gmpLibraryH %> \_ -> do
         when trackBuildSystem $ need [sourcePath -/- "Rules/Gmp.hs"]
-        liftIO $ removeFiles gmpBuildPath ["//*"]
-        createDirectory $ takeDirectory gmpLibraryH
+        removeDirectoryIfExists gmpBuildPath
 
         -- We don't use system GMP on Windows. TODO: fix?
         windows  <- windowsHost
@@ -62,6 +61,7 @@ gmpRules = do
             [ "HaveFrameworkGMP = YES", "HaveLibGmp = YES" ]
         then do
             putBuild "| GMP library/framework detected and will be used"
+            createDirectory $ takeDirectory gmpLibraryH
             copyFile gmpLibraryFakeH gmpLibraryH
         else do
             putBuild "| No GMP library/framework detected; in tree GMP will be built"
@@ -76,34 +76,38 @@ gmpRules = do
                          ++ "(found: " ++ show tarballs ++ ")."
 
             need tarballs
-            build $ Target gmpContext Tar tarballs [gmpBuildPath]
-
-            forM_ gmpPatches $ \src -> do
-                let patch     = takeFileName src
-                    patchPath = gmpBuildPath -/- patch
-                copyFile src patchPath
-                applyPatch gmpBuildPath patch
-
-            let filename = dropExtension . dropExtension . takeFileName $ head tarballs
-                suffix   = "-nodoc-patched"
-            unless (suffix `isSuffixOf` filename) $
-                putError $ "gmpRules: expected suffix " ++ suffix
-                         ++ " (found: " ++ filename ++ ")."
-            let libName = take (length filename - length suffix) filename
-                libPath = gmpBuildPath -/- "lib"
-
-            moveDirectory (gmpBuildPath -/- libName) libPath
+            withTempDir $ \dir -> do
+                let tmp = unifyPath dir
+                build $ Target gmpContext Tar tarballs [tmp]
+
+                forM_ gmpPatches $ \src -> do
+                    let patch     = takeFileName src
+                        patchPath = tmp -/- patch
+                    copyFile src patchPath
+                    applyPatch tmp patch
+
+                let filename = dropExtension . dropExtension . takeFileName
+                             $ head tarballs
+                    suffix   = "-nodoc-patched"
+                unless (suffix `isSuffixOf` filename) $
+                    putError $ "gmpRules: expected suffix " ++ suffix
+                        ++ " (found: " ++ filename ++ ")."
+                let libName = take (length filename - length suffix) filename
+
+                moveDirectory (tmp -/- libName) gmpBuildPath
 
             env <- configureEnvironment
             buildWithCmdOptions env $
-                Target gmpContext (Configure libPath)
-                       [libPath -/- "Makefile.in"] [libPath -/- "Makefile"]
+                Target gmpContext (Configure gmpBuildPath)
+                       [gmpBuildPath -/- "Makefile.in"]
+                       [gmpBuildPath -/- "Makefile"]
 
-            runMake libPath ["MAKEFLAGS="]
+            runMake gmpBuildPath ["MAKEFLAGS="]
 
-            copyFile (libPath -/- "gmp.h") gmpLibraryInTreeH
-            copyFile (libPath -/- "gmp.h") gmpLibraryH
-            moveFile (libPath -/- ".libs/libgmp.a") gmpLibrary
+            createDirectory $ takeDirectory gmpLibraryH
+            copyFile (gmpBuildPath -/- "gmp.h") gmpLibraryH
+            copyFile (gmpBuildPath -/- "gmp.h") gmpLibraryInTreeH
+            moveFile (gmpBuildPath -/- ".libs/libgmp.a") gmpLibrary
 
             createDirectory gmpObjects
             build $ Target gmpContext Ar [gmpLibrary] [gmpObjects]
diff --git a/src/Settings/Builders/Configure.hs b/src/Settings/Builders/Configure.hs
index 45bca37..813b79d 100644
--- a/src/Settings/Builders/Configure.hs
+++ b/src/Settings/Builders/Configure.hs
@@ -17,7 +17,7 @@ configureArgs = mconcat
                 , arg $ "--enable-shared=no" -- TODO: add support for yes
                 , arg $ "--host=" ++ targetPlatform ]
 
-    , builder (Configure $ gmpBuildPath -/- "lib") ? do
+    , builder (Configure gmpBuildPath) ? do
         hostPlatform  <- getSetting HostPlatform
         buildPlatform <- getSetting BuildPlatform
         mconcat [ arg $ "--enable-shared=no"



More information about the ghc-commits mailing list