3 # These variables are used in port makefiles to define the options for a port.
5 # OPTIONS_DEFINE - List of options this ports accept
6 # OPTIONS_DEFINE_${ARCH} - List of options this ports accept and are
8 # OPTIONS_DEFAULT - List of options activated by default
9 # OPTIONS_DEFAULT_${ARCH} - List of options activated by default for a
12 # ${OPTION}_DESC - Description of the ${OPTION}
14 # OPTIONS_SINGLE - List of single-choice grouped options: 1 and
16 # OPTIONS_RADIO - List of radio-choice grouped options: 0 or 1
18 # OPTIONS_MULTI - List of multiple-choice grouped options: at
20 # OPTIONS_GROUP - List of group-choice grouped options: 0 or
23 # OPTIONS_SINGLE_${NAME} - List of OPTIONS grouped as single choice (for
24 # the single named as ${NAME} as defined in
26 # OPTIONS_RADIO_${NAME} - List of OPTIONS grouped as radio choice (for
27 # the radio named as ${NAME} as defined in
29 # OPTIONS_MULTI_${NAME} - List of OPTIONS grouped as multiple-choice
30 # (for the multi named as ${NAME} as defined in
32 # OPTIONS_GROUP_${NAME} - List of OPTIONS grouped as group-choice (for
33 # the group named as ${NAME} as defined in
36 # OPTIONS_EXCLUDE - List of options unsupported (useful for slave ports)
37 # OPTIONS_EXCLUDE_${ARCH} - List of options unsupported on a given ${ARCH}
38 # OPTIONS_SLAVE - This is designed for slave ports, it removes an
39 # option from the options list inherited from the
40 # master port and it always adds it to PORT_OPTIONS
43 # These variables can be used in make.conf to configure options. They are
44 # processed in the order listed below, i.e. later variables override the effects
45 # of previous variables. Options saved using the options dialog are processed
46 # right before OPTIONS_SET_FORCE. When building a port a dialog to configure
47 # options will only appear if there are new options, i.e. options which have not
48 # been configured before either using the option dialog in a previous build or
49 # using the variables below. You can force the dialog to appear by running
52 # OPTIONS_SET - List of options to enable for all ports.
53 # OPTIONS_UNSET - List of options to disable for all ports.
54 # ${OPTIONS_NAME}_SET - List of options to enable for a specific port.
55 # ${OPTIONS_NAME}_UNSET - List of options to disable for a specific port.
57 # OPTIONS_SET_FORCE - List of options to enable for all ports.
58 # OPTIONS_UNSET_FORCE - List of options to disable for all ports.
59 # ${OPTIONS_NAME}_SET_FORCE - List of options to enable for a specific port.
60 # ${OPTIONS_NAME}_UNSET_FORCE
61 # - List of options to disable for a specific port.
63 # These variables can be used on the command line. They override the effects of
64 # the make.conf variables above.
66 # WITH - Set options from the command line
67 # WITHOUT - Unset options from the command line
70 # The following knobs are there to simplify the handling of OPTIONS in simple
73 # OPTIONS_SUB When defined it will add to PLIST_SUB:
74 # Option enabled ${opt}=""
75 # Option disabled ${opt}="@comment "
77 # ${opt}_CONFIGURE_ON When option is enabled, it will add its content to
79 # ${opt}_CONFIGURE_OFF When option is disabled, it will add its content to
81 # ${opt}_CONFIGURE_ENABLE Will add to CONFIGURE_ARGS:
82 # Option enabled --enable-${content}
83 # Option disabled --disable-${content}
84 # ${opt}_CONFIGURE_WITH Will add to CONFIGURE_ARGS:
85 # Option enabled --with-${content}
86 # Option disabled --without-${content}
88 # ${opt}_CMAKE_ON When option is enabled, it will add its content to
90 # ${opt}_CMAKE_OFF When option is disabled, it will add its content to
93 # ${opt}_QMAKE_ON When option is enabled, it will add its content to
95 # ${opt}_QMAKE_OFF When option is disabled, it will add its content to
98 # ${opt}_USE= FOO=bar When option is enabled, it will enable
100 # If you need more than one option, you can do
101 # FOO=bar,baz and you'll get USE_FOO=bar baz
102 # ${opt}_USE_OFF= FOO=bar When option is disabled, it will enable
106 # ALL_TARGET CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS CONFLICTS_BUILD
107 # CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES EXTRA_PATCHES
108 # INSTALL_TARGET LDFLAGS LIBS MAKE_ARGS MAKE_ENV PATCHFILES PATCH_SITES
109 # PLIST_DIRS PLIST_DIRSTRY PLIST_FILES PLIST_SUB INFO USES, defining ${opt}_${variable} will
110 # add its content to the actual variable when the option is enabled. Defining
111 # ${opt}_${variable}_OFF will add its content to the actual variable when the
112 # option is disabled.
114 # For each of the depends target PKG FETCH EXTRACT PATCH BUILD LIB RUN,
115 # defining ${opt}_${deptype}_DEPENDS will add its content to the actual
116 # dependency when the option is enabled. Defining
117 # ${opt}_${deptype}_DEPENDS_OFF will add its content to the actual dependency
118 # when the option is disabled.
121 # Set all the options available for the ports, beginning with the
122 # global ones and ending with the ones decided by the maintainer.
124 .if !defined(OPTIONSMKINCLUDED)
125 OPTIONSMKINCLUDED= bsd.options.mk
127 OPTIONS_NAME?= ${PKGORIGIN:S/\//_/}
128 OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options
129 OPTIONS_FILE?= ${PORT_DBDIR}/${OPTIONS_NAME}/options
131 _OPTIONS_FLAGS= ALL_TARGET CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS \
132 CONFLICTS_BUILD CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES \
133 EXTRA_PATCHES INSTALL_TARGET LDFLAGS LIBS MAKE_ARGS MAKE_ENV \
134 PATCHFILES PATCH_SITES PLIST_DIRS PLIST_DIRSTRY PLIST_FILES \
136 _OPTIONS_DEPENDS= PKG FETCH EXTRACT PATCH BUILD LIB RUN
138 # Set the default values for the global options, as defined by portmgr
139 .if !defined(NOPORTDOCS)
142 OPTIONS_WARNINGS+= "NOPORTDOCS"
144 OPTIONS_WARNINGS_UNSET+= DOCS
147 .if !defined(WITHOUT_NLS)
153 .if !defined(NOPORTEXAMPLES)
154 PORT_OPTIONS+= EXAMPLES
156 OPTIONS_WARNINGS+= "NOPORTEXAMPLES"
158 OPTIONS_WARNINGS_UNSET+= EXAMPLES
163 # Add per arch options
164 .for opt in ${OPTIONS_DEFINE_${ARCH}}
165 .if empty(OPTIONS_DEFINE:M${opt})
166 OPTIONS_DEFINE+= ${opt}
170 # Add per arch defaults
171 OPTIONS_DEFAULT+= ${OPTIONS_DEFAULT_${ARCH}}
173 # Remove options the port maintainer doesn't want
174 .for opt in ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE} ${OPTIONS_SLAVE}
175 OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:N${opt}}
176 OPTIONS_DEFINE:= ${OPTIONS_DEFINE:N${opt}}
177 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
178 . for otype in SINGLE RADIO MULTI GROUP
179 . for m in ${OPTIONS_${otype}}
180 OPTIONS_${otype}_${m}:= ${OPTIONS_${otype}_${m}:N${opt}}
185 # Remove empty SINGLE/GROUP/RADIO/MULTI
186 # Can be empty because of exclude/slaves
187 .for otype in SINGLE RADIO MULTI GROUP
188 . for m in ${OPTIONS_${otype}}
189 . if empty(OPTIONS_${otype}_${m})
190 OPTIONS_${otype}:= ${OPTIONS_${otype}:N${m}}
196 ALL_OPTIONS:= ${OPTIONS_DEFINE:O:u}
197 OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:O:u}
200 COMPLETE_OPTIONS_LIST= ${ALL_OPTIONS}
201 .for otype in SINGLE RADIO MULTI GROUP
202 . for m in ${OPTIONS_${otype}}
203 COMPLETE_OPTIONS_LIST+= ${OPTIONS_${otype}_${m}}
207 ## Now create the list of activated options
208 .if defined(OPTIONS_OVERRIDE)
209 # Special case $OPTIONS_OVERRIDE; if it is defined forget about anything done
212 PORT_OPTIONS:= ${OPTIONS_OVERRIDE}
214 NEW_OPTIONS= ${COMPLETE_OPTIONS_LIST}
216 ## Set default options defined by the port maintainer
217 PORT_OPTIONS+= ${OPTIONS_DEFAULT}
219 ## Set system-wide defined options (set by user in make.conf)
220 . for opt in ${OPTIONS_SET}
221 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
222 PORT_OPTIONS+= ${opt}
223 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
227 ## Remove the options excluded system-wide (set by user in make.conf)
228 . for opt in ${OPTIONS_UNSET}
229 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
230 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
233 # XXX To remove once UNIQUENAME will be removed
234 ## Set the options specified per-port (set by user in make.conf)
235 . for opt in ${${UNIQUENAME}_SET}
236 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
237 PORT_OPTIONS+= ${opt}
238 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
242 ## Unset the options excluded per-port (set by user in make.conf)
243 . for opt in ${${UNIQUENAME}_UNSET}
244 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
245 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
247 # XXX To remove once UNIQUENAME will be removed
249 ## Set the options specified per-port (set by user in make.conf)
250 . for opt in ${${OPTIONS_NAME}_SET}
251 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
252 PORT_OPTIONS+= ${opt}
253 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
257 ## Unset the options excluded per-port (set by user in make.conf)
258 . for opt in ${${OPTIONS_NAME}_UNSET}
259 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
260 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
263 # XXX to remove once UNIQUENAME is removed
264 ## options files (from dialog)
265 . if exists(${OPTIONSFILE}) && !make(rmconfig)
266 . include "${OPTIONSFILE}"
268 . sinclude "${OPTIONSFILE}.local"
269 # XXX to remove once UNIQUENAME is removed
271 ## options files (from dialog)
272 . if exists(${OPTIONS_FILE}) && !make(rmconfig)
273 . include "${OPTIONS_FILE}"
275 . sinclude "${OPTIONS_FILE}.local"
277 ### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile
278 # XXX once WITH_DEBUG is not magic any more, do remove the :NDEBUG from here.
279 .for opt in ${ALL_OPTIONS:NDEBUG}
280 .if defined(WITH_${opt})
281 OPTIONS_WARNINGS+= "WITH_${opt}"
282 OPTIONS_WARNINGS_SET+= ${opt}
283 PORT_OPTIONS+= ${opt}
285 .if defined(WITHOUT_${opt})
286 OPTIONS_WARNINGS+= "WITHOUT_${opt}"
287 OPTIONS_WARNINGS_UNSET+= ${opt}
288 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
292 .if defined(OPTIONS_WARNINGS)
293 WARNING+= "You are using the following deprecated options: ${OPTIONS_WARNINGS}"
294 WARNING+= "If you added them on the command line, you should replace them by"
295 WARNING+= "WITH=\"${OPTIONS_WARNINGS_SET}\" WITHOUT=\"${OPTIONS_WARNINGS_UNSET}\""
297 WARNING+= "If they are global options set in your make.conf, you should replace them with:"
298 .if defined(OPTIONS_WARNINGS_SET)
299 WARNING+= "OPTIONS_SET=${OPTIONS_WARNINGS_SET}"
301 .if defined(OPTIONS_WARNINGS_UNSET)
302 WARNING+= "OPTIONS_UNSET=${OPTIONS_WARNINGS_UNSET}"
305 WARNING+= "If they are local to this port, you should use:"
306 .if defined(OPTIONS_WARNINGS_SET)
307 WARNING+= "${OPTIONS_NAME}_SET=${OPTIONS_WARNINGS_SET}"
309 .if defined(OPTIONS_WARNINGS_UNSET)
310 WARNING+= "${OPTIONS_NAME}_UNSET=${OPTIONS_WARNINGS_UNSET}"
314 ## Finish by using the options set by the port config dialog, if any
315 . for opt in ${OPTIONS_FILE_SET}
316 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
317 PORT_OPTIONS+= ${opt}
318 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
322 .for opt in ${OPTIONS_FILE_UNSET}
323 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
324 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
330 ## Set system-wide defined options (set by user in make.conf)
331 . for opt in ${OPTIONS_SET_FORCE}
332 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
333 PORT_OPTIONS+= ${opt}
334 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
338 ## Remove the options excluded system-wide (set by user in make.conf)
339 . for opt in ${OPTIONS_UNSET_FORCE}
340 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
341 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
344 # XXX To remove once UNIQUENAME will be removed
345 ## Set the options specified per-port (set by user in make.conf)
346 . for opt in ${${UNIQUENAME}_SET_FORCE}
347 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
348 PORT_OPTIONS+= ${opt}
349 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
353 ## Unset the options excluded per-port (set by user in make.conf)
354 . for opt in ${${UNIQUENAME}_UNSET_FORCE}
355 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
356 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
358 # XXX To remove once UNIQUENAME will be removed
360 ## Set the options specified per-port (set by user in make.conf)
361 . for opt in ${${OPTIONS_NAME}_SET_FORCE}
362 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
363 PORT_OPTIONS+= ${opt}
364 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
368 ## Unset the options excluded per-port (set by user in make.conf)
369 . for opt in ${${OPTIONS_NAME}_UNSET_FORCE}
370 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
371 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
375 ## Cmdline always win over the rest
377 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
378 PORT_OPTIONS+= ${opt}
379 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
383 .for opt in ${WITHOUT}
384 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
385 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
388 # Finally, add options required by slave ports
389 PORT_OPTIONS+= ${OPTIONS_SLAVE}
391 # Sort options and eliminate duplicates
392 PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
394 ## Now some compatibility
395 .if empty(PORT_OPTIONS:MDOCS)
399 .if empty(PORT_OPTIONS:MEXAMPLES)
403 .if ${PORT_OPTIONS:MDEBUG}
407 .if defined(NO_OPTIONS_SORT)
408 ALL_OPTIONS= ${OPTIONS_DEFINE}
411 .for opt in ${COMPLETE_OPTIONS_LIST} ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE}
415 . if defined(OPTIONS_SUB)
416 . if ! ${PLIST_SUB:M${opt}=*}
417 . if ${PORT_OPTIONS:M${opt}}
418 PLIST_SUB:= ${PLIST_SUB} ${opt}="" NO_${opt}="@comment "
420 PLIST_SUB:= ${PLIST_SUB} ${opt}="@comment " NO_${opt}=""
423 . if ! ${SUB_LIST:M${opt}=*}
424 . if ${PORT_OPTIONS:M${opt}}
425 SUB_LIST:= ${SUB_LIST} ${opt}="" NO_${opt}="@comment "
427 SUB_LIST:= ${SUB_LIST} ${opt}="@comment " NO_${opt}=""
432 . if ${PORT_OPTIONS:M${opt}}
433 . if defined(${opt}_USE)
434 . for option in ${${opt}_USE}
435 _u= ${option:C/=.*//g}
436 USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g}
439 . if defined(${opt}_CONFIGURE_ENABLE)
440 . for iopt in ${${opt}_CONFIGURE_ENABLE}
441 CONFIGURE_ARGS+= --enable-${iopt}
444 . if defined(${opt}_CONFIGURE_WITH)
445 . for iopt in ${${opt}_CONFIGURE_WITH}
446 CONFIGURE_ARGS+= --with-${iopt}
449 . for configure in CONFIGURE CMAKE QMAKE
450 . if defined(${opt}_${configure}_ON)
451 ${configure}_ARGS+= ${${opt}_${configure}_ON}
454 . for flags in ${_OPTIONS_FLAGS}
455 . if defined(${opt}_${flags})
456 ${flags}+= ${${opt}_${flags}}
459 . for deptype in ${_OPTIONS_DEPENDS}
460 . if defined(${opt}_${deptype}_DEPENDS)
461 ${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS}
465 . if defined(${opt}_USE_OFF)
466 . for option in ${${opt}_USE_OFF}
467 _u= ${option:C/=.*//g}
468 USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g}
471 . if defined(${opt}_CONFIGURE_ENABLE)
472 . for iopt in ${${opt}_CONFIGURE_ENABLE}
473 CONFIGURE_ARGS+= --disable-${iopt:C/=.*//}
476 . if defined(${opt}_CONFIGURE_WITH)
477 . for iopt in ${${opt}_CONFIGURE_WITH}
478 CONFIGURE_ARGS+= --without-${iopt:C/=.*//}
481 . for configure in CONFIGURE CMAKE QMAKE
482 . if defined(${opt}_${configure}_OFF)
483 ${configure}_ARGS+= ${${opt}_${configure}_OFF}
486 . for flags in ${_OPTIONS_FLAGS}
487 . if defined(${opt}_${flags}_OFF)
488 ${flags}+= ${${opt}_${flags}_OFF}
491 . for deptype in ${_OPTIONS_DEPENDS}
492 . if defined(${opt}_${deptype}_DEPENDS_OFF)
493 ${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS_OFF}