| @@ -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) |
171 | PKG_FAIL_REASON+= "[bsd.options.mk] PKG_OPTIONS_VAR is not defined." | | 171 | PKG_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) |
177 | PKG_SUPPORTED_OPTIONS?= # none | | 177 | PKG_SUPPORTED_OPTIONS?= # none |
178 | PKG_FAIL_REASON+= "[bsd.options.mk] The package has no options, but includes this file." | | 178 | PKG_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_}) |
187 | PKG_FAIL_REASON+= "[bsd.options.mk] PKG_OPTIONS_GROUP."${_grp_:Q}" must be non-empty." | | 197 | PKG_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_}} |
190 | PKG_SUPPORTED_OPTIONS+= ${_opt_} | | 200 | PKG_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 |