enabling / disabling executables by flags?

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@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@mail: /pr/haskell/waskaufeichwo ]$ ./setup --version Cabal library version 1.5.5 Do you build test tests this way as well? Marc

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@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@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@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.

On Wed, Oct 08, 2008 at 12:37:08PM +0100, allan wrote:
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
He, thanks! What about sharing configuration options? I mean what happens if the main library, the application and the test application all need Library : build-depends: foo, blaa, blahh , booh, banana, food, some, more ? Executable foo build-depends: foo, blaa, blahh , booh, banana, food, some, more ? Executable test build-depends: foo, blaa, blahh , booh, banana, food, some, more ? Is there a way to specify the list only once? Marc

On Wed, 2008-10-08 at 14:48 +0200, Marc Weber wrote:
On Wed, Oct 08, 2008 at 12:37:08PM +0100, allan wrote:
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
He, thanks! What about sharing configuration options? I mean what happens if the main library, the application and the test application all need
Library : build-depends: foo, blaa, blahh , booh, banana, food, some, more ?
Executable foo build-depends: foo, blaa, blahh , booh, banana, food, some, more ?
Executable test build-depends: foo, blaa, blahh , booh, banana, food, some, more ?
Is there a way to specify the list only once?
Not yet. I think the right way to do that is to let the executable depend on the library. Duncan
participants (3)
-
allan
-
Duncan Coutts
-
Marc Weber