Subject: Re: options.mk in buildlink files?
To: Christian Hattemer <c.hattemer@arcor.de>
From: Todd Vierling <tv@duh.org>
List: tech-pkg
Date: 04/24/2006 08:21:05
On Sun, 23 Apr 2006, Christian Hattemer wrote:

> > So, to recap, PKG_BUILD_OPTIONS should be set by first checking for the
> > existence of the package, and if it does exist, then using the result
> > of  "pkg_info -Q PKG_OPTIONS <pkg>", otherwise do the same dance we do
> > now.
>
> Sounds interesting. However it seems like a lot of code that has to be
> duplicated for each option.
>
> Could that code be encapsulated somewhere else into a macro to make checking
> less verbose?

Something like this would work (note, this is UNTESTED):

===== bsd.buildlink3.mk =====

PKG_BUILD_OPTIONS_CMD=	${PKG_INFO} -Q PKG_OPTIONS @pkg@ 2>/dev/null || \
			cd ${BUILDLINK_PKGSRCDIR.@pkg@} && \
			${MAKE} show-var ${MAKEFLAGS} VARNAME=PKG_OPTIONS

===== foo/buildlink3.mk =====

PKG_BUILD_OPTIONS.foo!=	${PKG_BUILD_OPTIONS_CMD:S/@pkg@/foo/}

-- 
-- Todd Vierling <tv@duh.org> <tv@pobox.com> <todd@vierling.name>