On 5/19/06, Laurent Pelecq <[EMAIL PROTECTED]> wrote:
Hisham Muhammad a écrit :
> On 5/18/06, Lucas C. Villa Real <[EMAIL PROTECTED]> wrote:
>> On 5/18/06, Laurent Pelecq <[EMAIL PROTECTED]> wrote:
>> > Maybe it could be possible to have a way to add configure option if a
>> > package is installed, for example :
>> >
>> > configure_options_AAlib=(
>> >   "--enable-aalib"
>> > }
>> >
>> > This way you can add all the dependencies you want, they would only be
>> > configured if they are installed.
>>
>> hmmm, I like this.
>
> There have been several proposals for optional dependencies so far.
> Lots of things to think about, like flags, changes in pre_/post_
> hooks, etc. What you propose is a step in the right direction (IIRC,
> something very similar has already been proposed) but there are many
> details surrounding the whole issue, ranging from conceptual topics
> down to the implementation (ie, are you going to scan every valid
> Compile flag for a <flag>_<depname> variable, etc.).

Although it is possible to scan every variable (or a subset of some
flags), this not really nice. I don't think that this makes sense for
anything else than "configure". I don't have any example where a make
variable would have to be set only if a dependency is installed.

There is another drawback though. Package names have to be valid bash
variable names (no dash anymore).

There may be other solutions. For example for each dependency, Compile
could source Recipe.<dependency> (if it exists) for additional options .
This way it is possible to configure anything, not only some variables.
Recipe.AAlib would contain:

 configure_options=(
   "[EMAIL PROTECTED]"
   "--enable-aalib"
 }

Or with a helper function:
  array_append configure_options --enable-aalib

Another solution would be to have a helper fonction to test dependencies
(if it doesn't exists yet), and to write in the Recipe:

 if depends_on AAlib then
   array_append configure_options --enable-aalib
 fi

I prefer the latter but it introduces more bashisms in recipe syntax. I
don't know if everybody would like that.

One of the alternatives that floated around back then were to have
something like:

with_aalib() {
  array_append configure_options --enable-aalib
}

(preferrably not allowing arbitrary bash code inside the function,
just variable assignments and array_ operations (this would have to be
enforced by convention/RecipeLint))

You'd take the dependencies list, convert the names (lowercase, dash
to underscore) and then run with_*. It's good for flags, etc. the "if
depends_on" construct might still be necessary for pre_/post_ hooks,
but hopefully that would see very little use (unlike, say, in
ebuilds). I'd even suggest to try to get away without having "if
depends_on", and see how far we can go just with "with_". I've used
this approach of "let's not add features to Compile until we really
need them" before with good results.

-- Hisham
_______________________________________________
gobolinux-devel mailing list
gobolinux-devel@lists.gobolinux.org
http://lists.gobolinux.org/mailman/listinfo/gobolinux-devel

Reply via email to