aboutsummaryrefslogtreecommitdiffstats
path: root/Mk/bsd.options.mk
blob: 9e11c8f27a33ebad1aa85abe196f636999b69af8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
#-*- tab-width: 4; -*-
# $FreeBSD$
# Global options
#
# OPTIONS_DEFINE        - List of options this ports accept
# OPTIONS_DEFINE_${ARCH}    - List of options this ports accept and are
#               specific to ${ARCH}
# OPTIONS_DEFAULT       - List of options activated by default
# OPTIONS_DEFAULT_${ARCH}   - List of options activated by default for a
#               given arch
#
# OPTIONS_EXCLUDE       - List of options unsupported (useful for slave ports)
# OPTIONS_EXCLUDE_${ARCH}   - List of options unsupported on a given ${ARCH}
# ${OPTION}_DESC        - Description the the ${OPTION}
#
# OPTIONS_SINGLE        - List of single-choice grouped options: 1 and
#                 only 1 among N
# OPTIONS_RADIO         - List of radio-choice grouped options: 0 or 1
#                 among N
# OPTIONS_MULTI         - List of multiple-choice grouped options: at
#                 least 1 among N
# OPTIONS_GROUP         - List of group-choice grouped options: 0 or
#                 more among N
#
# OPTIONS_SINGLE_${NAME}    - List of OPTIONS grouped as single choice (for
#               the single named as ${NAME} as defined in
#               OPTIONS_SINGLE)
# OPTIONS_RADIO_${NAME}     - List of OPTIONS grouped as radio choice (for
#               the radio named as ${NAME} as defined in
#               OPTIONS_RADIO)
# OPTIONS_MULTI_${NAME}     - List of OPTIONS grouped as multiple-choice
#               (for the multi named as ${NAME} as defined in
#               OPTIONS_MULTI)
# OPTIONS_GROUP_${NAME}     - List of OPTIONS grouped as group-choice (for
#               the group named as ${NAME} as defined in
#               OPTIONS_GROUP)
#
# WITH              Set options from the command line
# WITHOUT           Unset options from the command line
#
# OPTIONS_SLAVE         This is designed for slave ports, it removes an option
#               from the options list inherited from the master port
#               and it always adds it to PORT_OPTIONS meaning activated

##
# Set all the options available for the ports, beginning with the
# global ones and ending with the ones decided by the maintainer.

.if !defined(OPTIONSMKINCLUDED)
OPTIONSMKINCLUDED=  bsd.options.mk

OPTIONSFILE?=   ${PORT_DBDIR}/${UNIQUENAME}/options

# Set the default values for the global options, as defined by portmgr
.if !defined(NOPORTDOCS)
PORT_OPTIONS+=  DOCS
.endif

.if !defined(WITHOUT_NLS)
PORT_OPTIONS+=  NLS
.endif

.if !defined(NOPORTEXAMPLES)
PORT_OPTIONS+=  EXAMPLES
.endif

PORT_OPTIONS+=  IPV6

# Add per arch options
.for opt in ${OPTIONS_DEFINE_${ARCH}}
.if empty(OPTIONS_DEFINE:M${opt})
OPTIONS_DEFINE+=    ${opt}
.endif
.endfor

# Add per arch defaults
OPTIONS_DEFAULT+=   ${OPTIONS_DEFAULT_${ARCH}}

# Remove options the port maintainer doesn't want
.for opt in ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE} ${OPTIONS_SLAVE}
OPTIONS_DEFAULT:=   ${OPTIONS_DEFAULT:N${opt}}
OPTIONS_DEFINE:=    ${OPTIONS_DEFINE:N${opt}}
PORT_OPTIONS:=      ${PORT_OPTIONS:N${opt}}
.  for otype in SINGLE RADIO MULTI GROUP
.    for m in ${OPTIONS_${otype}}
OPTIONS_${otype}_${m}:= ${OPTIONS_${otype}_${m}:N${opt}}
.    endfor
.  endfor
.endfor

# Remove empty SINGLE/GROUP/RADIO/MULTI
# Can be empty because of exclude/slaves
.for otype in SINGLE RADIO MULTI GROUP
.  for m in ${OPTIONS_${otype}}
.    if empty(OPTIONS_${otype}_${m})
OPTIONS_${otype}:=  ${OPTIONS_${otype}:N${m}}
.    endif
.  endfor
.endfor

# Sort options
ALL_OPTIONS:=   ${OPTIONS_DEFINE:O:u}
OPTIONS_DEFAULT:=   ${OPTIONS_DEFAULT:O:u}

# complete list
COMPLETE_OPTIONS_LIST=  ${ALL_OPTIONS}
.for otype in SINGLE RADIO MULTI GROUP
.  for m in ${OPTIONS_${otype}}
COMPLETE_OPTIONS_LIST+= ${OPTIONS_${otype}_${m}}
.  endfor
.endfor

## Now create the list of activated options
.if defined(OPTIONS_OVERRIDE)
# Special case $OPTIONS_OVERRIDE; if it is defined forget about anything done
# before
NEW_OPTIONS=
PORT_OPTIONS:=  ${OPTIONS_OVERRIDE}
.else
NEW_OPTIONS=    ${COMPLETE_OPTIONS_LIST}

## Set default options defined by the port maintainer
PORT_OPTIONS+=  ${OPTIONS_DEFAULT}

## Set system-wide defined options (set by user in make.conf)
.  for opt in ${OPTIONS_SET}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

## Remove the options excluded system-wide (set by user in make.conf)
.  for opt in ${OPTIONS_UNSET}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endfor

## Set the options specified per-port (set by user in make.conf)
.  for opt in ${${UNIQUENAME}_SET}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

## Unset the options excluded per-port (set by user in make.conf)
.  for opt in ${${UNIQUENAME}_UNSET}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endfor

## options files (from dialog)
.  if exists(${OPTIONSFILE}) && !make(rmconfig)
.  include "${OPTIONSFILE}"
.  endif
.  if exists(${OPTIONSFILE}.local)
.  include "${OPTIONSFILE}.local"
.  endif

### convert WITH and WITHOUT found in make.conf or reloaded from old optionsfile
.for opt in ${ALL_OPTIONS}
.if defined(WITH_${opt})
PORT_OPTIONS+=  ${opt}
.endif
.if defined(WITHOUT_${opt})
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
.endif
.endfor

## Finish by using the options set by the port config dialog, if any
.  for opt in ${OPTIONS_FILE_SET}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

.for opt in ${OPTIONS_FILE_UNSET}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.endfor

.endif

## FORCE
## Set system-wide defined options (set by user in make.conf)
.  for opt in ${OPTIONS_SET_FORCE}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

## Remove the options excluded system-wide (set by user in make.conf)
.  for opt in ${OPTIONS_UNSET_FORCE}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endfor

## Set the options specified per-port (set by user in make.conf)
.  for opt in ${${UNIQUENAME}_SET_FORCE}
.    if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.    endif
.  endfor

## Unset the options excluded per-port (set by user in make.conf)
.  for opt in ${${UNIQUENAME}_UNSET_FORCE}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endfor


## Cmdline always win over the rest
.for opt in ${WITH}
.  if !empty(COMPLETE_OPTIONS_LIST:M${opt})
PORT_OPTIONS+=  ${opt}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.  endif
.endfor

.for opt in ${WITHOUT}
PORT_OPTIONS:=  ${PORT_OPTIONS:N${opt}}
NEW_OPTIONS:=   ${NEW_OPTIONS:N${opt}}
.endfor

# Finally, add options required by slave ports
PORT_OPTIONS+=  ${OPTIONS_SLAVE}

# Sort options and eliminate duplicates
PORT_OPTIONS:=  ${PORT_OPTIONS:O:u}

## Now some compatibility
.if empty(PORT_OPTIONS:MDOCS)
NOPORTDOCS= yes
.endif

.if empty(PORT_OPTIONS:MEXAMPLES)
NOPORTEXAMPLES= yes
.endif

.if empty(PORT_OPTIONS:MNLS)
WITHOUT_NLS=    yes
.endif

.if defined(NO_OPTIONS_SORT)
ALL_OPTIONS=    ${OPTIONS_DEFINE}
.endif

### to be removed once old OPTIONS disappear
.for opt in ${ALL_OPTIONS}
.if empty(PORT_OPTIONS:M${opt})
.   if !defined(WITH_${opt}) && !defined(WITHOUT_${opt})
WITHOUT_${opt}:=    true
.   endif
.else
.   if !defined(WITH_${opt}) && !defined(WITHOUT_${opt})
WITH_${opt}:=  true
.   endif
.endif
.endfor
.endif
###