[Haskell-cafe] CABAL: conditional executable?

Thomas Schilling nominolo at googlemail.com
Tue Mar 4 03:54:55 EST 2008


executable foo
   main-is: bla
   if !os(windows):
     buildable: false

Unfortunately this gives rather unhelpful error messages when used  
with flags, but it works well enough for now.

/ Thomas


On 4 mar 2008, at 09.10, 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”.
>
> Is there a way to get CABAL to do what I want or should I raise a
> feature request on the CABAL trac?
>
> /M
>
> -- 
> Magnus Therning                             (OpenPGP: 0xAB4DFBA4)
> magnus@therning.org             Jabber: magnus.therning@ 
> gmail.com
> http://therning.org/magnus
>
> What if I don't want to obey the laws? Do they throw me in jail with
> the other bad monads?
>      -- Daveman
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list