Including object files in Cabal packages

Hi, It looks like my last post to the list got messed up somehow. 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. Is there a reason not to add this feature? 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. -Chris _________________________________________________________________ Windows Live™ SkyDrive™: Get 25 GB of free online storage. http://windowslive.com/online/skydrive?ocid=TXT_TAGLM_WL_SD_25GB_062009

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

Thanks for your reply, Duncan.
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. Actually, better documentation would be very useful. The current User'sGuide provides virtually no help on custom packages. It took meseveral hours of digging around in the Haddock docs and inspecting thepackage configuration in ghci to discover that there's a way to get the nameof the package library file. When I wrote my last message, I already hada custom Setup.hs that runs configure/make, and I didn't thinkCabal had a function to do that. buildDir lbi mkLibName (package $ localPackageDescr lbi) 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.
Currently, Cabal has no interface for running compilers for otherlanguages, so only custom packages would be producing .o files. _________________________________________________________________ Insert movie times and more without leaving Hotmail®. http://windowslive.com/Tutorial/Hotmail/QuickAdd?ocid=TXT_TAGLM_WL_HM_Tutori...
participants (2)
-
C Rodrigues
-
Duncan Coutts