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
104 # ALL_TARGET CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS CONFLICTS_BUILD
105 # CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES EXTRA_PATCHES
106 # INSTALL_TARGET LDFLAGS LIBS MAKE_ARGS MAKE_ENV PATCHFILES PATCH_SITES
107 # PLIST_DIRS PLIST_DIRSTRY PLIST_FILES PLIST_SUB INFO USES, defining ${opt}_${variable} will
108 # add its content to the actual variable when the option is enabled. Defining
109 # ${opt}_${variable}_OFF will add its content to the actual variable when the
110 # option is disabled.
112 # For each of the depends target PKG FETCH EXTRACT PATCH BUILD LIB RUN,
113 # defining ${opt}_${deptype}_DEPENDS will add its content to the actual
114 # dependency when the option is enabled. Defining
115 # ${opt}_${deptype}_DEPENDS_OFF will add its content to the actual dependency
116 # when the option is disabled.
119 # Set all the options available for the ports, beginning with the
120 # global ones and ending with the ones decided by the maintainer.
122 .if !defined(OPTIONSMKINCLUDED)
123 OPTIONSMKINCLUDED= bsd.options.mk
125 OPTIONS_NAME?= ${PKGORIGIN:S/\//_/}
126 OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options
127 OPTIONS_FILE?= ${PORT_DBDIR}/${OPTIONS_NAME}/options
129 _OPTIONS_FLAGS= ALL_TARGET CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS \
130 CONFLICTS_BUILD CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES \
131 EXTRA_PATCHES INSTALL_TARGET LDFLAGS LIBS MAKE_ARGS MAKE_ENV \
132 PATCHFILES PATCH_SITES PLIST_DIRS PLIST_DIRSTRY PLIST_FILES \
134 _OPTIONS_DEPENDS= PKG FETCH EXTRACT PATCH BUILD LIB RUN
136 # Set the default values for the global options, as defined by portmgr
137 .if !defined(NOPORTDOCS)
140 OPTIONS_WARNINGS+= "NOPORTDOCS"
142 OPTIONS_WARNINGS_UNSET+= DOCS
145 .if !defined(WITHOUT_NLS)
151 .if !defined(NOPORTEXAMPLES)
152 PORT_OPTIONS+= EXAMPLES
154 OPTIONS_WARNINGS+= "NOPORTEXAMPLES"
156 OPTIONS_WARNINGS_UNSET+= EXAMPLES
161 # Add per arch options
162 .for opt in ${OPTIONS_DEFINE_${ARCH}}
163 .if empty(OPTIONS_DEFINE:M${opt})
164 OPTIONS_DEFINE+= ${opt}
168 # Add per arch defaults
169 OPTIONS_DEFAULT+= ${OPTIONS_DEFAULT_${ARCH}}
171 # Remove options the port maintainer doesn't want
172 .for opt in ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE} ${OPTIONS_SLAVE}
173 OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:N${opt}}
174 OPTIONS_DEFINE:= ${OPTIONS_DEFINE:N${opt}}
175 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
176 . for otype in SINGLE RADIO MULTI GROUP
177 . for m in ${OPTIONS_${otype}}
178 OPTIONS_${otype}_${m}:= ${OPTIONS_${otype}_${m}:N${opt}}
183 # Remove empty SINGLE/GROUP/RADIO/MULTI
184 # Can be empty because of exclude/slaves
185 .for otype in SINGLE RADIO MULTI GROUP
186 . for m in ${OPTIONS_${otype}}
187 . if empty(OPTIONS_${otype}_${m})
188 OPTIONS_${otype}:= ${OPTIONS_${otype}:N${m}}
194 ALL_OPTIONS:= ${OPTIONS_DEFINE:O:u}
195 OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:O:u}
198 COMPLETE_OPTIONS_LIST= ${ALL_OPTIONS}
199 .for otype in SINGLE RADIO MULTI GROUP
200 . for m in ${OPTIONS_${otype}}
201 COMPLETE_OPTIONS_LIST+= ${OPTIONS_${otype}_${m}}
205 ## Now create the list of activated options
206 .if defined(OPTIONS_OVERRIDE)
207 # Special case $OPTIONS_OVERRIDE; if it is defined forget about anything done
210 PORT_OPTIONS:= ${OPTIONS_OVERRIDE}
212 NEW_OPTIONS= ${COMPLETE_OPTIONS_LIST}
214 ## Set default options defined by the port maintainer
215 PORT_OPTIONS+= ${OPTIONS_DEFAULT}
217 ## Set system-wide defined options (set by user in make.conf)
218 . for opt in ${OPTIONS_SET}
219 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
220 PORT_OPTIONS+= ${opt}
221 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
225 ## Remove the options excluded system-wide (set by user in make.conf)
226 . for opt in ${OPTIONS_UNSET}
227 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
228 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
231 # XXX To remove once UNIQUENAME will be removed
232 ## Set the options specified per-port (set by user in make.conf)
233 . for opt in ${${UNIQUENAME}_SET}
234 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
235 PORT_OPTIONS+= ${opt}
236 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
240 ## Unset the options excluded per-port (set by user in make.conf)
241 . for opt in ${${UNIQUENAME}_UNSET}
242 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
243 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
245 # XXX To remove once UNIQUENAME will be removed
247 ## Set the options specified per-port (set by user in make.conf)
248 . for opt in ${${OPTIONS_NAME}_SET}
249 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
250 PORT_OPTIONS+= ${opt}
251 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
255 ## Unset the options excluded per-port (set by user in make.conf)
256 . for opt in ${${OPTIONS_NAME}_UNSET}
257 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
258 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
261 # XXX to remove once UNIQUENAME is removed
262 ## options files (from dialog)
263 . if exists(${OPTIONSFILE}) && !make(rmconfig)
264 . include "${OPTIONSFILE}"
266 . sinclude "${OPTIONSFILE}.local"
267 # XXX to remove once UNIQUENAME is removed
269 ## options files (from dialog)
270 . if exists(${OPTIONS_FILE}) && !make(rmconfig)
271 . include "${OPTIONS_FILE}"
273 . sinclude "${OPTIONS_FILE}.local"
275 ### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile
276 # XXX once WITH_DEBUG is not magic any more, do remove the :NDEBUG from here.
277 .for opt in ${ALL_OPTIONS:NDEBUG}
278 .if defined(WITH_${opt})
279 OPTIONS_WARNINGS+= "WITH_${opt}"
280 OPTIONS_WARNINGS_SET+= ${opt}
281 PORT_OPTIONS+= ${opt}
283 .if defined(WITHOUT_${opt})
284 OPTIONS_WARNINGS+= "WITHOUT_${opt}"
285 OPTIONS_WARNINGS_UNSET+= ${opt}
286 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
290 .if defined(OPTIONS_WARNINGS)
291 WARNING+= "You are using the following deprecated options: ${OPTIONS_WARNINGS}"
292 WARNING+= "If you added them on the command line, you should replace them by"
293 WARNING+= "WITH=\"${OPTIONS_WARNINGS_SET}\" WITHOUT=\"${OPTIONS_WARNINGS_UNSET}\""
295 WARNING+= "If they are global options set in your make.conf, you should replace them with:"
296 .if defined(OPTIONS_WARNINGS_SET)
297 WARNING+= "OPTIONS_SET=${OPTIONS_WARNINGS_SET}"
299 .if defined(OPTIONS_WARNINGS_UNSET)
300 WARNING+= "OPTIONS_UNSET=${OPTIONS_WARNINGS_UNSET}"
303 WARNING+= "If they are local to this port, you should use:"
304 .if defined(OPTIONS_WARNINGS_SET)
305 WARNING+= "${OPTIONS_NAME}_SET=${OPTIONS_WARNINGS_SET}"
307 .if defined(OPTIONS_WARNINGS_UNSET)
308 WARNING+= "${OPTIONS_NAME}_UNSET=${OPTIONS_WARNINGS_UNSET}"
312 ## Finish by using the options set by the port config dialog, if any
313 . for opt in ${OPTIONS_FILE_SET}
314 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
315 PORT_OPTIONS+= ${opt}
316 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
320 .for opt in ${OPTIONS_FILE_UNSET}
321 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
322 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
328 ## Set system-wide defined options (set by user in make.conf)
329 . for opt in ${OPTIONS_SET_FORCE}
330 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
331 PORT_OPTIONS+= ${opt}
332 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
336 ## Remove the options excluded system-wide (set by user in make.conf)
337 . for opt in ${OPTIONS_UNSET_FORCE}
338 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
339 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
342 # XXX To remove once UNIQUENAME will be removed
343 ## Set the options specified per-port (set by user in make.conf)
344 . for opt in ${${UNIQUENAME}_SET_FORCE}
345 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
346 PORT_OPTIONS+= ${opt}
347 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
351 ## Unset the options excluded per-port (set by user in make.conf)
352 . for opt in ${${UNIQUENAME}_UNSET_FORCE}
353 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
354 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
356 # XXX To remove once UNIQUENAME will be removed
358 ## Set the options specified per-port (set by user in make.conf)
359 . for opt in ${${OPTIONS_NAME}_SET_FORCE}
360 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
361 PORT_OPTIONS+= ${opt}
362 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
366 ## Unset the options excluded per-port (set by user in make.conf)
367 . for opt in ${${OPTIONS_NAME}_UNSET_FORCE}
368 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
369 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
373 ## Cmdline always win over the rest
375 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
376 PORT_OPTIONS+= ${opt}
377 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
381 .for opt in ${WITHOUT}
382 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
383 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
386 # Finally, add options required by slave ports
387 PORT_OPTIONS+= ${OPTIONS_SLAVE}
389 # Sort options and eliminate duplicates
390 PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
392 ## Now some compatibility
393 .if empty(PORT_OPTIONS:MDOCS)
397 .if empty(PORT_OPTIONS:MEXAMPLES)
401 .if ${PORT_OPTIONS:MDEBUG}
405 .if defined(NO_OPTIONS_SORT)
406 ALL_OPTIONS= ${OPTIONS_DEFINE}
409 .for opt in ${COMPLETE_OPTIONS_LIST} ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE}
413 . if defined(OPTIONS_SUB)
414 . if ! ${PLIST_SUB:M${opt}=*}
415 . if ${PORT_OPTIONS:M${opt}}
416 PLIST_SUB:= ${PLIST_SUB} ${opt}="" NO_${opt}="@comment "
418 PLIST_SUB:= ${PLIST_SUB} ${opt}="@comment " NO_${opt}=""
421 . if ! ${SUB_LIST:M${opt}=*}
422 . if ${PORT_OPTIONS:M${opt}}
423 SUB_LIST:= ${SUB_LIST} ${opt}="" NO_${opt}="@comment "
425 SUB_LIST:= ${SUB_LIST} ${opt}="@comment " NO_${opt}=""
430 . if ${PORT_OPTIONS:M${opt}}
431 . if defined(${opt}_USE)
432 . for option in ${${opt}_USE}
433 _u= ${option:C/=.*//g}
434 USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g}
437 . if defined(${opt}_CONFIGURE_ENABLE)
438 . for iopt in ${${opt}_CONFIGURE_ENABLE}
439 CONFIGURE_ARGS+= --enable-${iopt}
442 . if defined(${opt}_CONFIGURE_WITH)
443 . for iopt in ${${opt}_CONFIGURE_WITH}
444 CONFIGURE_ARGS+= --with-${iopt}
447 . for configure in CONFIGURE CMAKE QMAKE
448 . if defined(${opt}_${configure}_ON)
449 ${configure}_ARGS+= ${${opt}_${configure}_ON}
452 . for flags in ${_OPTIONS_FLAGS}
453 . if defined(${opt}_${flags})
454 ${flags}+= ${${opt}_${flags}}
457 . for deptype in ${_OPTIONS_DEPENDS}
458 . if defined(${opt}_${deptype}_DEPENDS)
459 ${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS}
463 . if defined(${opt}_CONFIGURE_ENABLE)
464 . for iopt in ${${opt}_CONFIGURE_ENABLE}
465 CONFIGURE_ARGS+= --disable-${iopt}
468 . if defined(${opt}_CONFIGURE_WITH)
469 . for iopt in ${${opt}_CONFIGURE_WITH}
470 CONFIGURE_ARGS+= --without-${iopt:C/=.*//}
473 . for configure in CONFIGURE CMAKE QMAKE
474 . if defined(${opt}_${configure}_OFF)
475 ${configure}_ARGS+= ${${opt}_${configure}_OFF}
478 . for flags in ${_OPTIONS_FLAGS}
479 . if defined(${opt}_${flags}_OFF)
480 ${flags}+= ${${opt}_${flags}_OFF}
483 . for deptype in ${_OPTIONS_DEPENDS}
484 . if defined(${opt}_${deptype}_DEPENDS_OFF)
485 ${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS_OFF}