Cabal partial builds
Peter Gammie
peteg42 at gmail.com
Tue Apr 8 23:49:32 EDT 2008
Andrea:
On 08/04/2008, at 10:01 PM, Andrea Vezzosi wrote:
> You can almost get that with cabal configurations and the field
> Buildable:
> [...]
> Flag devel
> Default: False
> [...]
> Executable foo
> if flag(devel)
> Buildable: False
> [...]
>
> With that if you pass --flags="devel" to configure the executable
> foo won't be built.
Thanks for the advice. Coincidentally I started down that path
yesterday, and it somewhat works.
I have a problem with package dependencies now. I've attached
the .cabal file and build -v output below.
In brief: I want to build a bunch of binaries that depend more-or-less
on the same packages. 'configure' goes through fine, but then Cabal
does not include the packages in the 'build' step. Clearly I have to
state the dependencies another way, but is there one that avoids a lot
of repetition?
cheers
peter
name: site
version: 0.1
license: BSD3
license-file: ../LICENSE
author: peteg42 at gmail dot com
homepage: http://peteg.org/
category: Text
synopsis: A Hope site
description: Build binaries for a Hope site.
build-type: Simple
cabal-version: >= 1.2
build-depends:
base,
cgi,
haskell98,
hsql-postgresql,
hope,
mtl,
utf8-string
Flag FastCGI
description: Build a Fast CGI binary.
default: False
Flag Import
description: Build the import binaries.
default: False
Executable hope.cgi
if flag(FastCGI)
buildable: False
GHC-Options: -Wall
Hs-Source-Dirs: .
c-sources: ghc_rts_opts.c
Main-Is: Hope/CGI.hs
Executable hope.fcgi
if !flag(FastCGI)
buildable: False
else
build-depends: fastcgi
GHC-Options: -Wall
Hs-Source-Dirs: .
c-sources: ghc_rts_opts.c
Main-Is: Hope/FastCGI.hs
Executable elibrary
if !flag(Import)
buildable: False
build-depends: hope-elibrary
GHC-Options: -Wall
Hs-Source-Dirs: .
Main-Is: Import/ELibrary.hs
Executable news
if !flag(Import)
buildable: False
GHC-Options: -Wall
Hs-Source-Dirs: .
Main-Is: Import/News.hs
Executable user
if !flag(Import)
buildable: False
GHC-Options: -Wall
Hs-Source-Dirs: .
Main-Is: Import/User.hs
$ runghc Setup d -v
Creating dist/build (and its parents)
Creating dist/build/autogen (and its parents)
Preprocessing executables for site-0.1...
Building site-0.1...
Building executable: hope.cgi...
Creating dist/build/hope.cgi (and its parents)
Creating dist/build/hope.cgi/hope.cgi-tmp (and its parents)
Building C Sources.
Creating dist/build/hope.cgi/hope.cgi-tmp (and its parents)
/usr/bin/ghc -package hope-elibrary-0.1 -optc-O2 -odir dist/build/
hope.cgi/hope.cgi-tmp -c ghc_rts_opts.c
/usr/bin/ghc -o dist/build/hope.cgi/hope.cgi --make -hide-all-packages
-i -idist/build/autogen -idist/build/hope.cgi/hope.cgi-tmp -i. -Idist/
build/hope.cgi/hope.cgi-tmp -odir dist/build/hope.cgi/hope.cgi-tmp -
hidir dist/build/hope.cgi/hope.cgi-tmp -package hope-elibrary-0.1 -O -
Wall dist/build/hope.cgi/hope.cgi-tmp/ghc_rts_opts.o ./Hope/CGI.hs
./Hope/CGI.hs:8:7:
Could not find module `Network.CGI':
it is a member of package cgi-3001.1.5.1, which is hidden
More information about the cabal-devel
mailing list