[Haskell-cafe] cabal and conditional build-depends

Tristan Ravitch travitch at cs.wisc.edu
Sun Jan 8 22:00:59 CET 2012


Hi Cafe,

I have a package that depends on several other Haskell libraries.  One
of these libraries depends on some native libraries (and associated
headers) to build.  I would like to make this dependency optional in
my package if the libraries don't exist.

To do this, I tried to switch my build-type from Simple to Configure
in my .cabal file.  Then I made a configure script that generates a
<pkg>.buildinfo file as suggested in the cabal guide.

The buildinfo file is generated and looks as I would expect.  If the
library is found on the system, it has a "build-info: ..." line.
Unfortunately, when Cabal processes it, it says:

  Warning: archive-inspection.buildinfo: Unknown fields: build-depends (line 2)
Fields allowed in this section:
buildable, build-tools, cpp-options, cc-options, ld-options,
pkgconfig-depends, frameworks, c-sources, default-language,
other-languages, default-extensions, other-extensions, extensions,
extra-libraries, extra-lib-dirs, includes, install-includes,
include-dirs, hs-source-dirs, other-modules, ghc-prof-options,
ghc-shared-options, ghc-options, hugs-options, nhc98-options,
jhc-options


It really doesn't seem to like conditional build-depends entries.  Is
this expected behavior?  And is there a better way to go about having
conditional build-time dependencies on Haskell libraries using Cabal?


I guess I could start playing with a custom Setup.hs, but I always
hate doing that unless absolutely necessary.

Thanks
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120108/923e51bb/attachment.pgp>


More information about the Haskell-Cafe mailing list