-module Cabal (main) where
+module Main (main) where
import Data.Maybe
import Distribution.PackageDescription
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
_ | packageName pd == PackageName "Cabal" ->
-- Cabal is special...*sigh*
Simple.defaultMainArgs args
- | otherwise -> die "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