"Cabal ignores ld-options?" - 2011 remix
duncan.coutts at googlemail.com
Sun Jan 30 18:22:33 CET 2011
On Sun, 2011-01-30 at 05:20 -0500, Ryan Newton wrote:
> I am trying to link a ".a" file built by a separate makefile into my
> library. GHC has no problem with it, but I need to convince cabal to
> do it for the package to be hackage-friendly. There's a thread about
> this back in 2007:
> Is there a method for this now, or is the state of affairs the same as
Having a Haskell package link against an external C library is
straightforward, you just list it in the extra-libraries field. The
external library must already be installed on the system however.
Bundling a copy of the external library with a cabal package is not
quite so easy. You will have to write code in the Setup.hs to call the
separate makefile during the build (and perhaps extra steps at configure
Your best bet is probably to use the "simple" build system's hooks API.
You can list the library in the extra-libraries field in the .cabal file
but you will also need to modify the check for external libraries that
are done in the postConf hook (since the separate .a library will not be
available at configure time): modify the package description that gets
passed to the postConf hook to exclude the library.
More information about the cabal-devel