datadir (was: RE: new package description fields, sdist,
simonmar at microsoft.com
Tue Aug 9 05:46:08 EDT 2005
On 09 August 2005 09:56, Bernard Pope wrote:
> On Tue, 2005-08-09 at 09:36 +0100, Simon Marlow wrote:
>> The problem, of course, is how to get the value of $datadir to the
>> program if it is configurable. I suggested a CPP symbol, but that is
>> far from ideal (we don't do it this way in fptools projects any more
>> for various reasons). Another option is to have the Setup script
>> generate a file containing the declarations:
>> -- paths.h
>> bindir="bin" -- or absolute
>> which you can then #include into Haskell source. Another
>> alternative, if you want to avoid CPP, is to have Setup generate a
>> complete Haskell module with these declarations, but then you have
>> to somehow choose an appropriate module name that doesn't clash.
>> paths.h gets my vote. Anyone have any better ideas?
> What if, say, you have some C code in your package that also wants to
> know the values of these paths?
There's no single solution that works for all languages. The good news
is that prefix/bindir/libdir/datadir would be available in the
LocalBuildInfo, so you would be able to implement any scheme you like
using the postConf hook. And maybe we could refer to these values in
the .cabal file, so you could write
(probably some quoting required somewhere, but you get the idea).
More information about the Libraries