enabling / disabling executables by flags?

allan a.d.clark at ed.ac.uk
Wed Oct 8 07:37:08 EDT 2008


Hi Marc

Yes this is possible using the 'Buildable' field.

executable yyyywebinterface
  build-depends:   cgi, xhtml
  Main-is:         web/yyyWebInterface.hs
  Extensions:      PatternGuards ScopedTypeVariables
  Ghc-options:     -Wall
  if flag(web)
    Buildable: True
  else
    Buildable: False

regards
allan


Marc Weber wrote:
> Hi,
> 
> 
> Can I enable/ disable executable by flags ?
> eg this way:
> 
> 
> =============  =======================================================
> Name:            xxxxxxxxxxxxx
> category:        web application
> version:         0.0.1
> Cabal-Version: >=1.2
> build-type:      Simple
> LICENSE: GPL
> extensions: CPP
> cpp-options: -DSSTRING=B.ByteString -DLSTRING=L.ByteString
> 
> Flag testing
>   Default: True
>   Description build testing application as well
> 
> executable     YYYYYYYYYYy
>   main-is:        YYYYYYYYYYy.hs
>   hs-source-dirs: src
>   build-depends:   base
>                   , HList
>                   -- , HaXml == 1.19
>                   , filepath
>                   , mtl
>                   , containers
>                   , template-haskell
>                   , directory
>                   , HAppS-Server
>                   , HAppS-Data
>                   , HAppS-State
>                   , type-level
>   include-dirs: include
>   extra-source-files: include/vxmldos.h
>   -- strict and lazy strings beeing used
> 
> if flag(testing)
>   executable     test
>     main-is:        test.hs
>     hs-source-dirs: test, src
>     build-depends:   base
>                     , HList
>                     -- , HaXml == 1.19
>                     , filepath
>                     , mtl
>                     , containers
>                     , template-haskell
>                     , directory
>                     , HAppS-Server
>                     , HAppS-Data
>                     , HAppS-State
>                     , type-level
>     include-dirs: include
>     extra-source-files: include/vxmldos.h
>     -- strict and lazy strings beeing used
> =============  =======================================================
> 
> By the way this results in
> 
> marc at mail: /pr/haskell/waskaufeichwo ]$ sConfigure
>         bash: /home/marc/ghc69/bin/ghc-pkg: No such file or directory
>         setup: 'parseField' called on a non-field. Consider this a bug.
>                                                    ^^^^^^^^^^^^^^^^^^^
> Don't think its harmfull
> 
> marc at mail: /pr/haskell/waskaufeichwo ]$ ./setup --version
>         Cabal library version 1.5.5
> 
> Do you build test tests this way as well?
> 
> Marc
> 
> _______________________________________________
> cabal-devel mailing list
> cabal-devel at haskell.org
> http://www.haskell.org/mailman/listinfo/cabal-devel
> 


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.



More information about the cabal-devel mailing list