issue with cabal behavior with a custom Setup.hs

Adam Bergmark adam at bergmark.nl
Sat Nov 28 16:14:10 UTC 2015


I believe this does the same thing as what you want:
https://github.com/hvr/base-noprelude/blob/pre-ghc710/Setup.hs

HTH,
Adam


On Sat, Nov 28, 2015 at 4:23 PM, Thomas Lippincott <tom.lippincott at gmail.com
> wrote:

> Hello,
>
> I'm seeing what I think is some strange (or at least, non-intuitive)
> behavior in a custom package, and was wondering if someone could point me
> in the right direction.  Basically, I need the build process to generate
> some additional exposed modules, i.e. add them to the "exposed-modules"
> variable, and create the corresponding source files. It's easy to get the
> list of modules and produce the source files at any point in the build
> process (I know this is a questionable design, trying to do this as part of
> Cabal, but suffice it to say there are good arguments on both sides for our
> particular situation).
>
> I'm *so* close to having it working perfectly: in fact, if I run "cabal
> repl", I get a shell with all the right modules compiled and exposed, so,
> it should work the same way if it's installed and imported in ghci, right?
> Well, when I do that, the auto-generated modules are *not* exposed.  It's
> clearly generating the source files and compiling them, maybe "cabal
> install" isn't getting the updated module list or something?  Here's what
> I'm doing:
>
> I override "confHook" to call the original configure function, but then
> get the list of auto-generated modules and add them to the exposedModules
> field in the Library structure nested in the LocalBuildInfo structure
> before returning it.  The idea is that I've intercepted the list of exposed
> modules as early as possible, and so it's as though the Cabal file had the
> auto-generated modules listed from the start.  I generate the actual source
> files by overriding "preBuild".  Nothing else is modified from the default
> simpleUserHooks.
>
> This probably isn't the place for "how do I..." questions, so I'll frame
> it as: why would "cabal repl" work, and "cabal install" and ghci+import not
> work?  I apologize if this is an inappropriate place to ask, but there
> aren't exactly a ton of Cabal experts floating around!
>
> Thanks for any help,
>
> -Tom
> _______________________________________________
> cabal-devel mailing list
> cabal-devel at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/cabal-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/cabal-devel/attachments/20151128/74840b65/attachment.html>


More information about the cabal-devel mailing list