Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Data-files have no way of being installed conditionally #211

bos opened this Issue May 24, 2012 · 2 comments


None yet
4 participants

bos commented May 24, 2012

(Imported from Trac #218, reported by guest on 2008-01-26)

Using cabal- 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: ==
tested-with: GHC==6.8.2
build-type: Custom

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@localhost:1023~/bin/yi_0>locate fat|grep lambda|grep .pdf [ 4:31PM]

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

@ghost ghost assigned nominolo May 24, 2012


bos commented May 24, 2012

(Imported comment by @dcoutts on 2008-01-26)

Presumably this is just a matter of changing data-files to be in the BuildInfo? rather than the PackageDescription? and putting in code to move it from the global section for all the existing packages that specify it there.


BardurArantsson commented Jun 25, 2015

Latest comment was 2008(!) and this is obviously a problem with the mentioned PDF -- and is such a niche requirement that it doesn't make much sense any more.

@23Skidoo 23Skidoo closed this Jun 26, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment