package description fields

Simon Marlow simonmar at microsoft.com
Wed Aug 10 10:00:13 EDT 2005


On 09 August 2005 11:23, Ross Paterson wrote:

> On Tue, Aug 09, 2005 at 09:02:50AM +0100, Simon Marlow wrote:
>> On 08 August 2005 16:57, Jonathan Cast wrote:
>> [Simon wrote:]
>>>> 
>>>>   --bindir=<dir>
>>>>   --libdir=<dir>
>>>>   --datadir=<dir>
>>>> 
>>>> where the values of these would be directories relative to $prefix
>>>> (or absolute?  relative to $prefix seems nicer).
>>> 
>>> Relative paths here break compatibility  with Autoconf; when I
>>> install a program, I don't care where its configure script comes
>>> from, I just want to   be  able  to   invoke  it   the  way   I
>>> expect   to.   Gratuitous incompatibilities between configure
>>> scripts is very inconvenient.
>> 
>> I do agree, and I half-expected someone to point out the
>> inconsistency. OTOH, this isn't a "configure script", it's the
>> Setup.lhs program.  You already have to know that it isn't an
>> autoconf configure script, because it has different syntax.
> 
> Another incompatibility is that configure has options --datadir etc
> with a different meaning to yours.  I think yours should be renamed;
> we might want the autoconf-style ones too.

Really?  I intended them to work in the same way.  What differences are
you referring to?

If you think this is a generalisation too far, I guess I could live with
having fixed values for all these, but they should be relative to
$prefix, and that still leaves us with Krasimir's complaint about the
default $bindir/$libdir on Windows.

>> One reason I suggested that relative paths would be better is
>> because it allows you to build a binary/library that is
>> prefix-independent, at least on Windows where a binary knows the
>> absolute $bindir and hence can derive $prefix because it knows
>> $bindir relative to $prefix. 
> 
> What would the code in the packaged program look like?  It seems you'd
> want some library support for this.

I suppose you'd have something like this:

  getPrefix :: FilePath  -- bindir relative to prefix
            -> FilePath  -- returns prefix

but it only works on Windows.  GHC, Happy, Alex and Haddock all have
something like this internally (but bindir is either fixed or assumed to
be equal to $prefix right now).  From prefix you can get libdir and
datadir, if these are also specified relative to prefix.

> And what if the builder modified bindir?

If the builder can modify bindir, the program gets the value from
paths.h (or whatever mechanism we choose).

Cheers,
	Simon


More information about the Libraries mailing list