diff options
Diffstat (limited to 'Config.hs')
-rw-r--r-- | Config.hs | 26 |
1 files changed, 11 insertions, 15 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 | ||