[Hackage] #218: Data-files have no way of being installed conditionally

Hackage trac at galois.com
Sat Jan 26 16:34:00 EST 2008


#218: Data-files have no way of being installed conditionally
----------------------------+-----------------------------------------------
  Reporter:  guest          |        Owner:         
      Type:  defect         |       Status:  new    
  Priority:  normal         |    Milestone:         
 Component:  Cabal library  |      Version:  1.2.3.0
  Severity:  normal         |     Keywords:         
Difficulty:  normal         |   Ghcversion:  6.8.2  
  Platform:  Linux          |  
----------------------------+-----------------------------------------------
 Using cabal-1.2.3.0 and Yi, I have the following problem.

 For the Mac OS X Cocoa port, it has an icon which is a PDF file containing
 a rendered version of the Yi SVG logo, and which gets installed with it.
 Installing the PDF only makes sense if you are on a Mac (indeed, the PDF
 seems to be corrupt if you try to view it with, say, Xpdf). Right now, the
 yi.cabal file just reads:

 cabal-Version:  == 1.2.3.0
 tested-with:    GHC==6.8.2
 build-type:     Custom
 data-files:
   art/yi+lambda-fat.pdf
   -- FIXME: Install Cocoa icon only when Cocoa configured

 That is, the PDF is always installed. Now, my first attempt was to read
 the Cabal manual and realize that the obvious solution was to just stick
 the data-files: field under a flag or conditional - just like the yi.cabal
 already does for build-depends, ghc-options, buildable, etc. But this
 doesn't work! Yi will still compile and build, but Cabal says:

  Warning: Unknown fields: data-files (line 101) Fields allowed in this
 section: executable, main-is, buildable,
                build-tools, cpp-options, cc-options, ld-options,
 pkgconfig-depends, frameworks, c-sources, extensions, extra-libraries,
                extra-lib-dirs, includes, install-includes, include-dirs,
 hs-source-dirs, other-modules, ghc-prof-options, ghc-shared-options,
                ghc-options, hugs-options, nhc98-options, jhc-options

 The error tells me that the conditional didn't take:

 gwern at localhost:1023~/bin/yi_0>locate fat|grep lambda|grep .pdf
 [ 4:31PM]
 /home/gwern/bin/yi/_darcs/pristine/art/yi+lambda-fat.pdf
 /home/gwern/bin/yi/art/yi+lambda-fat.pdf
 /home/gwern/bin/share/yi-0.3/art/yi+lambda-fat.pdf
 gwern at localhost:1024~/bin/yi_0>

 (Even though I am on Linux, and the Cocoa flag is emphatically set to
 False.)

 --

 Anyway, given that what I want to do is sensible, that nowhere in the docs
 I've been able to find or on #haskell mentions any non-hacky solution, and
 that it's already supported by Cabal for other kinds of files, I think
 this is a pretty reasonable feature request.

-- 
Ticket URL: <http://hackage.haskell.org/trac/hackage/ticket/218>
Hackage <http://haskell.org/cabal/>
Hackage: Cabal and related projects


More information about the cabal-devel mailing list