summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Config.hs26
-rw-r--r--Setup.lhs39
-rw-r--r--hmatrix.cabal1
3 files changed, 19 insertions, 47 deletions
diff --git a/Config.hs b/Config.hs
index 8810bec..3e83eff 100644
--- a/Config.hs
+++ b/Config.hs
@@ -96,13 +96,9 @@ getUserLink = concatMap (g . drop (length linkop)) . filter (isPrefixOf linkop)
96 cs ',' = ' ' 96 cs ',' = ' '
97 cs x = x 97 cs x = x
98 98
99config = do 99config :: LocalBuildInfo -> IO HookedBuildInfo
100 info <- maybeGetPersistBuildConfig "dist" 100
101 case info of 101config bInfo = do
102 Nothing -> putStrLn "Please run \"cabal clean\" first." >> exitFailure
103 Just bInfo -> mainOk bInfo
104
105mainOk bInfo = do
106 putStr "Checking foreign libraries..." 102 putStr "Checking foreign libraries..."
107 args <- getArgs 103 args <- getArgs
108 104
@@ -123,6 +119,7 @@ mainOk bInfo = do
123 createDirectoryIfMissing True $ buildDir bInfo 119 createDirectoryIfMissing True $ buildDir bInfo
124 120
125 r <- try bInfo buildInfo base fwks fullOpts 121 r <- try bInfo buildInfo base fwks fullOpts
122
126 case r of 123 case r of
127 Nothing -> do 124 Nothing -> do
128 putStrLn " FAIL" 125 putStrLn " FAIL"
@@ -132,14 +129,13 @@ mainOk bInfo = do
132 else putStrLn " *** Sorry, I can't link GSL." 129 else putStrLn " *** Sorry, I can't link GSL."
133 putStrLn " *** Please make sure that the appropriate -dev packages are installed." 130 putStrLn " *** Please make sure that the appropriate -dev packages are installed."
134 putStrLn " *** You can also specify the required libraries using" 131 putStrLn " *** You can also specify the required libraries using"
135 putStrLn " *** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc." 132 putStrLn " *** cabal install hmatrix --configure-option=link:lib1,lib2,lib3,etc."
136 writeFile "hmatrix.buildinfo" ("buildable: False\n") 133 return (Just emptyBuildInfo { buildable = False }, [])
137 Just ops -> do 134 Just ops -> do
138 putStrLn " OK" 135 putStrLn $ " OK " ++ ops
139 g <- checkCommand $ gsl112 bInfo buildInfo 136 g <- checkCommand $ gsl112 bInfo buildInfo
140 writeFile "hmatrix.buildinfo" $ "extra-libraries: " ++ 137 let hbi = if g
141 ops ++ "\n" ++ 138 then emptyBuildInfo { extraLibs = words ops}
142 if g 139 else emptyBuildInfo { extraLibs = words ops, ccOptions = ["-DGSL110"]}
143 then "" 140 return (Just hbi, [])
144 else "cc-options: -DGSL110\n"
145 141
diff --git a/Setup.lhs b/Setup.lhs
index 17efee4..ba435f0 100644
--- a/Setup.lhs
+++ b/Setup.lhs
@@ -1,43 +1,20 @@
1#! /usr/bin/env runhaskell 1#! /usr/bin/env runhaskell
2 2
3> import Distribution.Simple 3> import Distribution.Simple
4> import System.Process(system)
5>
6> import Config(config)
7>
8> import Distribution.Simple.Setup 4> import Distribution.Simple.Setup
9> import Distribution.PackageDescription 5> import Distribution.PackageDescription
10> import Distribution.Simple.LocalBuildInfo 6> import Distribution.Simple.LocalBuildInfo
11> import Distribution.Simple.Command
12> import Distribution.PackageDescription.Parse
13> import Distribution.Simple.Utils(info)
14> import Distribution.Verbosity
15
16> main = do
17> defaultMainWithHooks autoconfUserHooks {
18> runTests = t,
19> postConf = modifiedPostConf }
20> where modifiedPostConf :: Args -> ConfigFlags -> PackageDescription -> LocalBuildInfo -> IO ()
21> modifiedPostConf args flags pkg_descr lbi
22> = do let verbosity = fromFlag (configVerbosity flags)
23> noExtraFlags args
24>
25> config
26>
27> pbi <- getHookedBuildInfo verbosity
28> let pkg_descr' = updatePackageDescription pbi pkg_descr
29> postConf simpleUserHooks args flags pkg_descr' lbi
30 7
8> import System.Process(system)
9> import Config(config)
31 10
32> getHookedBuildInfo :: Verbosity -> IO HookedBuildInfo 11> main = defaultMainWithHooks simpleUserHooks { confHook = c, runTests = t }
33> getHookedBuildInfo verbosity = do
34> maybe_infoFile <- defaultHookedPackageDesc
35> case maybe_infoFile of
36> Nothing -> return emptyHookedBuildInfo
37> Just infoFile -> do
38> info verbosity $ "Reading parameters from " ++ infoFile
39> readHookedBuildInfo verbosity infoFile
40 12
13> c x y = do
14> binfo <- confHook simpleUserHooks x y
15> pbi <- config binfo
16> let pkg_descr = localPkgDescr binfo
17> return $ binfo { localPkgDescr = updatePackageDescription pbi pkg_descr }
41 18
42> t _ _ _ _ = system ( "runhaskell examples/tests.hs") >> return() 19> t _ _ _ _ = system ( "runhaskell examples/tests.hs") >> return()
43 20
diff --git a/hmatrix.cabal b/hmatrix.cabal
index 10c8173..3048217 100644
--- a/hmatrix.cabal
+++ b/hmatrix.cabal
@@ -29,7 +29,6 @@ build-type: Custom
29 29
30extra-source-files: lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h 30extra-source-files: lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h
31 Config.hs THANKS INSTALL CHANGES 31 Config.hs THANKS INSTALL CHANGES
32extra-tmp-files: hmatrix.buildinfo
33 32
34extra-source-files: examples/tests.hs 33extra-source-files: examples/tests.hs
35 examples/deriv.hs 34 examples/deriv.hs