packages feed

HROOT 0.5.0.0 → 0.5.0.1

raw patch · 2 files changed

+90/−2 lines, 2 files

Files

+ Config.hs view
@@ -0,0 +1,87 @@+{-# LANGUAGE ScopedTypeVariables #-}++module Config where+ +import Control.Monad.Identity++import Distribution.Simple+import Distribution.Simple.Setup+import Distribution.PackageDescription+import Distribution.Simple.LocalBuildInfo++import System.Exit+import System.Process++import Text.Parsec++config :: LocalBuildInfo -> IO (Maybe HookedBuildInfo)+config bInfo = do +  (excode, out, err) <- readProcessWithExitCode "root-config" ["--glibs"] ""+  liboptset' <- case excode of +                  ExitSuccess -> do  +--                    putStrLn $ show $ words out+--                    putStrLn $ show $ libraryOptions (words out)+--                    putStrLn $ show $ mkLibraryOptionSet . words $ out+                    return . Just .  mkLibraryOptionSet . words $ out+                  _ -> do +                    putStrLn $ "root-config failure but I am installing HROOT without ROOT. It will not work. This is only for documentation." +                    return Nothing              +  (excode2,out2,err2) <- readProcessWithExitCode "root-config" ["--incdir"] ""+  incdir' <- case excode2 of +               ExitSuccess -> do  +--                 putStrLn $ out2+                 return . Just . head . words $ out2+               _ -> do +                 putStrLn $ "root-config failure but I am installing HROOT without ROOT. It will not work. This is only for documentation." +                 return Nothing+  let Just lib = library . localPkgDescr $ bInfo+      buildinfo = libBuildInfo lib+  let (r :: Maybe HookedBuildInfo) = case liboptset' of +            Nothing -> Nothing+            Just liboptset -> +              case incdir' of +                Nothing -> Nothing +                Just incdir -> +                  let hbi = emptyBuildInfo { extraLibs = extraLibs buildinfo +                                                         ++ libs liboptset+                                           , extraLibDirs = libdirs liboptset +                                           , includeDirs = incdir : includeDirs buildinfo+                                           }+                  in Just (Just hbi, []) +--  putStrLn $ "show here"+--  putStrLn $ show r+  return r +++data LibraryOptionSet = LibraryOptionSet { +  libs :: [String], +  libdirs :: [String], +  libopts :: [String]+} deriving Show++data LibraryOption = Lib String +                   | Dir String+                   | Opt String +                   deriving Show++mkLibraryOptionSet :: [String] -> LibraryOptionSet+mkLibraryOptionSet strs = let opts = libraryOptions strs+                          in  foldr f (LibraryOptionSet [] [] []) opts +  where f x (LibraryOptionSet l d o) = case x of+                                         Lib st -> LibraryOptionSet (st:l) d o +                                         Dir st -> LibraryOptionSet l (st:d) o +                                         Opt st -> LibraryOptionSet l d (st:o) ++libraryOptions :: [String] -> [LibraryOption] -- LibraryOptionSet +libraryOptions = map f +  where f x = let r = parse libraryOptionClassifier "" x+              in  case r of +                    Left msg -> error (show msg)+                    Right result -> result+++libraryOptionClassifier :: ParsecT String () Identity LibraryOption+libraryOptionClassifier = +  try (string "-L" >> many1 anyChar >>= return . Dir) +  <|> try (string "-l" >> many1 anyChar >>= return . Lib)+  <|> (many1 anyChar >>= return . Opt)
HROOT.cabal view
@@ -1,5 +1,5 @@ Name:		HROOT-Version:	0.5.0.0+Version:	0.5.0.1 Synopsis:	Wrapper for ROOT Description: 	Haskell FFI binding for ROOT   Homepage:       http://ianwookim.org/HROOT@@ -11,7 +11,8 @@ Tested-with:    GHC >= 7.0.2 && <= 7.0.3 Build-Type: 	Custom cabal-version:  >=1.6-Extra-source-files: csrc/HROOT.h+Extra-source-files: Config.hs+                    csrc/HROOT.h                     csrc/addon.h                     example/histadd.hs                     example/random1d.hs