6 # These variables are used in port makefiles to define the options for a port.
8 # OPTIONS_DEFINE - List of options this ports accept
9 # OPTIONS_DEFINE_${ARCH} - List of options this ports accept and are
11 # OPTIONS_DEFAULT - List of options activated by default
12 # OPTIONS_DEFAULT_${ARCH} - List of options activated by default for a
15 # ${OPTION}_DESC - Description of the ${OPTION}
17 # OPTIONS_SINGLE - List of single-choice grouped options: 1 and
19 # OPTIONS_RADIO - List of radio-choice grouped options: 0 or 1
21 # OPTIONS_MULTI - List of multiple-choice grouped options: at
23 # OPTIONS_GROUP - List of group-choice grouped options: 0 or
26 # OPTIONS_SINGLE_${NAME} - List of OPTIONS grouped as single choice (for
27 # the single named as ${NAME} as defined in
29 # OPTIONS_RADIO_${NAME} - List of OPTIONS grouped as radio choice (for
30 # the radio named as ${NAME} as defined in
32 # OPTIONS_MULTI_${NAME} - List of OPTIONS grouped as multiple-choice
33 # (for the multi named as ${NAME} as defined in
35 # OPTIONS_GROUP_${NAME} - List of OPTIONS grouped as group-choice (for
36 # the group named as ${NAME} as defined in
39 # OPTIONS_EXCLUDE - List of options unsupported (useful for slave ports)
40 # OPTIONS_EXCLUDE_${ARCH} - List of options unsupported on a given ${ARCH}
41 # OPTIONS_SLAVE - This is designed for slave ports, it removes an
42 # option from the options list inherited from the
43 # master port and it always adds it to PORT_OPTIONS
46 # These variables can be used in make.conf to configure options. They are
47 # processed in the order listed below, i.e. later variables override the effects
48 # of previous variables. Options saved using the options dialog are processed
49 # right before OPTIONS_SET_FORCE. When building a port a dialog to configure
50 # options will only appear if there are new options, i.e. options which have not
51 # been configured before either using the option dialog in a previous build or
52 # using the variables below. You can force the dialog to appear by running
55 # OPTIONS_SET - List of options to enable for all ports.
56 # OPTIONS_UNSET - List of options to disable for all ports.
57 # ${OPTIONS_NAME}_SET - List of options to enable for a specific port.
58 # ${OPTIONS_NAME}_UNSET - List of options to disable for a specific port.
60 # OPTIONS_SET_FORCE - List of options to enable for all ports.
61 # OPTIONS_UNSET_FORCE - List of options to disable for all ports.
62 # ${OPTIONS_NAME}_SET_FORCE - List of options to enable for a specific port.
63 # ${OPTIONS_NAME}_UNSET_FORCE
64 # - List of options to disable for a specific port.
66 # These variables can be used on the command line. They override the effects of
67 # the make.conf variables above.
69 # WITH - Set options from the command line
70 # WITHOUT - Unset options from the command line
73 # The following knobs are there to simplify the handling of OPTIONS in simple
76 # OPTIONS_SUB When defined it will add to PLIST_SUB:
77 # Option enabled ${opt}=""
78 # Option disabled ${opt}="@comment "
80 # ${opt}_CONFIGURE_ON When option is enabled, it will add its content to
82 # ${opt}_CONFIGURE_OFF When option is disabled, it will add its content to
84 # ${opt}_CONFIGURE_ENABLE Will add to CONFIGURE_ARGS:
85 # Option enabled --enable-${content}
86 # Option disabled --disable-${content}
87 # ${opt}_CONFIGURE_WITH Will add to CONFIGURE_ARGS:
88 # Option enabled --with-${content}
89 # Option disabled --without-${content}
91 # ${opt}_CMAKE_ON When option is enabled, it will add its content to
93 # ${opt}_CMAKE_OFF When option is disabled, it will add its content to
96 # ${opt}_QMAKE_ON When option is enabled, it will add its content to
98 # ${opt}_QMAKE_OFF When option is disabled, it will add its content to
101 # ${opt}_USE= FOO=bar When option is enabled, it will enable
103 # If you need more than one option, you can do
104 # FOO=bar,baz and you'll get USE_FOO=bar baz
107 # ALL_TARGET CATEGORIES CONFIGURE_ENV CONFLICTS CONFLICTS_BUILD
108 # CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES EXTRA_PATCHES FLAGS
109 # INSTALL_TARGET LDFLAGS MAKE_ARGS MAKE_ENV PATCHFILES PATCH_SITES PLIST_DIRS
110 # PLIST_DIRSTRY PLIST_FILES USES, defining ${opt}_${variable} will add its
111 # content to the actual variable when the option is enabled. Defining
112 # ${opt}_${variable}_OFF will add its content to the actual variable when the
113 # option is disabled.
115 # For each of the depends target PKG FETCH EXTRACT PATCH BUILD LIB RUN,
116 # defining ${opt}_${deptype}_DEPENDS will add its content to the actual
117 # dependency when the option is enabled. Defining
118 # ${opt}_${deptype}_DEPENDS_OFF will add its content to the actual dependency
119 # when the option is enabled.
122 # Set all the options available for the ports, beginning with the
123 # global ones and ending with the ones decided by the maintainer.
125 .if !defined(OPTIONSMKINCLUDED)
126 OPTIONSMKINCLUDED= bsd.options.mk
128 OPTIONS_NAME?= ${PKGORIGIN:S/\//_/}
129 OPTIONSFILE?= ${PORT_DBDIR}/${UNIQUENAME}/options
130 OPTIONS_FILE?= ${PORT_DBDIR}/${OPTIONS_NAME}/options
132 _OPTIONS_FLAGS= ALL_TARGET CATEGORIES CFLAGS CONFIGURE_ENV CONFLICTS \
133 CONFLICTS_BUILD CONFLICTS_INSTALL CPPFLAGS CXXFLAGS DISTFILES \
134 EXTRA_PATCHES INSTALL_TARGET LDFLAGS MAKE_ARGS MAKE_ENV \
135 PATCHFILES PATCH_SITES PLIST_DIRS PLIST_DIRSTRY PLIST_FILES \
137 _OPTIONS_DEPENDS= PKG FETCH EXTRACT PATCH BUILD LIB RUN
139 # Set the default values for the global options, as defined by portmgr
140 .if !defined(NOPORTDOCS)
143 OPTIONS_WARNINGS+= "NOPORTDOCS"
145 OPTIONS_WARNINGS_UNSET+= DOCS
148 .if !defined(WITHOUT_NLS)
154 .if !defined(NOPORTEXAMPLES)
155 PORT_OPTIONS+= EXAMPLES
157 OPTIONS_WARNINGS+= "NOPORTEXAMPLES"
159 OPTIONS_WARNINGS_UNSET+= EXAMPLES
164 # Add per arch options
165 .for opt in ${OPTIONS_DEFINE_${ARCH}}
166 .if empty(OPTIONS_DEFINE:M${opt})
167 OPTIONS_DEFINE+= ${opt}
171 # Add per arch defaults
172 OPTIONS_DEFAULT+= ${OPTIONS_DEFAULT_${ARCH}}
174 # Remove options the port maintainer doesn't want
175 .for opt in ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE} ${OPTIONS_SLAVE}
176 OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:N${opt}}
177 OPTIONS_DEFINE:= ${OPTIONS_DEFINE:N${opt}}
178 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
179 . for otype in SINGLE RADIO MULTI GROUP
180 . for m in ${OPTIONS_${otype}}
181 OPTIONS_${otype}_${m}:= ${OPTIONS_${otype}_${m}:N${opt}}
186 # Remove empty SINGLE/GROUP/RADIO/MULTI
187 # Can be empty because of exclude/slaves
188 .for otype in SINGLE RADIO MULTI GROUP
189 . for m in ${OPTIONS_${otype}}
190 . if empty(OPTIONS_${otype}_${m})
191 OPTIONS_${otype}:= ${OPTIONS_${otype}:N${m}}
197 ALL_OPTIONS:= ${OPTIONS_DEFINE:O:u}
198 OPTIONS_DEFAULT:= ${OPTIONS_DEFAULT:O:u}
201 COMPLETE_OPTIONS_LIST= ${ALL_OPTIONS}
202 .for otype in SINGLE RADIO MULTI GROUP
203 . for m in ${OPTIONS_${otype}}
204 COMPLETE_OPTIONS_LIST+= ${OPTIONS_${otype}_${m}}
208 ## Now create the list of activated options
209 .if defined(OPTIONS_OVERRIDE)
210 # Special case $OPTIONS_OVERRIDE; if it is defined forget about anything done
213 PORT_OPTIONS:= ${OPTIONS_OVERRIDE}
215 NEW_OPTIONS= ${COMPLETE_OPTIONS_LIST}
217 ## Set default options defined by the port maintainer
218 PORT_OPTIONS+= ${OPTIONS_DEFAULT}
220 ## Set system-wide defined options (set by user in make.conf)
221 . for opt in ${OPTIONS_SET}
222 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
223 PORT_OPTIONS+= ${opt}
224 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
228 ## Remove the options excluded system-wide (set by user in make.conf)
229 . for opt in ${OPTIONS_UNSET}
230 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
231 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
234 # XXX To remove once UNIQUENAME will be removed
235 ## Set the options specified per-port (set by user in make.conf)
236 . for opt in ${${UNIQUENAME}_SET}
237 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
238 PORT_OPTIONS+= ${opt}
239 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
243 ## Unset the options excluded per-port (set by user in make.conf)
244 . for opt in ${${UNIQUENAME}_UNSET}
245 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
246 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
248 # XXX To remove once UNIQUENAME will be removed
250 ## Set the options specified per-port (set by user in make.conf)
251 . for opt in ${${OPTIONS_NAME}_SET}
252 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
253 PORT_OPTIONS+= ${opt}
254 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
258 ## Unset the options excluded per-port (set by user in make.conf)
259 . for opt in ${${OPTIONS_NAME}_UNSET}
260 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
261 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
264 # XXX to remove once UNIQUENAME is removed
265 ## options files (from dialog)
266 . if exists(${OPTIONSFILE}) && !make(rmconfig)
267 . include "${OPTIONSFILE}"
269 . sinclude "${OPTIONSFILE}.local"
270 # XXX to remove once UNIQUENAME is removed
272 ## options files (from dialog)
273 . if exists(${OPTIONS_FILE}) && !make(rmconfig)
274 . include "${OPTIONS_FILE}"
276 . sinclude "${OPTIONS_FILE}.local"
278 ### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile
279 # XXX once WITH_DEBUG is not magic any more, do remove the :NDEBUG from here.
280 .for opt in ${ALL_OPTIONS:NDEBUG}
281 .if defined(WITH_${opt})
282 OPTIONS_WARNINGS+= "WITH_${opt}"
283 OPTIONS_WARNINGS_SET+= ${opt}
284 PORT_OPTIONS+= ${opt}
286 .if defined(WITHOUT_${opt})
287 OPTIONS_WARNINGS+= "WITHOUT_${opt}"
288 OPTIONS_WARNINGS_UNSET+= ${opt}
289 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
293 .if defined(OPTIONS_WARNINGS)
294 WARNING+= "You are using the following deprecated options: ${OPTIONS_WARNINGS}"
295 WARNING+= "If you added them on the command line, you should replace them by"
296 WARNING+= "WITH=\"${OPTIONS_WARNINGS_SET}\" WITHOUT=\"${OPTIONS_WARNINGS_UNSET}\""
298 WARNING+= "If they are global options set in your make.conf, you should replace them with:"
299 .if defined(OPTIONS_WARNINGS_SET)
300 WARNING+= "OPTIONS_SET=${OPTIONS_WARNINGS_SET}"
302 .if defined(OPTIONS_WARNINGS_UNSET)
303 WARNING+= "OPTIONS_UNSET=${OPTIONS_WARNINGS_UNSET}"
306 WARNING+= "If they are local to this port, you should use:"
307 .if defined(OPTIONS_WARNINGS_SET)
308 WARNING+= "${OPTIONS_NAME}_SET=${OPTIONS_WARNINGS_SET}"
310 .if defined(OPTIONS_WARNINGS_UNSET)
311 WARNING+= "${OPTIONS_NAME}_UNSET=${OPTIONS_WARNINGS_UNSET}"
315 ## Finish by using the options set by the port config dialog, if any
316 . for opt in ${OPTIONS_FILE_SET}
317 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
318 PORT_OPTIONS+= ${opt}
319 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
323 .for opt in ${OPTIONS_FILE_UNSET}
324 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
325 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
331 ## Set system-wide defined options (set by user in make.conf)
332 . for opt in ${OPTIONS_SET_FORCE}
333 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
334 PORT_OPTIONS+= ${opt}
335 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
339 ## Remove the options excluded system-wide (set by user in make.conf)
340 . for opt in ${OPTIONS_UNSET_FORCE}
341 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
342 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
345 # XXX To remove once UNIQUENAME will be removed
346 ## Set the options specified per-port (set by user in make.conf)
347 . for opt in ${${UNIQUENAME}_SET_FORCE}
348 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
349 PORT_OPTIONS+= ${opt}
350 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
354 ## Unset the options excluded per-port (set by user in make.conf)
355 . for opt in ${${UNIQUENAME}_UNSET_FORCE}
356 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
357 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
359 # XXX To remove once UNIQUENAME will be removed
361 ## Set the options specified per-port (set by user in make.conf)
362 . for opt in ${${OPTIONS_NAME}_SET_FORCE}
363 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
364 PORT_OPTIONS+= ${opt}
365 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
369 ## Unset the options excluded per-port (set by user in make.conf)
370 . for opt in ${${OPTIONS_NAME}_UNSET_FORCE}
371 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
372 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
376 ## Cmdline always win over the rest
378 . if !empty(COMPLETE_OPTIONS_LIST:M${opt})
379 PORT_OPTIONS+= ${opt}
380 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
384 .for opt in ${WITHOUT}
385 PORT_OPTIONS:= ${PORT_OPTIONS:N${opt}}
386 NEW_OPTIONS:= ${NEW_OPTIONS:N${opt}}
389 # Finally, add options required by slave ports
390 PORT_OPTIONS+= ${OPTIONS_SLAVE}
392 # Sort options and eliminate duplicates
393 PORT_OPTIONS:= ${PORT_OPTIONS:O:u}
395 ## Now some compatibility
396 .if empty(PORT_OPTIONS:MDOCS)
400 .if empty(PORT_OPTIONS:MEXAMPLES)
404 .if ${PORT_OPTIONS:MDEBUG}
408 .if defined(NO_OPTIONS_SORT)
409 ALL_OPTIONS= ${OPTIONS_DEFINE}
412 .for opt in ${COMPLETE_OPTIONS_LIST} ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE}
416 . if defined(OPTIONS_SUB)
417 . if ! ${PLIST_SUB:M${opt}=*}
418 . if ${PORT_OPTIONS:M${opt}}
419 PLIST_SUB:= ${PLIST_SUB} ${opt}="" NO_${opt}="@comment "
421 PLIST_SUB:= ${PLIST_SUB} ${opt}="@comment " NO_${opt}=""
424 . if ! ${SUB_LIST:M${opt}=*}
425 . if ${PORT_OPTIONS:M${opt}}
426 SUB_LIST:= ${SUB_LIST} ${opt}="" NO_${opt}="@comment "
428 SUB_LIST:= ${SUB_LIST} ${opt}="@comment " NO_${opt}=""
433 . if ${PORT_OPTIONS:M${opt}}
434 . if defined(${opt}_USE)
435 . for option in ${${opt}_USE}
436 _u= ${option:C/=.*//g}
437 USE_${_u:tu}+= ${option:C/.*=//g:C/,/ /g}
440 . if defined(${opt}_CONFIGURE_ENABLE)
441 . for iopt in ${${opt}_CONFIGURE_ENABLE}
442 CONFIGURE_ARGS+= --enable-${iopt}
445 . if defined(${opt}_CONFIGURE_WITH)
446 . for iopt in ${${opt}_CONFIGURE_WITH}
447 CONFIGURE_ARGS+= --with-${iopt}
450 . for configure in CONFIGURE CMAKE QMAKE
451 . if defined(${opt}_${configure}_ON)
452 ${configure}_ARGS+= ${${opt}_${configure}_ON}
455 . for flags in ${_OPTIONS_FLAGS}
456 . if defined(${opt}_${flags})
457 ${flags}+= ${${opt}_${flags}}
460 . for deptype in ${_OPTIONS_DEPENDS}
461 . if defined(${opt}_${deptype}_DEPENDS)
462 ${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS}
466 . if defined(${opt}_CONFIGURE_ENABLE)
467 . for iopt in ${${opt}_CONFIGURE_ENABLE}
468 CONFIGURE_ARGS+= --disable-${iopt}
471 . if defined(${opt}_CONFIGURE_WITH)
472 . for iopt in ${${opt}_CONFIGURE_WITH}
473 CONFIGURE_ARGS+= --without-${iopt}
476 . for configure in CONFIGURE CMAKE QMAKE
477 . if defined(${opt}_${configure}_OFF)
478 ${configure}_ARGS+= ${${opt}_${configure}_OFF}
481 . for flags in ${_OPTIONS_FLAGS}
482 . if defined(${opt}_${flags}_OFF)
483 ${flags}+= ${${opt}_${flags}_OFF}
486 . for deptype in ${_OPTIONS_DEPENDS}
487 . if defined(${opt}_${deptype}_DEPENDS_OFF)
488 ${deptype}_DEPENDS+= ${${opt}_${deptype}_DEPENDS_OFF}