summaryrefslogtreecommitdiff
path: root/libraries/cabal-bin.hs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2008-06-29 11:00:03 +0000
committerIan Lynagh <igloo@earth.li>2008-06-29 11:00:03 +0000
commite47ddd4edb7e57b5a93a5fdd00ce18809010ee33 (patch)
treeea00838474f9df8e8ace66d2d2b980bf0154406e /libraries/cabal-bin.hs
parentb95f3f4a43d0fc7d45227b3eec8999132e5694a1 (diff)
downloadhaskell-e47ddd4edb7e57b5a93a5fdd00ce18809010ee33.tar.gz
Rename cabal to cabal-bin
Avoids conflicts with the Cabal library on case-insensitive filesystems
Diffstat (limited to 'libraries/cabal-bin.hs')
-rw-r--r--libraries/cabal-bin.hs38
1 files changed, 38 insertions, 0 deletions
diff --git a/libraries/cabal-bin.hs b/libraries/cabal-bin.hs
new file mode 100644
index 0000000000..85341c299d
--- /dev/null
+++ b/libraries/cabal-bin.hs
@@ -0,0 +1,38 @@
+
+module Cabal (main) where
+
+import Data.Maybe
+import Distribution.PackageDescription
+import Distribution.PackageDescription.Parse
+import Distribution.Simple
+import Distribution.Simple.Utils
+import Distribution.Verbosity
+import System.Directory
+import System.Environment
+import System.FilePath
+
+import qualified Distribution.Make as Make
+import qualified Distribution.Simple as Simple
+
+setupProg :: FilePath
+setupProg = "./Setup"
+
+main :: IO ()
+main = do
+ let verbosity = verbose
+ exists <- doesFileExist setupProg
+ args <- getArgs
+ if exists then rawSystemExit verbosity setupProg args
+ else do
+ gpdFile <- defaultPackageDesc verbosity
+ gpd <- readPackageDescription verbosity gpdFile
+ let pd = packageDescription gpd
+ case buildType pd of
+ Just Simple -> Simple.defaultMainArgs args
+ Just Make -> Make.defaultMainArgs args
+ Just Configure -> defaultMainWithHooksArgs autoconfUserHooks args
+ _ | packageName pd == PackageName "Cabal" ->
+ -- Cabal is special...*sigh*
+ Simple.defaultMainArgs args
+ | otherwise -> die "cabal: Don't know what to do!"
+