diff --git a/Hackage/Setup.hs b/Hackage/Setup.hs index 8548fdef81f..7d12ddd8c72 100644 --- a/Hackage/Setup.hs +++ b/Hackage/Setup.hs @@ -12,6 +12,7 @@ ----------------------------------------------------------------------------- module Hackage.Setup ( globalCommand, Cabal.GlobalFlags(..) + , configureCommand , installCommand --Cabal.InstallFlags(..) , listCommand , updateCommand @@ -61,6 +62,11 @@ globalCommand = Cabal.globalCommand { ++ "\nSee http://www.haskell.org/cabal/ for more information.\n" } +configureCommand :: CommandUI Cabal.ConfigFlags +configureCommand = (Cabal.configureCommand defaultProgramConfiguration) { + commandDefaultFlags = mempty + } + installCommand :: CommandUI Cabal.ConfigFlags installCommand = (Cabal.configureCommand defaultProgramConfiguration) { commandName = "install", diff --git a/Main.hs b/Main.hs index b1231058dcd..583679571bb 100644 --- a/Main.hs +++ b/Main.hs @@ -78,7 +78,8 @@ mainWorker args = ++ " of the Cabal library " commands = - [installCommand `commandAddAction` installAction + [configureCommand `commandAddAction` configureAction + ,installCommand `commandAddAction` installAction ,infoCommand `commandAddAction` infoAction ,listCommand `commandAddAction` listAction ,updateCommand `commandAddAction` updateAction @@ -86,7 +87,6 @@ mainWorker args = ,fetchCommand `commandAddAction` fetchAction ,uploadCommand `commandAddAction` uploadAction - ,wrapperAction (Cabal.configureCommand defaultProgramConfiguration) ,wrapperAction (Cabal.buildCommand defaultProgramConfiguration) ,wrapperAction Cabal.copyCommand ,wrapperAction Cabal.haddockCommand @@ -106,6 +106,17 @@ wrapperAction command = let args = commandName command : commandShowOptions command flags ++ extraArgs in setupWrapper args Nothing +configureAction :: Cabal.ConfigFlags -> [String] -> IO () +configureAction flags extraArgs = do + configFile <- defaultConfigFile --FIXME + let verbosity = fromFlagOrDefault normal (Cabal.configVerbose flags) + config <- loadConfig verbosity configFile + let flags' = savedConfigToConfigFlags (Cabal.configPackageDB flags) config + `mappend` flags + args = commandName configureCommand + : commandShowOptions configureCommand flags' ++ extraArgs + setupWrapper args Nothing + installAction :: Cabal.ConfigFlags -> [String] -> IO () installAction flags extraArgs = do pkgs <- either die return (parsePackageArgs extraArgs)