[commit: ghc] wip/nfs-locking: Add link rule. (7b1964e)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:51:00 UTC 2017


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

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

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

commit 7b1964efccba7ca2072e41f0e782a4ccfd843244
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Tue Jan 13 04:57:33 2015 +0000

    Add link rule.


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

7b1964efccba7ca2072e41f0e782a4ccfd843244
 doc/deepseq-build-progress.txt |  8 +++++++-
 src/Oracles/Builder.hs         |  8 +++-----
 src/Package.hs                 |  3 ++-
 src/Package/Library.hs         | 44 +++++++++++++++++++++++++-----------------
 4 files changed, 38 insertions(+), 25 deletions(-)

diff --git a/doc/deepseq-build-progress.txt b/doc/deepseq-build-progress.txt
index f951d61..0df6c05 100644
--- a/doc/deepseq-build-progress.txt
+++ b/doc/deepseq-build-progress.txt
@@ -54,14 +54,20 @@ echo        >> libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0
 # Done:
 "/usr/bin/ar" q  libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a @libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a.contents
 /usr/bin/ar: creating libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a
+
+# Skipping:
 "rm" -f libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a.contents
 
 # Done:
 "inplace/bin/ghc-stage1.exe" -hisuf p_hi -osuf  p_o -hcsuf p_hc -static -prof  -H32m -O    -this-package-key deeps_FT5iVCELxOr62eHY0nbvnU -hide-all-packages -i -ilibraries/deepseq/. -ilibraries/deepseq/dist-install/build -ilibraries/deepseq/dist-install/build/autogen -Ilibraries/deepseq/dist-install/build -Ilibraries/deepseq/dist-install/build/autogen -Ilibraries/deepseq/.    -optP-include -optPlibraries/deepseq/dist-install/build/autogen/cabal_macros.h -package-key array_3w0nMK0JfaFJPpLFn2yWAJ -package-key base_469rOtLAqwTGFEOGWxSUiQ -package-key ghcpr_FgrV6cgh2JHBlbcx1OSlwt -Wall -XHaskell2010 -O2  -no-user-package-db -rtsopts      -odir libraries/deepseq/dist-install/build -hidir libraries/deepseq/dist-install/build -stubdir libraries/deepseq/dist-install/build -split-objs  -c libraries/deepseq/./Control/DeepSeq.hs -o libraries/deepseq/dist-install/build/Control/DeepSeq.p_o
 
-
+# Done:
 "C:/msys/home/chEEtah/ghc/inplace/mingw/bin/ld.exe"  -r -o libraries/deepseq/dist-install/build/HSdeeps_FT5iVCELxOr62eHY0nbvnU.o  libraries/deepseq/dist-install/build/Control/DeepSeq.o
+
+# Done:
 "rm" -f libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a.contents
+
+# Skipping:
 /usr/bin/find libraries/deepseq/dist-install/build/Control/DeepSeq_p_o_split -name '*.p_o' -print >> libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a.contents
 echo        >> libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a.contents
 "/usr/bin/ar" q  libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a @libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU_p.a.contents
diff --git a/src/Oracles/Builder.hs b/src/Oracles/Builder.hs
index ffc3cf5..71f8575 100644
--- a/src/Oracles/Builder.hs
+++ b/src/Oracles/Builder.hs
@@ -2,8 +2,7 @@
 
 module Oracles.Builder (
     Builder (..),
-    with, run, terseRun, specified,
-    arArgs
+    with, run, terseRun, specified
     ) where
 
 import Data.Char
@@ -115,11 +114,13 @@ terseRun builder args = do
 interestingInfo :: Builder -> [String] -> [String]
 interestingInfo builder ss = case builder of
     Ar       -> prefixAndSuffix 3 1 ss
+    Ld       -> prefixAndSuffix 4 0 ss
     Ghc _    -> if head ss == "-M"
                 then prefixAndSuffix 1 1 ss
                 else prefixAndSuffix 0 4 ss
     GhcPkg _ -> prefixAndSuffix 2 0 ss
     GhcCabal -> prefixAndSuffix 3 0 ss
+    _        -> ss
   where
     prefixAndSuffix n m ss =
         if length ss <= n + m + 1
@@ -138,6 +139,3 @@ specified builder = do
         [_] -> True
         _   -> False
 
--- TODO: generalise for other builders
-arArgs :: Args
-arArgs = arg "q"
diff --git a/src/Package.hs b/src/Package.hs
index a3fcf89..8b41809 100644
--- a/src/Package.hs
+++ b/src/Package.hs
@@ -23,7 +23,8 @@ packageRules :: Rules ()
 packageRules = do
     -- TODO: control targets from commang line arguments
     want [ "libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a"
-         , "libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.p_a" ]
+         , "libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.p_a"
+         , "libraries/deepseq/dist-install/build/HSdeeps_FT5iVCELxOr62eHY0nbvnU.o" ]
     forM_ packages $ \pkg -> do
         forM_ (pkgTodo pkg) $ \todoItem -> do
             buildPackage pkg todoItem
diff --git a/src/Package/Library.hs b/src/Package/Library.hs
index 6660a2f..529d777 100644
--- a/src/Package/Library.hs
+++ b/src/Package/Library.hs
@@ -3,18 +3,8 @@ module Package.Library (buildPackageLibrary) where
 
 import Package.Base
 
-{- "/usr/bin/ar" q  
-libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a
- at libraries/deepseq/dist-install/build/libHSdeeps_FT5iVCELxOr62eHY0nbvnU.a
-.contents
--}
-
---  "$$(XARGS)" $$(XARGS_OPTS) "$$($1_$2_AR)" $$($1_$2_AR_OPTS)
--- $$($1_$2_EXTRA_AR_ARGS) $$@ < $$@.contents
--- AR_OPTS            = $(SRC_AR_OPTS) $(WAY$(_way)_AR_OPTS) $(EXTRA_AR_OPTS)
-
-buildPackageLibrary :: Package -> TodoItem -> Rules ()
-buildPackageLibrary (Package name path _) (stage, dist, _) =
+arRule :: Package -> TodoItem -> Rules ()
+arRule (Package _ path _) (stage, dist, _) =
     let buildDir = path </> dist </> "build"
         pkgData  = path </> dist </> "package-data.mk"
     in
@@ -25,10 +15,28 @@ buildPackageLibrary (Package name path _) (stage, dist, _) =
         need depObjs
         libObjs <- pkgLibObjects path dist stage way
         liftIO $ removeFiles "." [out]
-        terseRun Ar $ arArgs <+> out <+> libObjs
-        when (way == vanilla) $ do
-            synopsis <- unwords <$> arg (Synopsis pkgData)
-            putNormal $ "Successfully built library for package "
-                      ++ name ++ "." 
-            putNormal $ "Synopsis: " ++ synopsis ++ "."
+        terseRun Ar $ "q" <+> out <+> libObjs
 
+{- "C:/msys/home/chEEtah/ghc/inplace/mingw/bin/ld.exe"  -r -o 
+libraries/deepseq/dist-install/build/HSdeeps_FT5iVCELxOr62eHY0nbvnU.o  
+libraries/deepseq/dist-install/build/Control/DeepSeq.o
+-}
+
+ldRule :: Package -> TodoItem -> Rules ()
+ldRule (Package name path _) (stage, dist, _) =
+    let buildDir = path </> dist </> "build"
+        pkgData  = path </> dist </> "package-data.mk"
+    in
+    priority 2 $ (buildDir </> "*.o") %> \out -> do
+        need ["shake/src/Package/Library.hs"]
+        depObjs <- pkgDepObjects path dist vanilla
+        need depObjs
+        terseRun Ld $ arg (ConfLdLinkerArgs stage)
+            <> arg ["-r", "-o", out]
+            <> arg depObjs
+        synopsis <- unwords <$> arg (Synopsis pkgData)
+        putNormal $ "Successfully built package " ++ name ++ "." 
+        putNormal $ "Package synopsis: " ++ synopsis ++ "."
+
+buildPackageLibrary :: Package -> TodoItem -> Rules ()
+buildPackageLibrary = arRule <> ldRule
\ No newline at end of file



More information about the ghc-commits mailing list