[Haskell-cafe] listing include files in a cabal file

Patrick Pelletier code at funwithsoftware.org
Tue May 30 18:13:11 UTC 2017


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



More information about the Haskell-Cafe mailing list