1import Distribution.Simple
2import Distribution.Simple.LocalBuildInfo
3import Distribution.Simple.Setup
4import Distribution.PackageDescription
5import Distribution.Simple.Utils
6import Distribution.Simple.Program
7import Distribution.Verbosity
13main = defaultMainWithHooks hk
15 hk = simpleUserHooks { buildHook = \pd lbi uh bf -> do
16 let ccProg = Program "gcc" undefined undefined undefined
17 mConf = lookupProgram ccProg (withPrograms lbi)
18 err = error "Could not determine C compiler"
19 cc = locationPath . programLocation . maybe err id $ mConf
21 let newWithPrograms1 = userSpecifyArgs "gcc" cArgs (withPrograms lbi)
22 newWithPrograms = userSpecifyArgs "ghc" cArgsHC newWithPrograms1
23 lbiNew = if b then (lbi {withPrograms = newWithPrograms }) else lbi
24 buildHook simpleUserHooks pd lbiNew uh bf
28cArgs = ["-DHAVE_RDRAND"]
31cArgsHC = map ("-optc" ++) cArgs
33canUseRDRAND :: FilePath -> IO Bool
35 withTempDirectory normal "" "testRDRAND" $ \tmpDir -> do
36 writeFile (tmpDir ++ "/testRDRAND.c")
37 (unlines [ "#include <stdint.h>"
39 , " uint64_t therand;"
40 , " unsigned char err;"
41 , " asm volatile(\"rdrand %0 ; setc %1\""
42 , " : \"=r\" (therand), \"=qm\" (err));"
46 ec <- rawSystemExitCode normal cc [tmpDir </> "testRDRAND.c", "-o" ++ tmpDir ++ "/a.out"]
47 notice normal $ "Result of RDRAND Test: " ++ show (ec == ExitSuccess)
48 return (ec == ExitSuccess)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list