HEADSUP: WITH and WITHOUT options knobs checking

Florent Thoumie flz at FreeBSD.org
Tue Jun 27 16:33:41 UTC 2006


On Tue, 2006-06-27 at 18:37 +0400, Arseny Nasokin wrote:
> It's wrong if you write in your Makefiles something about:
> --------------%<----------------
> ...
> OPTIONS= ABC "Enable abc feature" off 
> ...
> .include <bsd.port.pre.mk>
> ...
> .if defined (WITH_ABC)
> # configure ABC feature
> .endif
> ...
> .include <bsd.port.post.mk>
> ------------->%-----------------
> 
> The main reason is that, ${OPTIONSFILE} included as is, and if you enable ABC(as in example), you have in ${OPTIONSFILE} something about:
> --------------%<----------------
> ...
> WITH_ABC=true
> ...
> ------------->%-----------------
> 
> 
> Ok, and now some experiments.
> If ABC is feature, that you want enable im many ports (for example, OPTIMIZED_FLAGS or THREADS, or ESOUND/ESD.....)
> you possibly want add it to your /etc/make.conf file.
> 
> cat WITH_ABC=true >>  /etc/make.conf 
> 
> than, you want compile port, without this feature. You do `make config' and as result in your ${OPTIONSFILE} you have:
> --------------%<----------------
> ...
> WITHOUT_ABC=true
> ...
> ------------->%-----------------
> 
> And now - compile...
> 
> when you type `make build' you have defined BOTH `WITH_ABC' and `WITHOUT_ABC' knobs
> 
> and as you check _only_ WITH_ABC, this feature included. That's wrong!!!

Please don't send such HEADS-UP before you made sure what you propose is
correct.

What we currently recommend is checking for non-default value. What you
propose isn't good either since you just give priority to the default
value.

The right way to do things (IMHO) would be to mark the port as IGNORE if
both WITH/WITHOUT are defined (as it is done in src/ now).

> Please, check WITH_ knobs, as it:
> .if defined (WITH_ABC) && ! defined(WITHOUT_ABC)

I once proposed (I'm not claiming the paternity of the idea, just never
heard/read about it before) to just remove WITH/WITHOUT_ prefix from
WITH/WITHOUT_FOO and just go with FOO. I was told it wasn't the way we
do things and that it's easier to check if a variable is set or not
rather than checking its content.

I still think this is the way to go.

-- 
Florent Thoumie
flz at FreeBSD.org
FreeBSD Committer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 187 bytes
Desc: This is a digitally signed message part
Url : http://lists.freebsd.org/pipermail/freebsd-ports/attachments/20060627/213d1083/attachment.pgp


More information about the freebsd-ports mailing list