
On 22 November 2013 07:10, Peter Simons
Hi Thiago,
I've written a shell script that will download and build this C library to a subdirectory of the user's HOME(~/.cabal-tmp/{lib,include}).
please don't do that. It's notoriously hard to get this use case right so that it works for everybody. Some people may want that library built as a shared object; others may want it with profiling and/or debug information. The next guy may want that library compiled with a different version of GCC than the one GHC uses by default. Others may want to link bindings to a copy of that library that's installed in their system (under a path that you cannot guess).
Not to mention that it doesn't work well for people wanting to build it on a distro level (or even to compile and distribute across multiple machines).
What you should do is to add
Extra-Libraries: my-external-library
to your Cabal file and trust that the user specifies appropriate flags at configure time to ensure that the compiler can find it if necessary.
You can distribute a shell script that tries to build the C library and the Haskell library with convenient defaults, i.e. your script should call
cabal configure --extra-include-dirs=PATH --extra-lib-dirs=PATH
with appropriate paths after having built the C code, but please make sure that your Haskell package works fine for people who want to build the C library themselves without using your script.
Take care, Peter
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
-- Ivan Lazar Miljenovic Ivan.Miljenovic@gmail.com http://IvanMiljenovic.wordpress.com