Update www/p5-HTML-Parser-Simple to version 2.02
[dports.git] / Mk / bsd.options.mk
1 # $FreeBSD$
2 #
3 # These variables are used in port makefiles to define the options for a port.
4 #
5 # OPTIONS_DEFINE                - List of options this ports accept
6 # OPTIONS_DEFINE_${ARCH}        - List of options this ports accept and are
7 #                                 specific to ${ARCH}
8 # OPTIONS_DEFAULT               - List of options activated by default
9 # OPTIONS_DEFAULT_${ARCH}       - List of options activated by default for a
10 #                                 given arch
11 #
12 # ${OPTION}_DESC                - Description of the ${OPTION}
13 #
14 # OPTIONS_SINGLE                - List of single-choice grouped options: 1 and
15 #                                 only 1 among N
16 # OPTIONS_RADIO                 - List of radio-choice grouped options: 0 or 1
17 #                                 among N
18 # OPTIONS_MULTI                 - List of multiple-choice grouped options: at
19 #                                 least 1 among N
20 # OPTIONS_GROUP                 - List of group-choice grouped options: 0 or
21 #                                 more among N
22 #
23 # OPTIONS_SINGLE_${NAME}        - List of OPTIONS grouped as single choice (for
24 #                                 the single named as ${NAME} as defined in
25 #                                 OPTIONS_SINGLE)
26 # OPTIONS_RADIO_${NAME}         - List of OPTIONS grouped as radio choice (for
27 #                                 the radio named as ${NAME} as defined in
28 #                                 OPTIONS_RADIO)
29 # OPTIONS_MULTI_${NAME}         - List of OPTIONS grouped as multiple-choice
30 #                                 (for the multi named as ${NAME} as defined in
31 #                                 OPTIONS_MULTI)
32 # OPTIONS_GROUP_${NAME}         - List of OPTIONS grouped as group-choice (for
33 #                                 the group named as ${NAME} as defined in
34 #                                 OPTIONS_GROUP)
35 #
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
41 #                                 meaning activated
42 #
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
50 # "make config".
51 #
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.
56 #
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.
62 #
63 # These variables can be used on the command line. They override the effects of
64 # the make.conf variables above.
65 #
66 # WITH                          - Set options from the command line
67 # WITHOUT                       - Unset options from the command line
68 #
69 #
70 # The following knobs are there to simplify the handling of OPTIONS in simple
71 # cases :
72 #
73 # OPTIONS_SUB                   When defined it will add to PLIST_SUB:
74 #                               Option enabled  ${opt}=""
75 #                               Option disabled ${opt}="@comment "
76 #
77 # ${opt}_CONFIGURE_ON           When option is enabled, it will add its content to
78 #                               the CONFIGURE_ARGS.
79 # ${opt}_CONFIGURE_OFF          When option is disabled, it will add its content to
80 #                               the CONFIGURE_ARGS.
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}
87 #
88 # ${opt}_CMAKE_ON               When option is enabled, it will add its content to
89 #                               the CMAKE_ARGS.
90 # ${opt}_CMAKE_OFF              When option is disabled, it will add its content to
91 #                               the CMAKE_ARGS.
92 #
93 # ${opt}_QMAKE_ON               When option is enabled, it will add its content to
94 #                               the QMAKE_ARGS.
95 # ${opt}_QMAKE_OFF              When option is disabled, it will add its content to
96 #                               the QMAKE_ARGS.
97 #
98 # ${opt}_USE=   FOO=bar         When option is enabled, it will  enable
99 #                               USE_FOO+= bar
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
103 #                               USE_FOO+= bar
104 #
105 # For each of:
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.
113 #
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.
119
120 ##
121 # Set all the options available for the ports, beginning with the
122 # global ones and ending with the ones decided by the maintainer.
123
124 .if !defined(OPTIONSMKINCLUDED)
125 OPTIONSMKINCLUDED=      bsd.options.mk
126
127 OPTIONS_NAME?=  ${PKGORIGIN:S/\//_/}
128 OPTIONSFILE?=   ${PORT_DBDIR}/${UNIQUENAME}/options
129 OPTIONS_FILE?=  ${PORT_DBDIR}/${OPTIONS_NAME}/options
130
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 \
135                 PLIST_SUB USES INFO
136 _OPTIONS_DEPENDS=       PKG FETCH EXTRACT PATCH BUILD LIB RUN
137
138 # Set the default values for the global options, as defined by portmgr
139 .if !defined(NOPORTDOCS)
140 PORT_OPTIONS+=  DOCS
141 .else
142 OPTIONS_WARNINGS+=              "NOPORTDOCS"
143 WITHOUT+=                       DOCS
144 OPTIONS_WARNINGS_UNSET+=        DOCS
145 .endif
146
147 .if !defined(WITHOUT_NLS)
148 PORT_OPTIONS+=  NLS
149 .else
150 WITHOUT+=               NLS
151 .endif
152
153 .if !defined(NOPORTEXAMPLES)
154 PORT_OPTIONS+=  EXAMPLES
155 .else
156 OPTIONS_WARNINGS+=              "NOPORTEXAMPLES"
157 WITHOUT+=                       EXAMPLES
158 OPTIONS_WARNINGS_UNSET+=        EXAMPLES
159 .endif
160
161 PORT_OPTIONS+=  IPV6
162
163 # Add per arch options
164 .for opt in ${OPTIONS_DEFINE_${ARCH}}
165 .if empty(OPTIONS_DEFINE:M${opt})
166 OPTIONS_DEFINE+=        ${opt}
167 .endif
168 .endfor
169
170 # Add per arch defaults
171 OPTIONS_DEFAULT+=       ${OPTIONS_DEFAULT_${ARCH}}
172
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}}
181 .    endfor
182 .  endfor
183 .endfor
184
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}}
191 .    endif
192 .  endfor
193 .endfor
194
195 # Sort options
196 ALL_OPTIONS:=   ${OPTIONS_DEFINE:O:u}
197 OPTIONS_DEFAULT:=       ${OPTIONS_DEFAULT:O:u}
198
199 # complete list
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}}
204 .  endfor
205 .endfor
206
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
210 # before
211 NEW_OPTIONS=
212 PORT_OPTIONS:=  ${OPTIONS_OVERRIDE}
213 .else
214 NEW_OPTIONS=    ${COMPLETE_OPTIONS_LIST}
215
216 ## Set default options defined by the port maintainer
217 PORT_OPTIONS+=  ${OPTIONS_DEFAULT}
218
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}}
224 .    endif
225 .  endfor
226
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}}
231 .  endfor
232
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}}
239 .    endif
240 .  endfor
241
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}}
246 .  endfor
247 # XXX To remove once UNIQUENAME will be removed
248
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}}
254 .    endif
255 .  endfor
256
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}}
261 .  endfor
262
263 # XXX to remove once UNIQUENAME is removed
264 ## options files (from dialog)
265 .  if exists(${OPTIONSFILE}) && !make(rmconfig)
266 .  include "${OPTIONSFILE}"
267 .  endif
268 .  sinclude "${OPTIONSFILE}.local"
269 # XXX to remove once UNIQUENAME is removed
270
271 ## options files (from dialog)
272 .  if exists(${OPTIONS_FILE}) && !make(rmconfig)
273 .  include "${OPTIONS_FILE}"
274 .  endif
275 .  sinclude "${OPTIONS_FILE}.local"
276
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}
284 .endif
285 .if defined(WITHOUT_${opt})
286 OPTIONS_WARNINGS+= "WITHOUT_${opt}"
287 OPTIONS_WARNINGS_UNSET+=        ${opt}
288 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
289 .endif
290 .endfor
291
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}\""
296 WARNING+=       ""
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}"
300 .endif
301 .if defined(OPTIONS_WARNINGS_UNSET)
302 WARNING+=       "OPTIONS_UNSET=${OPTIONS_WARNINGS_UNSET}"
303 .endif
304 WARNING+=       ""
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}"
308 .endif
309 .if defined(OPTIONS_WARNINGS_UNSET)
310 WARNING+=       "${OPTIONS_NAME}_UNSET=${OPTIONS_WARNINGS_UNSET}"
311 .endif
312 .endif
313
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}}
319 .    endif
320 .  endfor
321
322 .for opt in ${OPTIONS_FILE_UNSET}
323 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
324 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
325 .endfor
326
327 .endif
328
329 ## FORCE
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}}
335 .    endif
336 .  endfor
337
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}}
342 .  endfor
343
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}}
350 .    endif
351 .  endfor
352
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}}
357 .  endfor
358 # XXX To remove once UNIQUENAME will be removed
359
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}}
365 .    endif
366 .  endfor
367
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}}
372 .  endfor
373
374
375 ## Cmdline always win over the rest
376 .for opt in ${WITH}
377 .  if !empty(COMPLETE_OPTIONS_LIST:M${opt})
378 PORT_OPTIONS+=  ${opt}
379 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
380 .  endif
381 .endfor
382
383 .for opt in ${WITHOUT}
384 PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
385 NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
386 .endfor
387
388 # Finally, add options required by slave ports
389 PORT_OPTIONS+=  ${OPTIONS_SLAVE}
390
391 # Sort options and eliminate duplicates
392 PORT_OPTIONS:=  ${PORT_OPTIONS:O:u}
393
394 ## Now some compatibility
395 .if empty(PORT_OPTIONS:MDOCS)
396 NOPORTDOCS=     yes
397 .endif
398
399 .if empty(PORT_OPTIONS:MEXAMPLES)
400 NOPORTEXAMPLES= yes
401 .endif
402
403 .if ${PORT_OPTIONS:MDEBUG}
404 WITH_DEBUG=     yes
405 .endif
406
407 .if defined(NO_OPTIONS_SORT)
408 ALL_OPTIONS=    ${OPTIONS_DEFINE}
409 .endif
410
411 .for opt in ${COMPLETE_OPTIONS_LIST} ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE}
412 # PLIST_SUB
413 PLIST_SUB?=
414 SUB_LIST?=
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 "
419 .      else
420 PLIST_SUB:=     ${PLIST_SUB} ${opt}="@comment " NO_${opt}=""
421 .      endif
422 .    endif
423 .    if ! ${SUB_LIST:M${opt}=*}
424 .      if ${PORT_OPTIONS:M${opt}}
425 SUB_LIST:=      ${SUB_LIST} ${opt}="" NO_${opt}="@comment "
426 .      else
427 SUB_LIST:=      ${SUB_LIST} ${opt}="@comment " NO_${opt}=""
428 .      endif
429 .    endif
430 .  endif
431
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}
437 .      endfor
438 .    endif
439 .    if defined(${opt}_CONFIGURE_ENABLE)
440 .      for iopt in ${${opt}_CONFIGURE_ENABLE}
441 CONFIGURE_ARGS+=        --enable-${iopt}
442 .      endfor
443 .    endif
444 .    if defined(${opt}_CONFIGURE_WITH)
445 .      for iopt in ${${opt}_CONFIGURE_WITH}
446 CONFIGURE_ARGS+=        --with-${iopt}
447 .      endfor
448 .    endif
449 .    for configure in CONFIGURE CMAKE QMAKE
450 .      if defined(${opt}_${configure}_ON)
451 ${configure}_ARGS+=     ${${opt}_${configure}_ON}
452 .      endif
453 .    endfor
454 .    for flags in ${_OPTIONS_FLAGS}
455 .      if defined(${opt}_${flags})
456 ${flags}+=      ${${opt}_${flags}}
457 .      endif
458 .    endfor
459 .    for deptype in ${_OPTIONS_DEPENDS}
460 .      if defined(${opt}_${deptype}_DEPENDS)
461 ${deptype}_DEPENDS+=    ${${opt}_${deptype}_DEPENDS}
462 .      endif
463 .    endfor
464 .  else
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}
469 .      endfor
470 .    endif
471 .    if defined(${opt}_CONFIGURE_ENABLE)
472 .      for iopt in ${${opt}_CONFIGURE_ENABLE}
473 CONFIGURE_ARGS+=        --disable-${iopt:C/=.*//}
474 .      endfor
475 .    endif
476 .    if defined(${opt}_CONFIGURE_WITH)
477 .      for iopt in ${${opt}_CONFIGURE_WITH}
478 CONFIGURE_ARGS+=        --without-${iopt:C/=.*//}
479 .      endfor
480 .    endif
481 .    for configure in CONFIGURE CMAKE QMAKE
482 .      if defined(${opt}_${configure}_OFF)
483 ${configure}_ARGS+=     ${${opt}_${configure}_OFF}
484 .      endif
485 .    endfor
486 .    for flags in ${_OPTIONS_FLAGS}
487 .      if defined(${opt}_${flags}_OFF)
488 ${flags}+=      ${${opt}_${flags}_OFF}
489 .      endif
490 .    endfor
491 .    for deptype in ${_OPTIONS_DEPENDS}
492 .      if defined(${opt}_${deptype}_DEPENDS_OFF)
493 ${deptype}_DEPENDS+=    ${${opt}_${deptype}_DEPENDS_OFF}
494 .      endif
495 .    endfor
496 .  endif
497 .endfor
498
499 .endif