[Haskell-cafe] Cabal and autogenerated files

Duncan Coutts duncan.coutts at googlemail.com
Thu Nov 12 13:16:18 EST 2009


On Thu, 2009-11-12 at 17:54 +0000, Jeremy O'Donoghue wrote:
> Hi all,
> 
> Another, probably simple, question regarding cabalization.
> 
> Part of wxcore, the low level abstraction in wxHaskell, consists of
> haskell modules which are generated automatically by parsing C headers
> using another tool, wxdirect.
> 
> When trying to create an sdist package, we run into the problem that
> because we export modules which are automatically generated, after a
> 'clean', they do not exist, so the sdist package generation fails.

So I take it that these modules are generated "from nothing" rather than
something like happy/alex pre-processors where the .hs files are
generated from .y/.x files. Cabal supports the latter fairly well and
you can add custom pre-processors in this style. It doesn't really
support generating modules out of thin-air in the build step (though it
does this internally for the Paths_pkgname module).

> We have tried using 'extra-tmp-files' to list the modules which are
> autogenerated, but this isn't working.

extra-tmp-files means rm these files too when cleaning. It's mostly
redundant since the better thing to do is to keep all temp build files
in the build directory.

> Is this because we are generating the autogen modules in an autogen
> directory, or is this approach likely to fail wherever we put the
> autogenerated files? Our use case seems a reasonable one, as it could
> reasonably exist for any project which relies on automatically
> generated code.

Tell me if I've misunderstood your problem. We'll have to think about
how to get sdist to do the right thing for modules that have no ultimate
corresponding source file. File a ticket with your description of your
use case and what you'd like to be able to do.

Duncan



More information about the Haskell-Cafe mailing list