]> gitweb @ CieloNegro.org - Lucu.git/blobdiff - Setup.hs
Unfoldable Dispatcher
[Lucu.git] / Setup.hs
index 411bd08f9af646cf5e1d9f2dce1759ebd694c460..bd92fff29cabc321b0c6f1c0b1116c6d91f7938a 100755 (executable)
--- a/Setup.hs
+++ b/Setup.hs
@@ -2,162 +2,3 @@
 
 import Distribution.Simple
 main = defaultMain
-
-{-
-import Data.Maybe
-import Distribution.PackageDescription
-import Distribution.Setup
-import Distribution.Simple
-import Distribution.Simple.Configure
-import Distribution.Simple.LocalBuildInfo
-import System.IO
-import System.Exit
-import System.Directory
-import System.Process
-import Control.Monad
-import Control.Exception
-
-buildInfoName = "Kirschbaum.buildinfo"
-cgiName = "Kirschbaum.cgi"
-
-main = defaultMainWithHooks defaultUserHooks {preConf = preConf, postConf = postConf}
-    where
-      preConf :: [String] -> ConfigFlags -> IO HookedBuildInfo
-      preConf args flags
-          = do try (removeFile buildInfoName)
-               return emptyHookedBuildInfo
-      postConf :: [String] -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO ExitCode
-      postConf args flags _ localbuildinfo
-          = do binfo <- pkgConfigBuildInfo (configVerbose flags)
-               let default_binfo = emptyBuildInfo {extraLibs = ["xml2", "xslt", "exslt"]}
-               writeHookedBuildInfo buildInfoName (Just emptyBuildInfo,
-                                                   [(cgiName, fromMaybe default_binfo binfo)])
-               return ExitSuccess
-
-
-message :: String -> IO ()
-message s = putStrLn $ "configure: " ++ s
-
-rawSystemGrabOutput :: Int -> FilePath -> [String] -> IO String
-rawSystemGrabOutput verbose path args
-    = do when (verbose > 0) $
-              putStrLn (path ++ concatMap (' ':) args)
-         (inp,out,err,pid) <- runInteractiveProcess path args Nothing Nothing
-         exitCode <- waitForProcess pid
-         if exitCode /= ExitSuccess then
-             do errMsg <- hGetContents err
-                hPutStr stderr errMsg
-                exitWith exitCode else
-             return ()
-         hClose inp
-         hClose err
-         hGetContents out
-
-{-
-mergeBuildInfo :: BuildInfo -> BuildInfo -> BuildInfo
-mergeBuildInfo b1 b2 = BuildInfo {
-                         buildable    = buildable    b1 || buildable    b2,
-                         ccOptions    = ccOptions    b1 ++ ccOptions    b2,
-                         ldOptions    = ldOptions    b1 ++ ldOptions    b2,
-                         frameworks   = frameworks   b1 ++ frameworks   b2,
-                         cSources     = cSources     b1 ++ cSources     b2,
-                         hsSourceDirs = hsSourceDirs b1 ++ hsSourceDirs b2,
-                         otherModules = otherModules b1 ++ otherModules b2,
-                         extensions   = extensions   b1 ++ extensions   b2,
-                         extraLibs    = extraLibs    b1 ++ extraLibs    b2,
-                         extraLibDirs = extraLibDirs b1 ++ extraLibDirs b2,
-                         includeDirs  = includeDirs  b1 ++ includeDirs  b2,
-                         includes     = includes     b1 ++ includes     b2,
-                         installIncludes = installIncludes b1 ++ installIncludes b2,
-                         options      = options      b1 ++ options      b2,
-                         ghcProfOptions = ghcProfOptions b1 ++ ghcProfOptions b2
-                       }
-
-libXml2ConfigBuildInfo :: Int -> IO (Maybe BuildInfo)
-libXml2ConfigBuildInfo verbose
-    = do mb_libxml2_config_path <- findProgram "xml2-config" Nothing
-         case mb_libxml2_config_path
-              of Just libxml2_config_path
-                      -> do message "configuring libxml2 library"
-                            res <- rawSystemGrabOutput verbose libxml2_config_path ["--libs"]
-                            let (lib_dirs, libs, ld_opts) = splitLibsFlags (words res)
-                            res <- rawSystemGrabOutput verbose libxml2_config_path ["--cflags"]
-                            let (inc_dirs, cc_opts) = splitCFlags (words res)
-                            let bi = emptyBuildInfo {
-                                       extraLibDirs = lib_dirs,
-                                       extraLibs    = libs,
-                                       ldOptions    = ld_opts,
-                                       includeDirs  = inc_dirs,
-                                       ccOptions    = cc_opts
-                                     }
-                            return $ Just bi
-                 Nothing
-                     -> do message "This package will be built using default settings for libxml2 library"
-                           return Nothing
-
-libXsltConfigBuildInfo :: Int -> IO (Maybe BuildInfo)
-libXsltConfigBuildInfo verbose
-    = do mb_libxslt_config_path <- findProgram "xslt-config" Nothing
-         case mb_libxslt_config_path
-              of Just libxslt_config_path
-                      -> do message "configuring libxslt library"
-                            res <- rawSystemGrabOutput verbose libxslt_config_path ["--libs"]
-                            let (lib_dirs, libs, ld_opts) = splitLibsFlags (words res)
-                            res <- rawSystemGrabOutput verbose libxslt_config_path ["--cflags"]
-                            let (inc_dirs, cc_opts) = splitCFlags (words res)
-                            let bi = emptyBuildInfo {
-                                       extraLibDirs = lib_dirs,
-                                       extraLibs    = libs,
-                                       ldOptions    = ld_opts,
-                                       includeDirs  = inc_dirs,
-                                       ccOptions    = cc_opts
-                                     }
-                            return $ Just bi
-                 Nothing
-                     -> do message "This package will be built using default settings for libxslt library"
-                           return Nothing
--}
-
-pkgConfigBuildInfo :: Int -> IO (Maybe BuildInfo)
-pkgConfigBuildInfo verbose
-    = do mb_libxslt_config_path <- findProgram "pkg-config" Nothing
-         case mb_libxslt_config_path
-              of Just libxslt_config_path
-                      -> do message "configuring libxml2, libxslt and libexslt library"
-                            let modules = ["libxml-2.0", "libxslt", "libexslt"]
-                            res <- rawSystemGrabOutput verbose libxslt_config_path (modules ++ ["--libs"])
-                            let (lib_dirs, libs, ld_opts) = splitLibsFlags (words res)
-                            res <- rawSystemGrabOutput verbose libxslt_config_path (modules ++ ["--cflags"])
-                            let (inc_dirs, cc_opts) = splitCFlags (words res)
-                            let bi = emptyBuildInfo {
-                                       extraLibDirs = lib_dirs,
-                                       extraLibs    = libs,
-                                       ldOptions    = ld_opts,
-                                       includeDirs  = inc_dirs,
-                                       ccOptions    = cc_opts
-                                     }
-                            return $ Just bi
-                 Nothing
-                     -> do message "This package will be built using default settings for libxslt library"
-                           return Nothing
-
-splitLibsFlags :: [String] -> ([String], [String], [String])
-splitLibsFlags []         = ([], [], [])
-splitLibsFlags (arg:args)
-    = case arg
-      of ('-':'L':lib_dir) -> let (lib_dirs, libs, ld_opts) = splitLibsFlags args
-                              in  (lib_dir:lib_dirs, libs, ld_opts)
-         ('-':'l':lib)     -> let (lib_dirs, libs, ld_opts) = splitLibsFlags args
-                              in  (lib_dirs, lib:libs, ld_opts)
-         ld_opt            -> let (lib_dirs, libs, ld_opts) = splitLibsFlags args
-                              in  (lib_dirs, libs, ld_opt:ld_opts)
-
-splitCFlags :: [String] -> ([String], [String])
-splitCFlags []         = ([], [])
-splitCFlags (arg:args)
-    = case arg
-      of ('-':'I':inc_dir) -> let (inc_dirs, c_opts) = splitCFlags args
-                              in  (inc_dir:inc_dirs, c_opts)
-         c_opt             -> let (inc_dirs, c_opts) = splitCFlags args
-                              in  (inc_dirs, c_opt:c_opts)
--}
\ No newline at end of file