[Haskell-cafe] CABAL: conditional executable?

Magnus Therning magnus at therning.org
Tue Mar 4 04:58:36 EST 2008


On 3/4/08, Henning Thielemann <lemming at henning-thielemann.de> wrote:
>
>
> On Tue, 4 Mar 2008, Magnus Therning wrote:
>
> > I'm putting together a package consisting of 2 executables. Only one of
> > them is pure Haskell and thus buildable on all platforms, the other
> > relies on Windows API calls and can only be built on that platform.  I
>
> > found the â  if os(...)â   conditional in the CABAL docs but I'm having
>
> > problems getting it to do what I want.
> >
> > if os(mingw32)
> >  executable foo
> >    ...
> >
>
> > Results in the error â  Section expectedâ  .  Swapping the two lines
> like this
>
> >
> > executable foo
> >  if os(mingw32)
> >    ...
> >
>
> > results in â  Setup.hs: Error: No 'Main-Is' field found for executable
> fooâ  .
>
> It sounds like another instance of the case that parts of a package cannot
> be build under some circumstances. Keep in mind that other packages might
> rely on the installed second executable if they find that the package is
> installed. Thus, I guess it's better to extract the second executable to a
> different package for Window's only stuff.



Good point.  Does CABAL 1.2 have support for multiple .cabal files in the
same directory?  If not then I'm not too happy with this solution.

/M
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20080304/e5112d0b/attachment.htm


More information about the Haskell-Cafe mailing list