Subject: Optional Dependancies
To: None <tech-pkg@netbsd.org>
From: Chris Gilbert <chris@paradox.demon.co.uk>
List: tech-pkg
Date: 04/21/2001 12:41:02
Hi,

A while back I mentioned something about the idea of having optional 
dependancies.  Having stumbled onto something I'd like, but perhaps not 
everyone, I decided it's about time I came up with a more concrete suggestion.

what are optional dependancies?
Optional dependancies will allow the ability to have extra features turned on 
if you have that package installed.  Eg kdepim2 would enable kpilot if you've 
got misc/pilot-link installed, something that not everyone would want but 
some might.  It might also assist in cases of circular dependancies.

How do we handle binary packages?
My suggestion would be that if an optional package was found on the build 
system then it becomes a dependancy for that binary package.  This will 
complicate doing bulk builds, but it depends on how many optional 
dependancies there are.  However to handle this it would perhaps be worth 
having a global flag saying ignore optional dependancies.

How would it be implemented?
I'd expect that it's use would  do something like:

OPTIONAL_DEPENDS +=	pilot-link>=0.9.3:../../misc/pilot-link:message about 
what this extra package will add.

If it finds something in the OPTIONAL_DEPENDS section installed it adds it to 
DEPENDS.  If it doesn't find the package it can optionally display the 
message as to what functionality would be added.

If an optional package needs to set options to enable the functionality some 
way of detecting this might be needed eg:
.if ${OPT_pilot-link}
	CONFIGURE_ENV+=  -enable-palm-link
.endif

I believe that implementing the OPTIONAL_DEPENDS should be possible, but 
doing an implementation of the .if parts maybe somewhat trickier (it's been a 
long time since I last did makefile work)

I'm hoping that others have suggestions and ideas on why or why this would 
[not] work.  If it looks like people are interested I'll actually do some 
work on trying to implement it.

Cheers,
Chris