HROOT-io 0.10.0.1 → 0.10.0.2
raw patch · 2 files changed
+95/−2 lines, 2 filesdep ~HROOT-core
Dependency ranges changed: HROOT-core
Files
- Config.hs +92/−0
- HROOT-io.cabal +3/−2
+ Config.hs view
@@ -0,0 +1,92 @@+{-# LANGUAGE ScopedTypeVariables #-}++module Config where++import Distribution.PackageDescription+import Distribution.Simple+import Distribution.Simple.LocalBuildInfo+import Distribution.Simple.Setup+import System.Exit+import System.Process++config :: LocalBuildInfo -> IO (Maybe HookedBuildInfo)+config bInfo = do+ (excode, out, err) <- readProcessWithExitCode "root-config" ["--glibs"] ""+ liboptset' <- case excode of+ ExitSuccess -> do+ 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+ 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, [])+ 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 = parseLibraryOptionClassifier x+ in case r of+ Left msg -> error (show msg)+ Right result -> result++parseLibraryOptionClassifier :: String -> Either String LibraryOption+parseLibraryOptionClassifier [] = Left "empty option"+parseLibraryOptionClassifier str@(x : xs) =+ case x of+ '-' ->+ if null xs+ then Left "parse error"+ else+ let (y : ys) = xs+ in case y of+ 'L' -> Right (Dir ys)+ 'l' -> Right (Lib ys)+ _ -> Right (Opt str)+ _ -> Right (Opt str)
HROOT-io.cabal view
@@ -1,6 +1,6 @@ Cabal-version: 3.0 Name: HROOT-io-Version: 0.10.0.1+Version: 0.10.0.2 Synopsis: Haskell binding to ROOT IO modules Description: HROOT is a haskell Foreign Function Interface (FFI) binding to ROOT.@@ -15,6 +15,7 @@ Tested-with: GHC == 9.0.2 || == 9.2.4 || == 9.4.2 Extra-source-files: CHANGES+ Config.hs csrc/HROOTIOTDirectoryFile.h csrc/HROOTIOTFile.h csrc/HROOTIOTMemFile.h@@ -34,7 +35,7 @@ hs-source-dirs: src ghc-options: -Wall -funbox-strict-fields -fno-warn-unused-do-bind -fno-warn-orphans -fno-warn-unused-imports cxx-options: -std=c++17- Build-Depends: base > 4 && < 5, fficxx >= 0.7, fficxx-runtime >= 0.7, template-haskell, stdcxx, HROOT-core == 0.10.0.1+ Build-Depends: base > 4 && < 5, fficxx >= 0.7, fficxx-runtime >= 0.7, template-haskell, stdcxx, HROOT-core == 0.10.0.2 Exposed-Modules: HROOT.IO HROOT.IO.Ordinary