[commit: ghc] master: Simplify ghc-cabal (ff1a16a)

Ian Lynagh igloo at earth.li
Tue May 14 16:05:55 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branch  : master

https://github.com/ghc/ghc/commit/ff1a16a0bd630f97dc507f96977eaaae9d8df9a6

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

commit ff1a16a0bd630f97dc507f96977eaaae9d8df9a6
Author: Ian Lynagh <ian at well-typed.com>
Date:   Tue May 14 01:08:48 2013 +0100

    Simplify ghc-cabal
    
    It now consistently takes directory and distDirectory as its first 2
    arguments. Also, it only supports configuring 1 package at a time now
    (we weren't using the ability to configure more than one at once).

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

 ghc.mk                      |  4 ++--
 rules/build-package-data.mk |  2 +-
 rules/haddock.mk            |  2 +-
 utils/ghc-cabal/Main.hs     | 36 +++++++++++++++++-------------------
 4 files changed, 21 insertions(+), 23 deletions(-)

diff --git a/ghc.mk b/ghc.mk
index eaee872..a4a1b56 100644
--- a/ghc.mk
+++ b/ghc.mk
@@ -893,8 +893,8 @@ install_packages: rts/package.conf.install
 	$(foreach p, $(INSTALL_PACKAGES),                             \
 	    $(call make-command,                                      \
 	           "$(ghc-cabal_INPLACE)" copy                        \
-	                                  "$(STRIP_CMD)"              \
 	                                  $p $(INSTALL_DISTDIR_$p)    \
+	                                  "$(STRIP_CMD)"              \
 	                                  '$(DESTDIR)'                \
 	                                  '$(prefix)'                 \
 	                                  '$(ghclibdir)'              \
@@ -903,10 +903,10 @@ install_packages: rts/package.conf.install
 	$(foreach p, $(INSTALL_PACKAGES),                             \
 	    $(call make-command,                                      \
 	           "$(ghc-cabal_INPLACE)" register                    \
+	                                  $p $(INSTALL_DISTDIR_$p)    \
 	                                  "$(INSTALLED_GHC_REAL)"     \
 	                                  "$(INSTALLED_GHC_PKG_REAL)" \
 	                                  "$(DESTDIR)$(topdir)"       \
-	                                  $p $(INSTALL_DISTDIR_$p)    \
 	                                  '$(DESTDIR)'                \
 	                                  '$(prefix)'                 \
 	                                  '$(ghclibdir)'              \
diff --git a/rules/build-package-data.mk b/rules/build-package-data.mk
index 6582d18..c66825e 100644
--- a/rules/build-package-data.mk
+++ b/rules/build-package-data.mk
@@ -107,7 +107,7 @@ ifneq "$$($1_NO_CHECK)" "YES"
 	"$$(ghc-cabal_INPLACE)" check $1
 endif
 endif
-	"$$(ghc-cabal_INPLACE)" configure --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS) -- $2 $1
+	"$$(ghc-cabal_INPLACE)" configure $1 $2 --with-ghc="$$($1_$2_HC_CONFIG)" --with-ghc-pkg="$$($1_$2_GHC_PKG)" $$($1_CONFIGURE_OPTS) $$($1_$2_CONFIGURE_OPTS)
 ifeq "$$($1_$2_PROG)" ""
 ifneq "$$($1_$2_REGISTER_PACKAGE)" "NO"
 	$$(call cmd,$1_$2_GHC_PKG) update --force $$($1_$2_GHC_PKG_OPTS) $1/$2/inplace-pkg-config
diff --git a/rules/haddock.mk b/rules/haddock.mk
index bd4b994..78f4ea6 100644
--- a/rules/haddock.mk
+++ b/rules/haddock.mk
@@ -45,7 +45,7 @@ ifneq "$$(BINDIST)" "YES"
 # so we don't want to expand it yet.
 $$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_FILE) : $$$$(haddock_INPLACE) $$$$(ghc-cabal_INPLACE) $$($1_$2_HS_SRCS) $$$$($$($1_PACKAGE)-$$($1_$2_VERSION)_HADDOCK_DEPS) | $$$$(dir $$$$@)/.
 ifeq "$$(HSCOLOUR_SRCS)" "YES"
-	"$$(ghc-cabal_INPLACE)" hscolour $2 $1
+	"$$(ghc-cabal_INPLACE)" hscolour $1 $2
 endif
 	"$$(TOP)/$$(INPLACE_BIN)/haddock" \
 	  --odir="$1/$2/doc/html/$$($1_PACKAGE)" \
diff --git a/utils/ghc-cabal/Main.hs b/utils/ghc-cabal/Main.hs
index e330d53..1eb8ef5 100644
--- a/utils/ghc-cabal/Main.hs
+++ b/utils/ghc-cabal/Main.hs
@@ -34,26 +34,24 @@ main :: IO ()
 main = do hSetBuffering stdout LineBuffering
           args <- getArgs
           case args of
-              "hscolour" : distDir : dir : args' ->
-                  runHsColour distDir dir args'
+              "hscolour" : dir : distDir : args' ->
+                  runHsColour dir distDir args'
               "check" : dir : [] ->
                   doCheck dir
-              "copy" : strip : directory : distDir
-                     : myDestDir : myPrefix : myLibdir : myDocdir
+              "copy" : dir : distDir
+                     : strip : myDestDir : myPrefix : myLibdir : myDocdir
                      : args' ->
-                  doCopy strip directory distDir
-                         myDestDir myPrefix myLibdir myDocdir
+                  doCopy dir distDir
+                         strip myDestDir myPrefix myLibdir myDocdir
                          args'
-              "register" : ghc : ghcpkg : topdir : directory : distDir
+              "register" : dir : distDir : ghc : ghcpkg : topdir
                          : myDestDir : myPrefix : myLibdir : myDocdir
                          : relocatableBuild : args' ->
-                  doRegister ghc ghcpkg topdir directory distDir
+                  doRegister dir distDir ghc ghcpkg topdir
                              myDestDir myPrefix myLibdir myDocdir
                              relocatableBuild args'
-              "configure" : args' -> case break (== "--") args' of
-                   (config_args, "--" : distdir : directories) ->
-                       mapM_ (generate config_args distdir) directories
-                   _ -> die syntax_error
+              "configure" : dir : distDir : config_args ->
+                  generate dir distDir config_args
               "sdist" : dir : distDir : [] ->
                   doSdist dir distDir
               ["--version"] ->
@@ -124,7 +122,7 @@ doCheck directory
           isFailure _ = True
 
 runHsColour :: FilePath -> FilePath -> [String] -> IO ()
-runHsColour distdir directory args
+runHsColour directory distdir args
  = withCurrentDirectory directory
  $ defaultMainArgs ("hscolour" : "--builddir" : distdir : args)
 
@@ -132,9 +130,9 @@ doCopy :: FilePath -> FilePath
        -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath
        -> [String]
        -> IO ()
-doCopy strip directory distDir
-          myDestDir myPrefix myLibdir myDocdir
-          args
+doCopy directory distDir
+       strip myDestDir myPrefix myLibdir myDocdir
+       args
  = withCurrentDirectory directory $ do
      let copyArgs = ["copy", "--builddir", distDir]
                  ++ (if null myDestDir
@@ -182,7 +180,7 @@ doRegister :: FilePath -> FilePath -> FilePath -> FilePath
            -> FilePath -> FilePath -> FilePath -> FilePath -> FilePath
            -> String -> [String]
            -> IO ()
-doRegister ghc ghcpkg topdir directory distDir
+doRegister directory distDir ghc ghcpkg topdir
            myDestDir myPrefix myLibdir myDocdir
            relocatableBuildStr args
  = withCurrentDirectory directory $ do
@@ -300,8 +298,8 @@ mangleLbi "compiler" "stage2" lbi
                       _                  -> False
 mangleLbi _ _ lbi = lbi
 
-generate :: [String] -> FilePath -> FilePath -> IO ()
-generate config_args distdir directory
+generate :: FilePath -> FilePath -> [String] -> IO ()
+generate directory distdir config_args
  = withCurrentDirectory directory
  $ do let verbosity = normal
       -- XXX We shouldn't just configure with the default flags





More information about the ghc-commits mailing list