[commit: ghc] wip/nfs-locking: Use libHS*_thr.a instead of libHS*.thr_a naming convention for libraries. (c760627)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:57:47 UTC 2017


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

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

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

commit c7606279a186f145d5e7751f65be8c2be8aefb80
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Fri Jan 29 01:05:48 2016 +0000

    Use libHS*_thr.a instead of libHS*.thr_a naming convention for libraries.
    
    See #98.


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

c7606279a186f145d5e7751f65be8c2be8aefb80
 src/Rules/Library.hs  |  2 +-
 src/Settings/Paths.hs |  2 +-
 src/Way.hs            | 14 ++++++++------
 3 files changed, 10 insertions(+), 8 deletions(-)

diff --git a/src/Rules/Library.hs b/src/Rules/Library.hs
index b53c472..2cde962 100644
--- a/src/Rules/Library.hs
+++ b/src/Rules/Library.hs
@@ -46,7 +46,7 @@ buildPackageLibrary _ target @ (PartialTarget stage pkg) = do
         let objs = cObjs ++ splitObjs ++ eObjs
 
         asuf <- libsuf way
-        let isLib0 = ("//*-0" <.> asuf) ?== a
+        let isLib0 = ("//*-0" ++ asuf) ?== a
         if isLib0
         then build $ fullTarget target Ar [] [a] -- TODO: scan for dlls
         else build $ fullTarget target Ar objs [a]
diff --git a/src/Settings/Paths.hs b/src/Settings/Paths.hs
index ed217a8..a152f9a 100644
--- a/src/Settings/Paths.hs
+++ b/src/Settings/Paths.hs
@@ -29,7 +29,7 @@ pkgLibraryFile :: Stage -> Package -> String -> Way -> Action FilePath
 pkgLibraryFile stage pkg componentId way = do
     extension <- libsuf way
     let buildPath = targetPath stage pkg -/- "build"
-    return $ buildPath -/- "libHS" ++ componentId <.> extension
+    return $ buildPath -/- "libHS" ++ componentId ++ extension
 
 -- Relative path to a package ghci library file, e.g.:
 -- "libraries/array/dist-install/build/HSarray-0.5.1.0.o"
diff --git a/src/Way.hs b/src/Way.hs
index 8923571..da986a8 100644
--- a/src/Way.hs
+++ b/src/Way.hs
@@ -127,6 +127,10 @@ wayPrefix :: Way -> String
 wayPrefix way | way == vanilla = ""
               | otherwise      = show way ++ "_"
 
+waySuffix :: Way -> String
+waySuffix way | way == vanilla = ""
+              | otherwise      = "_" ++ show way
+
 osuf, ssuf, hisuf, hcsuf, obootsuf, hibootsuf :: Way -> String
 osuf      = (++ "o"      ) . wayPrefix
 ssuf      = (++ "s"      ) . wayPrefix
@@ -135,10 +139,6 @@ hcsuf     = (++ "hc"     ) . wayPrefix
 obootsuf  = (++ "o-boot" ) . wayPrefix
 hibootsuf = (++ "hi-boot") . wayPrefix
 
--- Note: in the previous build system libsuf was mysteriously different
--- from other suffixes. For example, in the profiling way it used to be
--- "_p.a" instead of ".p_a" which is how other suffixes work. I decided
--- to make all suffixes consistent: ".way_extension".
 -- TODO: find out why we need version number in the dynamic suffix
 -- The current theory: dynamic libraries are eventually placed in a single
 -- giant directory in the load path of the dynamic linker, and hence we must
@@ -148,7 +148,7 @@ hibootsuf = (++ "hi-boot") . wayPrefix
 libsuf :: Way -> Action String
 libsuf way @ (Way set) =
     if (not . wayUnit Dynamic $ way)
-    then return $ wayPrefix way ++ "a" -- e.g., p_a
+    then return $ waySuffix way ++ ".a" -- e.g., _p.a
     else do
         extension <- setting DynamicExtension  -- e.g., .dll or .so
         version   <- setting ProjectVersion    -- e.g., 7.11.20141222
@@ -172,7 +172,9 @@ safeDetectWay file = case reads prefix of
                 then extension
                 else takeExtension . dropExtension .
                      dropExtension . dropExtension $ file
-    prefix = drop 1 . dropWhileEnd (== '_') . dropWhileEnd (/= '_') $ prefixed
+    prefix = if extension == "a"
+             then drop 1 . dropWhile (/= '_') $ takeBaseName file
+             else drop 1 . dropWhileEnd (== '_') . dropWhileEnd (/= '_') $ prefixed
 
 -- Unsafe version of safeDetectWay. Useful when matchBuildResult has succeeded.
 detectWay :: FilePath -> Way



More information about the ghc-commits mailing list