[Haskell-cafe] advanced cabal configuration
Kazu Yamamoto (=?iso-2022-jp?B?GyRCOzNLXE9CSScbKEI=?=)
kazu at iij.ad.jp
Tue May 19 12:06:45 UTC 2015
Hi,
I'm a maintainer of simple-sendfile and need to implement the
following is to rescue 32bit Linux:
- If the COff size is 8, the following FFI is used:
foreign import ccall unsafe "sendfile64"
c_sendfile :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
- Otherwise, the following FFI is used:
foreign import ccall unsafe "sendfile"
c_sendfile :: Fd -> Fd -> Ptr COff -> CSize -> IO (#type ssize_t)
How can I implement this?
I guess that Setup.hs should evaluate (sizeOf (1 :: COff)) and define
a C macro, say LARGE_OFFSET and write the following code.
#ifdef LARGE_OFFSET
foreign import ccall unsafe "sendfile64"
#else
foreign import ccall unsafe "sendfile"
#endif
I have no experience to use Build-Type: other than Simple in cabal
files. Would someone explain how to implement it concretely or
suggest examples which implement similar things?
For more informaion, please read:
https://github.com/yesodweb/wai/issues/372
Thanks.
--Kazu
More information about the Haskell-Cafe
mailing list