[Haskell-cafe] advanced cabal configuration

Erik Hesselink hesselink at gmail.com
Tue May 19 12:51:53 UTC 2015


Could you use some combination of 'os' and 'arch' [0] in your cabal
file to check for this, and then set a CPP define using 'CPP-options'?

Erik

[0] https://www.haskell.org/cabal/users-guide/developing-packages.html#conditions

On Tue, May 19, 2015 at 2:06 PM, Kazu Yamamoto <kazu at iij.ad.jp> wrote:
> 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
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe


More information about the Haskell-Cafe mailing list