diff options
-rw-r--r-- | Config.hs | 26 | ||||
-rw-r--r-- | Setup.lhs | 39 | ||||
-rw-r--r-- | hmatrix.cabal | 1 |
3 files changed, 19 insertions, 47 deletions
@@ -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 | ||
99 | config = do | 99 | config :: LocalBuildInfo -> IO HookedBuildInfo |
100 | info <- maybeGetPersistBuildConfig "dist" | 100 | |
101 | case info of | 101 | config bInfo = do |
102 | Nothing -> putStrLn "Please run \"cabal clean\" first." >> exitFailure | ||
103 | Just bInfo -> mainOk bInfo | ||
104 | |||
105 | mainOk 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 | ||
@@ -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 | ||
30 | extra-source-files: lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h | 30 | extra-source-files: lib/Numeric/LinearAlgebra/Tests/quickCheckCompat.h |
31 | Config.hs THANKS INSTALL CHANGES | 31 | Config.hs THANKS INSTALL CHANGES |
32 | extra-tmp-files: hmatrix.buildinfo | ||
33 | 32 | ||
34 | extra-source-files: examples/tests.hs | 33 | extra-source-files: examples/tests.hs |
35 | examples/deriv.hs | 34 | examples/deriv.hs |