From 3d372cfe5b463a571fc6ddc3dab019599297e4f7 Mon Sep 17 00:00:00 2001 From: dons Date: Sun, 25 Dec 2005 22:46:17 +0000 Subject: [PATCH] Move --with-ghc Setup.lhs into Scripts, use standard Setup.lhs at top level --- Setup.lhs | 16 +--------------- scripts/Setup-with-ghc.lhs | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 15 deletions(-) create mode 100644 scripts/Setup-with-ghc.lhs diff --git a/Setup.lhs b/Setup.lhs index 6527aae..f4a3624 100644 --- a/Setup.lhs +++ b/Setup.lhs @@ -1,19 +1,5 @@ #!/usr/bin/env runhaskell > module Main where > import Distribution.Simple -> import Distribution.Setup ( ConfigFlags (..) ) -> import System.Directory ( findExecutable ) -> > main :: IO () -> main = defaultMainWithHooks (defaultUserHooks { postConf = defaultPostConf }) -> where defaultPostConf args flags lbi {- xx -} -> = do args' <- fmap (args++) (configToArgs flags) -> (postConf defaultUserHooks) args' flags lbi {- xx -} -> -> configToArgs :: ConfigFlags -> IO [String] -> configToArgs (ConfigFlags { configHcPath = Just hcPath }) -> = do exec <- findExecutable hcPath -> case exec of -> Just realPath -> return ["--with-ghc="++realPath] -> Nothing -> return ["--with-ghc="++hcPath] -> configToArgs _ = return [] +> main = defaultMainWithHooks defaultUserHooks diff --git a/scripts/Setup-with-ghc.lhs b/scripts/Setup-with-ghc.lhs new file mode 100644 index 0000000..f464794 --- /dev/null +++ b/scripts/Setup-with-ghc.lhs @@ -0,0 +1,20 @@ +#!/usr/bin/env runhaskell +> module Main where +> import Distribution.Simple +> import Distribution.Setup ( ConfigFlags (..) ) +> import System.Directory ( findExecutable ) +> +> main :: IO () +> main = defaultMainWithHooks (defaultUserHooks { postConf = defaultPostConf }) +> where defaultPostConf args flags lbi {- xx -} +> = do args' <- fmap (args++) (configToArgs flags) +> (postConf defaultUserHooks) args' flags lbi {- xx -} +> +> -- need to pass with-ghc arg onto ./configure for non-standard ghcs +> configToArgs :: ConfigFlags -> IO [String] +> configToArgs (ConfigFlags { configHcPath = Just hcPath }) +> = do exec <- findExecutable hcPath +> case exec of +> Just realPath -> return ["--with-ghc="++realPath] +> Nothing -> return ["--with-ghc="++hcPath] +> configToArgs _ = return []