Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 26 Jul 2005 22:17:50 -0700
From:      Adam Weinberger <adamw@magnesium.net>
To:        Mikhail Teterin <mi+mx@aldan.algebra.com>
Cc:        ports@freebsd.org, Mark Linimon <linimon@lonesome.com>
Subject:   Re: a portlint dilemma
Message-ID:  <42E718FE.4070506@magnesium.net>
In-Reply-To: <200507262327.24793.mi%2Bmx@aldan.algebra.com>
References:  <200507262156.43233.mi%2Bmx@aldan.algebra.com> <20050727024231.GA18447@soaustin.net> <200507262327.24793.mi%2Bmx@aldan.algebra.com>

next in thread | previous in thread | raw e-mail | index | archive | help
Mikhail Teterin wrote:
>> There are some chicken-and-egg problems like this in bsd.port.mk (well,
>> the part that is invoked by bsd.port.pre.mk).  At one time I understood
>> which each of them was but I haven't looked at them in a long time.
> 
> Actually, I think, I found the way. Look at the new GraphicsMagick port.
> 
> portlint would've raised hell about this trick (if it new about variable 
> modifiers), but that would be groundless. ARCH is not expanded until OPTIONS 
> is used (by which time ARCH is already known), so things work just fine.
> 
> A more straightforward way would be to:
> 
> 	OPTIONS=	MEOW "MEOW?" ${MEOW_on_off}
> 
> 	.include <bsd.port.pre.mk>
> 
> 	.if ${ARCH} == "i386"
> 	MEOW_on_off=	on
> 	.else
> 	MEOW_on_off=	off
> 	.endif
> 
> 	.include <bsd.port.post.mk>
> 
> This is also fooling portlint -- OPTIONS are, in fact, modified after 
> including the ...pre.mk. And there is nothing wrong with that :-)
> 
> 	-mi

That is indeed a very good - albeit sneaky - trick!

The main problem that I find with the OPTIONS chicken-and-egg problem is 
that you can't modify OPTIONS based on the presence of files because, 
when OPTIONS processing takes place, LOCALBASE and X11BASE aren't 
defined. Do you have a good sneaky trick for that case?

# Adam


-- 
Adam Weinberger
adamw@magnesium.net || adamw@FreeBSD.org
adamw@vectors.cx    ||   adamw@gnome.org
http://www.vectors.cx



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?42E718FE.4070506>