diff --git a/Setup.hs b/Setup.hs
index 8bdde6a..15bdf62 100644
--- a/Setup.hs
+++ b/Setup.hs
@@ -27,10 +27,10 @@ main = defaultMainWithHooks hk
compileCheck :: FilePath -> String -> String -> String -> IO Bool
compileCheck cc testName message sourceCode = do
withTempDirectory normal "" testName $ \tmpDir -> do
- writeFile (tmpDir ++ "/" ++ testName ++ ".c") sourceCode
- ec <- myRawSystemExitCode normal cc [tmpDir </> testName ++ ".c", "-o", tmpDir ++ "/a","-no-hs-main"]
- notice normal $ message ++ show (ec == ExitSuccess)
- return (ec == ExitSuccess)
+ writeFile (tmpDir ++ "/" ++ testName ++ ".c") sourceCode
+ ec <- myRawSystemExitCode normal cc [tmpDir </> testName ++ ".c", "-o", tmpDir ++ "/a","-no-hs-main"]
+ notice normal $ message ++ show (ec == ExitSuccess)
+ return (ec == ExitSuccess)
addOptions :: [String] -> [String] -> LocalBuildInfo -> LocalBuildInfo
addOptions cArgs hsArgs lbi = lbi {withPrograms = newWithPrograms }
@@ -67,26 +67,26 @@ checkGetrandom cc lbi = do
])
if libcGetrandom then return $ addOptions cArgsLibc cArgsLibc lbi
else do
- syscallGetrandom <- compileCheck cc "testSyscallGetrandom" "Result of syscall getrandom() Test: "
- (unlines [ "#define _GNU_SOURCE"
- , "#include <errno.h>"
- , "#include <unistd.h>"
- , "#include <sys/syscall.h>"
- , "#include <sys/types.h>"
- , "#include <linux/random.h>"
+ syscallGetrandom <- compileCheck cc "testSyscallGetrandom" "Result of syscall getrandom() Test: "
+ (unlines [ "#define _GNU_SOURCE"
+ , "#include <errno.h>"
+ , "#include <unistd.h>"
+ , "#include <sys/syscall.h>"
+ , "#include <sys/types.h>"
+ , "#include <linux/random.h>"
- , "static ssize_t getrandom(void* buf, size_t buflen, unsigned int flags)"
- , "{"
- , " return syscall(SYS_getrandom, buf, buflen, flags);"
- , "}"
+ , "static ssize_t getrandom(void* buf, size_t buflen, unsigned int flags)"
+ , "{"
+ , " return syscall(SYS_getrandom, buf, buflen, flags);"
+ , "}"
- , "int main()"
- , "{"
- , " char tmp;"
- , " return getrandom(&tmp, sizeof(tmp), GRND_NONBLOCK) != -1;"
- , "}"
- ])
- return $ if syscallGetrandom then addOptions cArgs cArgs lbi else lbi
+ , "int main()"
+ , "{"
+ , " char tmp;"
+ , " return getrandom(&tmp, sizeof(tmp), GRND_NONBLOCK) != -1;"
+ , "}"
+ ])
+ return $ if syscallGetrandom then addOptions cArgs cArgs lbi else lbi
where cArgs = ["-DHAVE_GETRANDOM"]
cArgsLibc = cArgs ++ ["-DHAVE_LIBC_GETRANDOM"]
diff --git a/entropy.cabal b/entropy.cabal
index 2219788..bb0f9b5 100644
--- a/entropy.cabal
+++ b/entropy.cabal
@@ -35,7 +35,7 @@ flag halvm
custom-setup
- setup-depends: Cabal >= 1.10 && < 3.5
+ setup-depends: Cabal >= 1.10 && < 3.7^M
, base < 5
, filepath < 1.5
, directory < 1.4
% ghc-9.2.1 Setup.hs
[1 of 1] Compiling Main ( Setup.hs, Setup.o )
Setup.hs:29:59: error: Empty 'do' block
|
29 | withTempDirectory normal "" testName $ \tmpDir -> do
| ^^
Setup.hs:69:14: error: Empty 'do' block
|
69 | else do
| ^^
% ghc-9.0.1 -fforce-recomp Setup.hs
[1 of 1] Compiling Main ( Setup.hs, Setup.o )
Linking Setup ...
% ghc-9.0.1 -fforce-recomp -XHaskell98 Setup.hs
[1 of 1] Compiling Main ( Setup.hs, Setup.o )
Setup.hs:68:12: error:
Unexpected semi-colons in conditional:
if libcGetrandom then return
$ addOptions
cArgsLibc cArgsLibc
lbi; else do syscallGetrandom <- compileCheck
cc "testSyscallGetrandom"
"Result of syscall getrandom() Test: "
(unlines
["#define _GNU_SOURCE",
"#include <errno.h>",
....])
return
$ if syscallGetrandom then
addOptions cArgs cArgs lbi
else
lbi
Perhaps you meant to use DoAndIfThenElse?
|
68 | if libcGetrandom then return $ addOptions cArgsLibc cArgsLibc lbi
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^...
% ghc-9.0.1 -fforce-recomp -XHaskell2010 Setup.hs
[1 of 1] Compiling Main ( Setup.hs, Setup.o )
Setup.hs:29:59: error: Empty 'do' block
|
29 | withTempDirectory normal "" testName $ \tmpDir -> do
| ^^
Setup.hs:69:14: error: Empty 'do' block
|
69 | else do
| ^^