Subject: Package options
To: None <tech-pkg@netbsd.org>
From: Mike M. Volokhov <mishka@apk.od.ua>
List: tech-pkg
Date: 08/19/2004 15:07:28
Hi again!

At this moment, mk/bsd.options.mk defines nice framework for various
package options, but it is recommended to use the following addition
before:

# Global and legacy options
.if defined(USE_FOO)
.  if !defined(PKG_OPTIONS.somepkg)
.    if defined(USE_FOO) && !empty(USE_FOO:M[yY][eE][sS])
PKG_OPTIONS.somepkg+=	foooption
.    endif
.  endif
.endif

Why not define this in more generic form and then include into
bsd.options.mk in the such way:

--- package makefile ---
PKG_OPTIONS_VAR=	PKG_OPTIONS.somepkg
PKG_SUPPORTED_OPTIONS=	foo bar
.include "../../mk/bsd.options.mk"

--- in bsd.options.mk ---
.for _PKG_OPTION in PKG_SUPPORTED_OPTIONS
.  if defined(USE_${_PKG_OPTION:tu})
.    if !defined(${PKG_OPTIONS_VAR})
.      if defined(USE_${_PKG_OPTION:tu}) && !empty(USE_${_PKG_OPTION:tu}:M[yY][eE][sS])
${PKG_OPTIONS_VAR}+=	${_PKG_OPTION}
.      endif
.    endif
.  endif
.endfor

Any comments please?

--
Mishka.