listing include files in a cabal file

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

listing include files in a cabal file

Patrick Pelletier
I have some C code in my Cabal package, consisting of both *.c and *.h
files.  Obviously, the *.c files get listed in "c-sources".  But I'm
trying to figure out where to list the *.h files.  Right now, I'm not
listing them anywhere, and my package compiles just fine.

According to the Cabal users guide, there is an "includes" field and an
"install-includes" field.  The "includes" field seems to only be
relevant when compiling via C.  And even when compiling via C, wouldn't
the include already be picked up when it is part of the foreign
declaration, e. g.:

foreign import ccall unsafe "tmr_tag_data.h TMR_bytesToHex"
     c_TMR_bytesToHex :: Ptr Word8
                      -> Word32
                      -> CString
                      -> IO ()

As for the "install-includes" field, I don't think my header files would
need to be installed, because they're internal to my package. The
package's interface is entirely in Haskell.

Should I just put my include files in "extra-source-files", so they get
added to the package, but otherwise aren't treated specially? Or should
I be using "includes" and/or "install-includes"?

Thanks,

--Patrick

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: listing include files in a cabal file

Albert Y. C. Lai
On 2017-05-30 02:13 PM, Patrick Pelletier wrote:
> And even when compiling via C, wouldn't
> the include already be picked up when it is part of the foreign
> declaration, e. g.:
>
> foreign import ccall unsafe "tmr_tag_data.h TMR_bytesToHex"
>      c_TMR_bytesToHex :: Ptr Word8
>                       -> Word32
>                       -> CString
>                       -> IO ()

No for GHC.

https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi-chap.html#using-header-files
_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
Reply | Threaded
Open this post in threaded view
|

Re: listing include files in a cabal file

Patrick Pelletier
On 6/2/17 10:01 AM, Albert Y. C. Lai wrote:
> https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ffi-chap.html#using-header-files 
>

This also says that "include-files" is ignored.  So I'm still sticking
by my original assertion, that header files should just go in
"extra-source-files".

--Patrick

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.