git.iko.soy/typeable/entropy
on main help sign in
Try to fix cc detection
commitf0044cc163584c7dfd37ad04f11d7ede2f715296 authorThomas M. DuBuisson <tommd@galois.com> dateSun 22 Sep 2013, 16:32 (13 years ago) parent08931d0
2 files changed+13−8
Setup.hs+7−2 System/Entropy.hs+6−6
Setup.hs+7−2
@@ -1,3 +1,4 @@
1+import Control.Monad
12import Distribution.Simple
23import Distribution.Simple.LocalBuildInfo
34import Distribution.Simple.Setup
@@ -13,10 +14,13 @@ import System.Exit
1314main = defaultMainWithHooks hk
1415 where
1516 hk = simpleUserHooks { buildHook = \pd lbi uh bf -> do
16− let ccProg = Program "gcc" undefined undefined undefined
17− mConf = lookupProgram ccProg (withPrograms lbi)
17+ let ccProg0 = Program "gcc" undefined undefined undefined
18+ ccProg1 = Program "clang" undefined undefined undefined
19+ f x = lookupProgram x (withPrograms lbi)
20+ mConf = f ccProg0 `mplus` f ccProg1
1821 err = error "Could not determine C compiler"
1922 cc = locationPath . programLocation . maybe err id $ mConf
23+ print (withPrograms lbi)
2024 b <- canUseRDRAND cc
2125 let newWithPrograms1 = userSpecifyArgs "gcc" cArgs (withPrograms lbi)
2226 newWithPrograms = userSpecifyArgs "ghc" cArgsHC newWithPrograms1
@@ -33,6 +37,7 @@ cArgsHC = map ("-optc" ++) cArgs
3337canUseRDRAND :: FilePath -> IO Bool
3438canUseRDRAND cc = do
3539 withTempDirectory normal "" "testRDRAND" $ \tmpDir -> do
40+ -- withTempDirectory normal False "" "testRDRAND" $ \tmpDir -> do
3641 writeFile (tmpDir ++ "/testRDRAND.c")
3742 (unlines [ "#include <stdint.h>"
3843 , "int main() {"
System/Entropy.hs+6−6
@@ -9,12 +9,12 @@
99-}
1010
1111module System.Entropy
12− ( getEntropy
13− , CryptHandle
14− , openHandle
15− , hGetEntropy
16− , closeHandle
17− ) where
12+ ( getEntropy
13+ , CryptHandle
14+ , openHandle
15+ , hGetEntropy
16+ , closeHandle
17+ ) where
1818
1919import Control.Monad (liftM)
2020import Data.ByteString as B