X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=libraries%2Fcabal-bin.hs;h=1ecba50a3d768061d103e98316cb98043d6bac50;hb=854dd40a5c5d2b22be5a314a351772daeffa6dbd;hp=85341c299de60894cc03b6c92808d14cd4fbb162;hpb=e47ddd4edb7e57b5a93a5fdd00ce18809010ee33;p=ghc-hetmet.git diff --git a/libraries/cabal-bin.hs b/libraries/cabal-bin.hs index 85341c2..1ecba50 100644 --- a/libraries/cabal-bin.hs +++ b/libraries/cabal-bin.hs @@ -1,5 +1,5 @@ -module Cabal (main) where +module Main (main) where import Data.Maybe import Distribution.PackageDescription @@ -19,9 +19,16 @@ setupProg = "./Setup" main :: IO () main = do + unprocessedArgs <- getArgs let verbosity = verbose + case unprocessedArgs of + ghc : packageConf : args -> + doit verbosity ghc packageConf args + _ -> die "Bad args" + +doit :: Verbosity -> FilePath -> FilePath -> [String] -> IO () +doit verbosity ghc packageConf args = do exists <- doesFileExist setupProg - args <- getArgs if exists then rawSystemExit verbosity setupProg args else do gpdFile <- defaultPackageDesc verbosity @@ -34,5 +41,11 @@ main = do _ | packageName pd == PackageName "Cabal" -> -- Cabal is special...*sigh* Simple.defaultMainArgs args - | otherwise -> die "cabal: Don't know what to do!" + | otherwise -> runSetup verbosity ghc packageConf args + +runSetup :: Verbosity -> FilePath -> FilePath -> [String] -> IO () +runSetup verbosity ghc packageConf args = do + rawSystemExit verbosity ghc ["-package-conf", packageConf, + "--make", "Setup", "-o", "Setup"] + rawSystemExit verbosity "./Setup" args