Wed Mar 23 11:50:01 2016 UTC ()
Move handling for PKG_SUPPORTED_OPTIONS and PKG_SUGGESTED_OPTIONS as
OPSYSVARS to bsd.options.mk as they affect tests against PKG_OPTIONS
before bsd.pkg.mk is parsed.

Approved for commit during the freeze by agc@.


(jperkin)
diff -r1.71 -r1.72 pkgsrc/mk/bsd.options.mk
diff -r1.2017 -r1.2018 pkgsrc/mk/bsd.pkg.mk

cvs diff -r1.71 -r1.72 pkgsrc/mk/bsd.options.mk (expand / switch to unified diff)

--- pkgsrc/mk/bsd.options.mk 2013/06/07 00:41:39 1.71
+++ pkgsrc/mk/bsd.options.mk 2016/03/23 11:50:01 1.72
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: bsd.options.mk,v 1.71 2013/06/07 00:41:39 obache Exp $ 1# $NetBSD: bsd.options.mk,v 1.72 2016/03/23 11:50:01 jperkin Exp $
2# 2#
3# This Makefile fragment provides boilerplate code for standard naming 3# This Makefile fragment provides boilerplate code for standard naming
4# conventions for handling per-package build options. 4# conventions for handling per-package build options.
5# 5#
6# Before including this file, the following variables can be defined: 6# Before including this file, the following variables can be defined:
7# 7#
8# PKG_SUPPORTED_OPTIONS 8# PKG_SUPPORTED_OPTIONS
9# This is a list of build options supported by the package. 9# This is a list of build options supported by the package.
10# This variable should be set in a package Makefile. E.g., 10# This variable should be set in a package Makefile. E.g.,
11# 11#
12# PKG_SUPPORTED_OPTIONS= kerberos ldap ssl 12# PKG_SUPPORTED_OPTIONS= kerberos ldap ssl
13# 13#
14# PKG_OPTIONS_VAR (must be defined) 14# PKG_OPTIONS_VAR (must be defined)
@@ -168,26 +168,36 @@ PKG_OPTIONS= # empty @@ -168,26 +168,36 @@ PKG_OPTIONS= # empty
168 168
169# Check for variable definitions required before including this file. 169# Check for variable definitions required before including this file.
170.if !defined(PKG_OPTIONS_VAR) 170.if !defined(PKG_OPTIONS_VAR)
171PKG_FAIL_REASON+= "[bsd.options.mk] PKG_OPTIONS_VAR is not defined." 171PKG_FAIL_REASON+= "[bsd.options.mk] PKG_OPTIONS_VAR is not defined."
172.endif 172.endif
173.if !defined(PKG_SUPPORTED_OPTIONS) \ 173.if !defined(PKG_SUPPORTED_OPTIONS) \
174 && !defined(PKG_OPTIONS_OPTIONAL_GROUPS) \ 174 && !defined(PKG_OPTIONS_OPTIONAL_GROUPS) \
175 && !defined(PKG_OPTIONS_REQUIRED_GROUPS) \ 175 && !defined(PKG_OPTIONS_REQUIRED_GROUPS) \
176 && !defined(PKG_OPTIONS_NONEMPTY_SETS) 176 && !defined(PKG_OPTIONS_NONEMPTY_SETS)
177PKG_SUPPORTED_OPTIONS?= # none 177PKG_SUPPORTED_OPTIONS?= # none
178PKG_FAIL_REASON+= "[bsd.options.mk] The package has no options, but includes this file." 178PKG_FAIL_REASON+= "[bsd.options.mk] The package has no options, but includes this file."
179.endif 179.endif
180 180
 181# Handle OPSYSVARS here for package options as we need to test PKG_OPTIONS
 182# in options.mk and cannot wait for lazy evaluation from bsd.pkg.mk.
 183.for _var_ in PKG_SUPPORTED_OPTIONS PKG_SUGGESTED_OPTIONS
 184. if defined(${_var_}.${OPSYS})
 185${_var_}+= ${${_var_}.${OPSYS}}
 186. elif defined(${_var_}.*)
 187${_var_}+= ${${_var_}.*}
 188. endif
 189.endfor
 190
181# 191#
182# create map of option to group and add group options to PKG_SUPPORTED_OPTIONS 192# create map of option to group and add group options to PKG_SUPPORTED_OPTIONS
183# 193#
184.for _grp_ in ${PKG_OPTIONS_OPTIONAL_GROUPS} ${PKG_OPTIONS_REQUIRED_GROUPS} 194.for _grp_ in ${PKG_OPTIONS_OPTIONAL_GROUPS} ${PKG_OPTIONS_REQUIRED_GROUPS}
185_PKG_OPTIONS_GROUP_STACK.${_grp_}:=#empty 195_PKG_OPTIONS_GROUP_STACK.${_grp_}:=#empty
186. if !defined(PKG_OPTIONS_GROUP.${_grp_}) || empty(PKG_OPTIONS_GROUP.${_grp_}) 196. if !defined(PKG_OPTIONS_GROUP.${_grp_}) || empty(PKG_OPTIONS_GROUP.${_grp_})
187PKG_FAIL_REASON+= "[bsd.options.mk] PKG_OPTIONS_GROUP."${_grp_:Q}" must be non-empty." 197PKG_FAIL_REASON+= "[bsd.options.mk] PKG_OPTIONS_GROUP."${_grp_:Q}" must be non-empty."
188. endif 198. endif
189. for _opt_ in ${PKG_OPTIONS_GROUP.${_grp_}} 199. for _opt_ in ${PKG_OPTIONS_GROUP.${_grp_}}
190PKG_SUPPORTED_OPTIONS+= ${_opt_} 200PKG_SUPPORTED_OPTIONS+= ${_opt_}
191_PKG_OPTIONS_GROUP_MAP.${_opt_}=${_grp_} 201_PKG_OPTIONS_GROUP_MAP.${_opt_}=${_grp_}
192. endfor 202. endfor
193.endfor 203.endfor

cvs diff -r1.2017 -r1.2018 pkgsrc/mk/bsd.pkg.mk (expand / switch to unified diff)

--- pkgsrc/mk/bsd.pkg.mk 2016/02/26 11:38:37 1.2017
+++ pkgsrc/mk/bsd.pkg.mk 2016/03/23 11:50:01 1.2018
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: bsd.pkg.mk,v 1.2017 2016/02/26 11:38:37 jperkin Exp $ 1# $NetBSD: bsd.pkg.mk,v 1.2018 2016/03/23 11:50:01 jperkin Exp $
2# 2#
3# This file is in the public domain. 3# This file is in the public domain.
4# 4#
5# Please see the pkgsrc/doc/guide manual for details on the 5# Please see the pkgsrc/doc/guide manual for details on the
6# variables used in this make file template. 6# variables used in this make file template.
7# 7#
8# Default sequence for "all" is: 8# Default sequence for "all" is:
9# 9#
10# bootstrap-depends 10# bootstrap-depends
11# fetch 11# fetch
12# checksum 12# checksum
13# depends 13# depends
14# tools 14# tools
@@ -132,27 +132,26 @@ PKG_FAIL_REASON+='CATEGORIES are mandato @@ -132,27 +132,26 @@ PKG_FAIL_REASON+='CATEGORIES are mandato
132.if !defined(PKGNAME) && !defined(DISTNAME) 132.if !defined(PKGNAME) && !defined(DISTNAME)
133PKG_FAIL_REASON+='PKGNAME and/or DISTNAME are mandatory.' 133PKG_FAIL_REASON+='PKGNAME and/or DISTNAME are mandatory.'
134.endif 134.endif
135 135
136.if defined(PKG_PATH) 136.if defined(PKG_PATH)
137PKG_FAIL_REASON+='Please unset PKG_PATH before doing pkgsrc work!' 137PKG_FAIL_REASON+='Please unset PKG_PATH before doing pkgsrc work!'
138.endif 138.endif
139 139
140# Allow variables to be set on a per-OS basis 140# Allow variables to be set on a per-OS basis
141OPSYSVARS+= CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS 141OPSYSVARS+= CFLAGS CXXFLAGS CPPFLAGS LDFLAGS LIBS
142OPSYSVARS+= CMAKE_ARGS CONFIGURE_ARGS CONFIGURE_ENV 142OPSYSVARS+= CMAKE_ARGS CONFIGURE_ARGS CONFIGURE_ENV
143OPSYSVARS+= BUILDLINK_TRANSFORM SUBST_CLASSES 143OPSYSVARS+= BUILDLINK_TRANSFORM SUBST_CLASSES
144OPSYSVARS+= BUILD_TARGET MAKE_ENV MAKE_FLAGS USE_TOOLS 144OPSYSVARS+= BUILD_TARGET MAKE_ENV MAKE_FLAGS USE_TOOLS
145OPSYSVARS+= PKG_SUPPORTED_OPTIONS PKG_SUGGESTED_OPTIONS 
146.for _var_ in ${OPSYSVARS:O} 145.for _var_ in ${OPSYSVARS:O}
147. if defined(${_var_}.${OPSYS}) 146. if defined(${_var_}.${OPSYS})
148${_var_}+= ${${_var_}.${OPSYS}} 147${_var_}+= ${${_var_}.${OPSYS}}
149. elif defined(${_var_}.*) 148. elif defined(${_var_}.*)
150${_var_}+= ${${_var_}.*} 149${_var_}+= ${${_var_}.*}
151. endif 150. endif
152.endfor 151.endfor
153 152
154CPPFLAGS+= ${CPP_PRECOMP_FLAGS} 153CPPFLAGS+= ${CPP_PRECOMP_FLAGS}
155 154
156# To sanitise environment set PKGSRC_SETENV=${SETENV} -i 155# To sanitise environment set PKGSRC_SETENV=${SETENV} -i
157# This will however cause build failures (e.g. "www/firefox"). Settings 156# This will however cause build failures (e.g. "www/firefox"). Settings
158# like "ALLOW_VULNERABLE_PACKAGES" will also not be correctly passed 157# like "ALLOW_VULNERABLE_PACKAGES" will also not be correctly passed