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