[commit: packages/time] master: --configure-option and --ghc-option are now provided by Cabal (a9edca5)

git at git.haskell.org git at git.haskell.org
Fri Jan 23 22:58:24 UTC 2015


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

On branch  : master
Link       : http://git.haskell.org/packages/time.git/commitdiff/a9edca50d629162c592b7ef78d6cb55b23822b2c

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

commit a9edca50d629162c592b7ef78d6cb55b23822b2c
Author: Ross Paterson <ross at soi.city.ac.uk>
Date:   Mon Jun 4 04:55:55 2007 -0700

    --configure-option and --ghc-option are now provided by Cabal
    
    darcs-hash:20070604115555-b47d3-494f023ee54f001497ff09fe4e165b655a776147


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

a9edca50d629162c592b7ef78d6cb55b23822b2c
 Setup.hs | 51 ++-------------------------------------------------
 1 file changed, 2 insertions(+), 49 deletions(-)

diff --git a/Setup.hs b/Setup.hs
index d2fff29..e8a005c 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -1,7 +1,6 @@
 module Main (main) where
 
 import Control.Exception
-import Data.List
 import Distribution.PackageDescription
 import Distribution.Setup
 import Distribution.Simple
@@ -9,20 +8,14 @@ import Distribution.Simple.LocalBuildInfo
 import Distribution.Simple.Utils
 import System.Cmd
 import System.Directory
-import System.Environment
 import System.Info
 
 main :: IO ()
-main = do args <- getArgs
-          let (ghcArgs, args') = extractGhcArgs args
-              (_, args'') = extractConfigureArgs args'
-              hooks = defaultUserHooks {
+main = do let hooks = defaultUserHooks {
                   confHook = add_Win32_dep
                            $ confHook defaultUserHooks,
-                  buildHook = add_ghc_options ghcArgs
-                            $ buildHook defaultUserHooks,
                   runTests = runTestScript }
-          withArgs args'' $ defaultMainWithHooks hooks
+          defaultMainWithHooks hooks
 
 withCurrentDirectory :: FilePath -> IO a -> IO a
 withCurrentDirectory path f = do
@@ -34,45 +27,6 @@ runTestScript :: Args -> Bool -> PackageDescription -> LocalBuildInfo -> IO ()
 runTestScript _args _flag _pd _lbi
  = maybeExit $ withCurrentDirectory "test" $ system "make"
 
-extractGhcArgs :: [String] -> ([String], [String])
-extractGhcArgs = extractPrefixArgs "--ghc-option="
-
-extractConfigureArgs :: [String] -> ([String], [String])
-extractConfigureArgs = extractPrefixArgs "--configure-option="
-
-extractPrefixArgs :: String -> [String] -> ([String], [String])
-extractPrefixArgs the_prefix args
- = let f [] = ([], [])
-       f (x:xs) = case f xs of
-                      (wantedArgs, otherArgs) ->
-                          case removePrefix the_prefix x of
-                              Just wantedArg ->
-                                  (wantedArg:wantedArgs, otherArgs)
-                              Nothing ->
-                                  (wantedArgs, x:otherArgs)
-   in f args
-
-removePrefix :: String -> String -> Maybe String
-removePrefix "" ys = Just ys
-removePrefix _  "" = Nothing
-removePrefix (x:xs) (y:ys)
- | x == y = removePrefix xs ys
- | otherwise = Nothing
-
-type Hook a = PackageDescription -> LocalBuildInfo -> UserHooks -> a -> IO ()
-
-add_ghc_options :: [String] -> Hook a -> Hook a
-add_ghc_options args f pd lbi uhs x
- = do let lib' = case library pd of
-                     Just lib ->
-                         let bi = libBuildInfo lib
-                             opts = options bi ++ [(GHC, args)]
-                             bi' = bi { options = opts }
-                         in lib { libBuildInfo = bi' }
-                     Nothing -> error "Expected a library"
-          pd' = pd { library = Just lib' }
-      f pd' lbi uhs x
-
 type ConfHook = PackageDescription -> ConfigFlags -> IO LocalBuildInfo
 
 -- XXX Hideous hack
@@ -83,4 +37,3 @@ add_Win32_dep f pd cf
                                        : buildDepends pd }
                 else pd
       f pd' cf
-



More information about the ghc-commits mailing list