[commit: ghc] wip/nfs-locking: Fix libCffi name on Windows (fix #89). (19310e7)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:53:39 UTC 2017


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

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

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

commit 19310e7fbaf16190f0e206564f45f76cb6e20b61
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Mon Jan 4 20:09:33 2016 +0000

    Fix libCffi name on Windows (fix #89).


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

19310e7fbaf16190f0e206564f45f76cb6e20b61
 src/Rules/Copy.hs            |  4 +++-
 src/Settings/Packages/Rts.hs | 14 ++++++++++----
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/src/Rules/Copy.hs b/src/Rules/Copy.hs
index bcd1f1e..b1f9760 100644
--- a/src/Rules/Copy.hs
+++ b/src/Rules/Copy.hs
@@ -6,6 +6,7 @@ import GHC
 import Rules.Actions
 import Rules.Generate
 import Rules.Libffi
+import Settings.Packages.Rts
 import Settings.TargetDirectory
 
 installTargets :: [FilePath]
@@ -23,7 +24,8 @@ copyRules = do
                      ++ "(found: " ++ show ffiHPaths ++ ")."
         
         copyFile (takeDirectory (head ffiHPaths) -/- takeFileName ffih) ffih
-        copyFile libffiLibrary (targetPath Stage1 rts -/- "build" -/- "libCffi.a")
+        libffiName <- rtsLibffiLibraryName
+        copyFile libffiLibrary (targetPath Stage1 rts -/- "build/lib" ++ libffiName <.> "a")
 
     "inplace/lib/template-hsc.h"    <~ pkgPath hsc2hs
     "inplace/lib/platformConstants" <~ derivedConstantsPath
diff --git a/src/Settings/Packages/Rts.hs b/src/Settings/Packages/Rts.hs
index 56b0cf8..421d7f7 100644
--- a/src/Settings/Packages/Rts.hs
+++ b/src/Settings/Packages/Rts.hs
@@ -1,4 +1,6 @@
-module Settings.Packages.Rts (rtsPackageArgs, rtsConfIn, rtsConf) where
+module Settings.Packages.Rts (
+    rtsPackageArgs, rtsConfIn, rtsConf, rtsLibffiLibraryName
+    ) where
 
 import Base
 import Expression
@@ -15,6 +17,11 @@ rtsConfIn = pkgPath rts -/- "package.conf.in"
 rtsConf :: FilePath
 rtsConf = targetPath Stage1 rts -/- "package.conf.inplace"
 
+rtsLibffiLibraryName :: Action FilePath
+rtsLibffiLibraryName = do
+    windows <- windowsHost
+    return $ if windows then "Cffi-6" else "Cffi"
+
 rtsPackageArgs :: Args
 rtsPackageArgs = package rts ? do
     let yesNo = lift . fmap (\x -> if x then "YES" else "NO")
@@ -36,8 +43,7 @@ rtsPackageArgs = package rts ? do
     way            <- getWay
     path           <- getTargetPath
     top            <- getSetting GhcSourcePath
-    windows        <- lift $ windowsHost
-    let libffiName = if windows then "ffi-6" else "ffi"
+    libffiName     <- lift $ rtsLibffiLibraryName
     mconcat
         [ builderGcc ? mconcat
           [ arg "-Irts"
@@ -74,7 +80,7 @@ rtsPackageArgs = package rts ? do
           [ arg ("-DTOP=" ++ quote top)
           , arg "-DFFI_INCLUDE_DIR="
           , arg "-DFFI_LIB_DIR="
-          , arg $ "-DFFI_LIB=" ++ quote ("C" ++ libffiName) ] ]
+          , arg $ "-DFFI_LIB=" ++ quote libffiName ] ]
 
 -- #-----------------------------------------------------------------------------
 -- # Use system provided libffi



More information about the ghc-commits mailing list