[commit: ghc] wip/nfs-locking: Clean up. (3579324)

git at git.haskell.org git at git.haskell.org
Thu Oct 26 23:03:16 UTC 2017


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

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

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

commit 3579324b91abeb130df12d8639b67941c71d80ae
Author: Andrey Mokhov <andrey.mokhov at gmail.com>
Date:   Sat Jan 10 19:14:45 2015 +0000

    Clean up.


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

3579324b91abeb130df12d8639b67941c71d80ae
 src/Package.hs              |  3 ++-
 src/Package/Data.hs         |  6 +++++-
 src/Package/Dependencies.hs | 39 ++++++++++++++++++---------------------
 3 files changed, 25 insertions(+), 23 deletions(-)

diff --git a/src/Package.hs b/src/Package.hs
index 7a5f20e..0df8668 100644
--- a/src/Package.hs
+++ b/src/Package.hs
@@ -18,7 +18,8 @@ buildPackage pkg todoItem = do
 
 packageRules :: Rules ()
 packageRules = do
-    want ["libraries/deepseq/dist-install/build/deepseq.m"] -- TODO: control targets from commang line arguments
+    -- TODO: control targets from commang line arguments
+    want ["libraries/deepseq/dist-install/build/deepseq.m"]
     forM_ packages $ \pkg -> do
         forM_ (pkgTodo pkg) $ \todoItem -> do
             buildPackage pkg todoItem
diff --git a/src/Package/Data.hs b/src/Package/Data.hs
index 7428a87..fd8dd2c 100644
--- a/src/Package/Data.hs
+++ b/src/Package/Data.hs
@@ -1,5 +1,6 @@
 {-# LANGUAGE NoImplicitPrelude, ScopedTypeVariables #-}
 module Package.Data (buildPackageData) where
+
 import Package.Base
 
 libraryArgs :: [Way] -> Args
@@ -18,7 +19,10 @@ configureArgs stage settings =
             s <- unwords <$> arg as
             unless (null s) $ arg $ "--configure-option=" ++ key ++ "=" ++ s
 
-        cflags   = commonCcArgs `filterOut` "-Werror" <+> ConfCcArgs stage <+> customCcArgs settings <+> commonCcWarninigArgs
+        cflags   =  commonCcArgs `filterOut` "-Werror"
+                <+> ConfCcArgs stage
+                <+> customCcArgs settings
+                <+> commonCcWarninigArgs
         ldflags  = commonLdArgs  <+> ConfGccLinkerArgs stage <+> customLdArgs  settings
         cppflags = commonCppArgs <+> ConfCppArgs       stage <+> customCppArgs settings
 
diff --git a/src/Package/Dependencies.hs b/src/Package/Dependencies.hs
index 47a7a37..5b10ca1 100644
--- a/src/Package/Dependencies.hs
+++ b/src/Package/Dependencies.hs
@@ -3,18 +3,17 @@ module Package.Dependencies (buildPackageDependencies) where
 
 import Package.Base
 
-packageKeyArgs :: Stage -> FilePath -> Args
-packageKeyArgs stage pkgData =
-    arg "-hide-all-packages" <>
-    (pkgArgs =<< SupportsPackageKey || stage /= Stage0)
+packageArgs :: Stage -> FilePath -> Args
+packageArgs stage pkgData = do
+    usePackageKey <- SupportsPackageKey || stage /= Stage0
+    arg ["-hide-all-packages", "-no-user-package-db", "-include-pkg-deps"]
+        <> when (stage == Stage0) (arg "-package-db libraries/bootstrapping.conf")
+        <> keyArgs usePackageKey
   where
-    pkgArgs True = "-this-package-key"
-                <+> PackageKey pkgData
-                <+> prepend "-package-key " (DepKeys pkgData)
-    pkgArgs _    = "-package-name"
-                <+> PackageKey pkgData
-                <+> prepend "-package "     (Deps    pkgData)
-    prepend pref = (map (pref ++) <$>) . arg
+    keyArgs True  = prefixArgs "-this-package-key" (PackageKey pkgData) <>
+                    prefixArgs "-package-key"      (DepKeys    pkgData)
+    keyArgs False = prefixArgs "-package-name"     (PackageKey pkgData) <>
+                    prefixArgs "-package"          (Deps       pkgData)
 
 includeArgs :: ShowArgs a => String -> FilePath -> a -> Args
 includeArgs prefix path as = map includePath <$> arg as
@@ -26,7 +25,7 @@ srcArgs :: FilePath -> FilePath -> Args
 srcArgs path pkgData = do
     mods <- map (replaceEq '.' pathSeparator) <$> arg (Modules pkgData)
     dirs <- arg (SrcDirs pkgData)
-    srcs <- getDirectoryFiles "" $
+    srcs <- getDirectoryFiles ""
         [path </> dir </> mPath <.> ext | dir <- dirs, mPath <- mods, ext <- ["hs", "lhs"]]
     arg (map normalise srcs)
 
@@ -38,20 +37,18 @@ buildPackageDependencies pkg @ (Package name path _) (stage, dist, settings) =
     (buildDir </> "build" </> name <.> "m") %> \out -> do
         need ["shake/src/Package/Dependencies.hs"] -- Track changes in this file
         run (Ghc stage) $ arg "-M"
-            <> when (stage == Stage0) (arg "-package-db libraries/bootstrapping.conf")
-            <> packageKeyArgs stage pkgData
+            <> packageArgs stage pkgData
             <> arg "-i"
             <> includeArgs "-i" path     (SrcDirs pkgData)
             <> includeArgs "-i" buildDir ["build", "build/autogen"]
             <> includeArgs "-I" buildDir ["build", "build/autogen"]
             <> includeArgs "-I" path     (IncludeDirs pkgData)
-            <> arg ["-optP-include", "-optP" ++ buildDir </> "build/autogen/cabal_macros.h"]
-            <> arg "-no-user-package-db"
-            <> arg ["-odir"   , buildDir </> "build"]
-            <> arg ["-stubdir", buildDir </> "build"]
-            <> arg ("-dep-makefile " ++ out)
-            <> (concatMap (\w -> ["-dep-suffix", suffix w]) <$> ways settings)
-            <> arg "-include-pkg-deps"
+            <> arg "-optP-include" -- TODO: Shall we also add -cpp?
+            <> arg ("-optP" ++ buildDir </> "build/autogen/cabal_macros.h")
+            <> arg ["-odir"        , buildDir </> "build"]
+            <> arg ["-stubdir"     , buildDir </> "build"]
+            <> arg ["-dep-makefile", out                 ]
+            <> prefixArgs "-dep-suffix" (map suffix <$> ways settings)
             <> srcArgs path pkgData
             -- <> arg SrcHcOpts -- TODO: Check that skipping all _HC_OPTS is safe.
             -- <> wayHcOpts vanilla -- TODO: i) is this needed? ii) shall we run GHC -M multiple times?



More information about the ghc-commits mailing list