building a helper binary with cabal

Duncan Coutts duncan.coutts at
Sat Mar 1 06:21:17 EST 2008

On Sat, 2008-03-01 at 00:02 -0800, Evan Martin wrote:
> [resent after subscribing to the list]
> I'm working on a package that requires building a helper binary as
> part of its install process. 

I presume you mean a private binary that's needed at runtime, rather
than a program like a code-gen needed at build time but not installed.

Cabal does not have any direct support for private binaries, so you'll
have to use a custom Setup.hs.

Perhaps it should, if you can describe what you think is needed in
general, file a feature request here:

> This binary is written in C (with good
> reason), and on a Debian system would be installed into a path like
> /usr/lib/myproject/mybinary, because it's only used internally by the
> main program binary.

Cabal knows about the 'libexec' path which sounds like it might be what
you want, though that doesn't include any package subdir (though perhaps
it should - it is currently unused). Alternatively just install into the
'libdir' which does include the package subdir.

let dirs = absoluteInstallDirs pkg_descr lbi copydest
copyFileVerbose verbosity file (libdir dirs </> file)

At runtime you can get the libexec and libdir that the user chose at
configure time using the Paths_pkgname module which exports getLibDir
and getLibexecDir amongst others.


More information about the Libraries mailing list