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 let hcProg = Program "ghc" undefined undefined undefined
18 mConf = lookupProgram hcProg (withPrograms lbi)
19 err = error "Could not determine C compiler"
20 cc = locationPath . programLocation . maybe err id $ mConf
22 let newWithPrograms1 = userSpecifyArgs "gcc" cArgs (withPrograms lbi)
23 newWithPrograms = userSpecifyArgs "ghc" cArgsHC newWithPrograms1
24 lbiNew = if b then (lbi {withPrograms = newWithPrograms }) else lbi
25 buildHook simpleUserHooks pd lbiNew uh bf
29cArgs = ["-DHAVE_RDRAND"]
32cArgsHC = map ("-optc" ++) cArgs
34canUseRDRAND :: FilePath -> IO Bool
36 withTempDirectory normal "" "testRDRAND" $ \tmpDir -> do
37 writeFile (tmpDir ++ "/testRDRAND.c")
38 (unlines [ "#include <stdint.h>"
40 , " uint64_t therand;"
41 , " unsigned char err;"
42 , " asm volatile(\"rdrand %0 ; setc %1\""
43 , " : \"=r\" (therand), \"=qm\" (err));"
47 ec <- rawSystemExitCode normal cc [tmpDir </> "testRDRAND.c", "-o", tmpDir ++ "/a.o","-c"]
48 notice normal $ "Result of RDRAND Test: " ++ show (ec == ExitSuccess)
49 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