[commit: ghc] wip/nfs-locking: Adds Unlit utility (cce8759)

git at git.haskell.org git at git.haskell.org
Fri Oct 27 00:33:41 UTC 2017


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

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

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

commit cce8759fdf3eed5988013cea4d2810457e8272a0
Author: Moritz Angermann <moritz.angermann at gmail.com>
Date:   Fri Jan 8 18:21:31 2016 +0800

    Adds Unlit utility
    
    Adds the unlit utility to turn literate files into unliterate files.
    Fixes #83


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

cce8759fdf3eed5988013cea4d2810457e8272a0
 shaking-up-ghc.cabal                         |  1 +
 src/GHC.hs                                   | 14 +++++++++-----
 src/Rules/Data.hs                            | 11 +++++++++++
 src/Settings/Args.hs                         |  4 +++-
 src/Settings/Packages/{Hp2ps.hs => Unlit.hs} | 10 +++++-----
 5 files changed, 29 insertions(+), 11 deletions(-)

diff --git a/shaking-up-ghc.cabal b/shaking-up-ghc.cabal
index ab9f7bc..066b9e7 100644
--- a/shaking-up-ghc.cabal
+++ b/shaking-up-ghc.cabal
@@ -91,6 +91,7 @@ executable ghc-shake
                        , Settings.Packages.Rts
                        , Settings.Packages.RunGhc
                        , Settings.Packages.Touchy
+                       , Settings.Packages.Unlit                       
                        , Settings.TargetDirectory
                        , Settings.User
                        , Settings.Ways
diff --git a/src/GHC.hs b/src/GHC.hs
index 3d99e63..c26f552 100644
--- a/src/GHC.hs
+++ b/src/GHC.hs
@@ -6,7 +6,7 @@ module GHC (
     haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp,
     integerSimple, iservBin, libffi, mkUserGuidePart, parallel, pretty,
     primitive, process, rts, runGhc, stm, templateHaskell, terminfo, time,
-    touchy, transformers, unix, win32, xhtml,
+    touchy, transformers, unlit, unix, win32, xhtml,
 
     defaultKnownPackages, defaultTargetDirectory, defaultProgramPath
     ) where
@@ -28,7 +28,7 @@ defaultKnownPackages =
     , ghcTags, haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp
     , integerSimple, iservBin, libffi, mkUserGuidePart, parallel, pretty
     , primitive, process, rts, runGhc, stm, templateHaskell, terminfo, time
-    , touchy, transformers, unix, win32, xhtml ]
+    , touchy, transformers, unlit, unix, win32, xhtml ]
 
 -- Package definitions (see "Package")
 array, base, binary, bytestring, cabal, compiler, containers, compareSizes,
@@ -37,7 +37,7 @@ array, base, binary, bytestring, cabal, compiler, containers, compareSizes,
     haddock, haskeline, hsc2hs, hoopl, hp2ps, hpc, hpcBin, integerGmp,
     integerSimple, iservBin, libffi, mkUserGuidePart, parallel, pretty,
     primitive, process, rts, runGhc, stm, templateHaskell, terminfo, time,
-    touchy, transformers, unix, win32, xhtml :: Package
+    touchy, transformers, unlit, unix, win32, xhtml :: Package
 
 array           = library  "array"
 base            = library  "base"
@@ -85,11 +85,12 @@ terminfo        = library  "terminfo"
 time            = library  "time"
 touchy          = utility  "touchy"
 transformers    = library  "transformers"
+unlit           = utility  "unlit"
 unix            = library  "unix"
 win32           = library  "Win32"
 xhtml           = library  "xhtml"
 
--- TODO: The following utils are not implemented yet: unlit, driver/ghc-split
+-- TODO: The following utils are not implemented yet: driver/ghc-split
 -- TODO: The following utils are not included into the build system because
 -- they seem to be unused or unrelated to the build process: checkUniques,
 -- completion, count_lines, coverity, debugNGC, describe-unexpected, genargs,
@@ -112,9 +113,12 @@ defaultProgramPath stage pkg
     | pkg == haddock || pkg == ghcTags = case stage of
         Stage2 -> Just . inplaceProgram $ pkgNameString pkg
         _      -> Nothing
-    | pkg == touchy = case stage of
+    |  pkg == touchy = case stage of
         Stage0 -> Just $ "inplace/lib/bin" -/- pkgNameString pkg <.> exe
         _      -> Nothing
+    | pkg == unlit = case stage of
+        Stage0 -> Just $ "inplace/lib" -/- pkgNameString pkg <.> exe
+        _      -> Nothing
     | isProgram pkg = case stage of
         Stage0 -> Just . inplaceProgram $ pkgNameString pkg
         _      -> Just . installProgram $ pkgNameString pkg
diff --git a/src/Rules/Data.hs b/src/Rules/Data.hs
index de4f8c0..8b21fc7 100644
--- a/src/Rules/Data.hs
+++ b/src/Rules/Data.hs
@@ -67,6 +67,17 @@ buildPackageData rs target @ (PartialTarget stage pkg) = do
             writeFileChanged mk contents
             putSuccess $ "| Successfully generated '" ++ mk ++ "'."
 
+        when (pkg == unlit) $ dataFile %> \mk -> do
+            let prefix  = "utils_unlit_" ++ stageString stage ++ "_"
+                contents = unlines $ map (prefix++)
+                    [ "PROGNAME = unlit"
+                    , "C_SRCS = unlit.c"
+                    , "INSTALL = YES"
+                    , "INSTALL_INPLACE = YES"
+                    , "SYNOPSIS = Literate script filter." ]
+            writeFileChanged mk contents
+            putSuccess $ "| Successfully generated '" ++ mk ++ "'."
+
         when (pkg == touchy) $ dataFile %> \mk -> do
             let prefix = "utils_touchy_" ++ stageString stage ++ "_"
                 contents = unlines $ map (prefix++)
diff --git a/src/Settings/Args.hs b/src/Settings/Args.hs
index f2b30fa..3bd32d7 100644
--- a/src/Settings/Args.hs
+++ b/src/Settings/Args.hs
@@ -31,6 +31,7 @@ import Settings.Packages.IservBin
 import Settings.Packages.Rts
 import Settings.Packages.RunGhc
 import Settings.Packages.Touchy
+import Settings.Packages.Unlit
 import Settings.User
 
 getArgs :: Expr [String]
@@ -77,4 +78,5 @@ defaultPackageArgs = mconcat
     , iservBinPackageArgs
     , rtsPackageArgs
     , runGhcPackageArgs
-    , touchyPackageArgs ]
+    , touchyPackageArgs
+    , unlitPackageArgs ]
diff --git a/src/Settings/Packages/Hp2ps.hs b/src/Settings/Packages/Unlit.hs
similarity index 68%
copy from src/Settings/Packages/Hp2ps.hs
copy to src/Settings/Packages/Unlit.hs
index 26518c6..e654a66 100644
--- a/src/Settings/Packages/Hp2ps.hs
+++ b/src/Settings/Packages/Unlit.hs
@@ -1,13 +1,13 @@
-module Settings.Packages.Hp2ps (hp2psPackageArgs) where
+module Settings.Packages.Unlit (unlitPackageArgs) where
 
 import Base
 import Expression
-import GHC (hp2ps)
+import GHC (unlit)
 import Predicates (builderGhc, package)
-import Settings
+import Settings (getTargetPath)
 
-hp2psPackageArgs :: Args
-hp2psPackageArgs = package hp2ps ? do
+unlitPackageArgs :: Args
+unlitPackageArgs = package unlit ? do
     path <- getTargetPath
     let cabalMacros = path -/- "build/autogen/cabal_macros.h"
     mconcat [ builderGhc ?



More information about the ghc-commits mailing list