Including object files in Cabal packages

Duncan Coutts duncan.coutts at worc.ox.ac.uk
Sun Jun 14 13:57:57 EDT 2009


On Mon, 2009-06-08 at 20:55 +0000, C Rodrigues wrote:

> I want to build a Cabal package that contains some Haskell files and
> one C++ file, which contains C wrappers around C++ code.  I would like
> to compile the C++ file with a makefile, and do everything else
> (build, install, register, unregister) through Cabal.  However,
> Distribution.Simple.Build.build will only build and link HS and C
> files; there's no way to link object files into the library.

Right.

> Is there a reason not to add this feature? 

It's not clear how it would work. When are the .o files made? Do we have
to assume that they exist before configure/build? Such packages could
not be distributed on hackage for example.

> Where should the list of object files go? I can add it as a new field
> of BuildInfo, or make it another parameter of build.

How about making a custom Setup.hs that calls the makefile to generate
the .o files and then do something like adding them into the .a library.
Perhaps there's some API change that we could do to make this easier.

I don't think adding a field in the build info makes a lot of sense,
since normal packages would not be able to use it.

Duncan



More information about the cabal-devel mailing list