[Haskell-cafe] Packaging a library with a separate shared object

Bryan Gardiner bog at khumba.net
Thu Jun 30 23:03:05 UTC 2016


Hi folks!

I'm working on packaging Qtah (my Qt bindings) for upload to Hackage.
This is somewhat complicated, as I have some C++ glue code that I
build into a shared library that the Haskell library needs.

Currently, my build hooks are as follows, in:
https://gitlab.com/khumba/qtah/blob/packaging/qtah/Setup.hs

- postConf: Generate Haskell code in src/ and C++ code in cpp/.

- preBuild: Add cpp/ to HookedBuildInfo.extraLibDirs because the build
  phase needs this needs this.

- buildHook: Run make to build the C++ code into libqtah.so before
  the Haskell code builds.

- copyHook and instHook: Copy libqtah.so into InstallDirs.libdir
  (~/.cabal/lib/.../qtah-*/).

This installs successfully, but ultimately doesn't work because the
Haskell libHSqtah*.so that gets built can't find libqtah.so.  The
installation directory ~/cabal/lib/.../qtah-*/ isn't on
libHSqtah*.so's RUNPATH (which makes sense, it's not known at link
time).

I could create a separate package for the C++ bits, but I'd rather not
do that unless necessary (there's already a qtah-generator package as
well).  I can't see how I can avoid doing this though.  Are there any
Cabal experts that could point me in the right direction, or confirm
that I'll need to split the package?

Many thanks,
Bryan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160630/f0ce3df6/attachment.sig>


More information about the Haskell-Cafe mailing list