Check-in [0d4fcd986f]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:In handbook
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 0d4fcd986fc317070f81fb5a2b67378dd4329fb1
User & Date: bapt 2013-09-11 12:07:56
Context
2013-09-11
12:08
In handbook check-in: 45ac052635 user: bapt tags: trunk
12:07
In handbook check-in: 0d4fcd986f user: bapt tags: trunk
12:07
In handbook check-in: 36114972c0 user: bapt tags: trunk
Changes

Deleted options-helpers.patch.

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
Index: book.xml
===================================================================
diff --git a/head/en_US.ISO8859-1/books/porters-handbook/book.xml b/head/en_US.ISO8859-1/books/porters-handbook/book.xml
--- a/head/en_US.ISO8859-1/books/porters-handbook/book.xml	(revision 42470)
+++ b/head/en_US.ISO8859-1/books/porters-handbook/book.xml	(working copy)
@@ -4629,6 +4629,247 @@
 .if ${VARIABLE:MVALUE}</programlisting>
 	</note>
       </sect2>
+      <sect2>
+	<title>Options helpers</title>
+
+	<para>There are some macros to help simplify conditional
+	  values which differ based on the options set.</para>
+
+	<para>If <makevar>OPTIONS_SUB</makevar> is set to
+	  <literal>yes</literal> then each of the options added 
+	  to <makevar>OPTIONS_DEFINE</makevar> will be added to 
+	  <makevar>PLIST_SUB<makevar>.  For example,</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPTIONS_SUB=	yes</programlisting>
+
+	<para> is equivalent to:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+
+.include &ls;bsd.port.options.mk&gt;
+
+.if ${PORT_OPTIONS:MOPT1}
+PLIST_SUB+=	OPT1=""
+.else
+PLIST_SUB+=	OPT1="@comment "
+.endif</programlisting>
+
+	<para>If <makevar>X_CONFIGURE_ENABLE</makevar> is set then
+	  <literal>--enable-${X_CONFIGURE_ENABLE}</literal>
+	  or <literal>--disable-${X_CONFIGURE_ENABLE}</literal> will
+	  be added to <makevar>CONFIGURE_ARGS</makevar> depending on
+	  the value of the option<makevar>X</makevar>, for example:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPT1_CONFIGURE_ENABLE=	test</programlisting>
+
+	<para>is equivalent to:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+
+.include &ls;bsd.port.options.mk&gt;
+
+.if ${PORT_OPTIONS:MOPT1}
+CONFIGURE_ARGS+=	--enable-test
+.else
+CONFIGURE_ARGS+=	--disable-test
+.endif</programlisting>
+
+	<para>If <makevar>X_CONFIGURE_WITH</makevar> is set then
+	  <literal>--with-${X_CONFIGURE_WITH}</literal>
+	  or <literal>--without-${X_CONFIGURE_WITH}</literal> will
+	  be added to <makevar>CONFIGURE_ARGS</makevar> depending 
+	  on the status of the option <makevar>X</makevar>,
+	  for example:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPT1_CONFIGURE_WITH=	test</programlisting>
+
+	<para>is equivalent to:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+
+.include &ls;bsd.port.options.mk&gt;
+
+.if ${PORT_OPTIONS:MOPT1}
+CONFIGURE_ARGS+=	--with-test
+.else
+CONFIGURE_ARGS+=	--without-test
+.endif</programlisting>
+
+	<para>If <makevar>X_CONFIGURE_ON</makevar> is set then its value
+	  will be appended to <makevar>CONFIGURE_ARGS</makevar> depending
+	  on the status of the option <makevar>X</makevar>, for example:
+	</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPT1_CONFIGURE_ON=	--add-test</programlisting>
+
+	<para>is equivalent to</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+
+.include &ls;bsd.port.options.mk&gt;
+
+.if ${PORT_OPTIONS:MOPT1}
+CONFIGURE_ARGS+=	--add-test
+.endif</programlisting>
+
+	<para>If <makevar>X_CONFIGURE_OFF</makevar> is set then its value
+	  will be appended to <makevar>CONFIGURE_ARGS</makevar> depending
+	  on the status of the option <makevar>X</makevar>, for example:
+	</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPT1_CONFIGURE_OFF=	--no-test</programlisting>
+
+	<para>is equivalent to</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+.include &ls;bsd.port.options.mk&gt;
+.if ! ${PORT_OPTIONS:MOPT1}
+CONFIGURE_ARGS+=	--no-test
+.endif</programlisting>
+
+	<para>If <makevar>X_CMAKE_ON</makevar> is set then its value
+	  will be appended to <makevar>CMAKE_ARGS</makevar> depending
+	  on the status of the option <makevar>X</makevar>, for example:
+	</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPT1_CMAKE_ON=	-DTEST:BOOL=true</programlisting>
+
+	<para>is equivalent to</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+
+.include &ls;bsd.port.options.mk&gt;
+
+.if ${PORT_OPTIONS:MOPT1}
+CMAKE_ARGS+=	-DTEST:BOOL=true
+.endif</programlisting>
+
+	<para>If <makevar>X_CMAKE_OFF</makevar> is set then its value
+	  will be appended to <makevar>CMAKE_ARGS</makevar> depending
+	  on the staus of the option <makevar>X</makevar>, for example:
+	</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPT1_CMAKE_OFF=	-DTEST:BOOL=false</programlisting>
+
+	<para>is equivalent to</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+
+.include &ls;bsd.port.options.mk&gt;
+
+.if ! ${PORT_OPTIONS:MOPT1}
+CMAKE_ARGS+=	-DTEST:BOOL=false
+.endif<programlisting>
+
+	<para>For any of the following variables:</para>
+
+	<itemizedlist>
+	    <listitem>
+	      <para><makevar>CFLAGS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>CXXFLAGS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>LDLAGS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>CONFIGURE_ENV</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>MAKE_ENV</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>USES</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>DISTFILES</makevar>.</para>
+	    </listitem>
+	</itemizedlist>
+
+	<para>If <makevar>X_ABOVEVARIABLE</makevar> is defined then
+	  its value will be appended to
+	  <makevar>ABOVEVARIABLE</makevar> depending on the status of
+	  the option <makevar>X</makevar>, for example:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPT1_USES=	gmake
+OPT1_CFLAGS=	-DTEST</programlisting>
+
+	<para>is equivalent to:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+
+.include &ls;bsd.port.options.mk&gt;
+
+.if ${PORT_OPTIONS:MOPT1}
+USES+=		gmake
+CFLAGS+=	-DTEST
+.endif</programlisting>
+
+	<para>For any of the following dependency type:</para>
+
+	<itemizedlist>
+	    <listitem>
+	      <para><makevar>PKG_DEPENDS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>EXTRACT_DEPENDS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>PATCH_DEPENDS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>FETCH_DEPENDS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>BUILD_DEPENDS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>LIB_DEPENDS</makevar>.</para>
+	    </listitem>
+
+	    <listitem>
+	      <para><makevar>RUN_DEPENDS</makevar>.</para>
+	    </listitem>
+	</itemizedlist>
+
+	<para>If <makevar>X_ABOVEVARIABLE</makevar> is defined then
+	  its value will be appended to
+	  <makevar>ABOVEVARIABLE</makevar> depending on the status
+	  of the option  <makevar>X</makevar>, for example:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+OPT1_LIB_DEPENDS=	liba.so:${PORTSDIR}/devel/a</programlisting>
+
+	<para>is equivalent to:</para>
+
+	<programlisting>OPTIONS_DEFINE=	OPT1
+
+.include &ls;bsd.port.options.mk&gt;
+
+.if ${PORT_OPTIONS:MOPT1}
+LIB_DEPENDS+=	liba.so:${PORTSDIR}/devel/a
+.endif</programlisting>
+      </sect2>
     </sect1>
 
     <sect1 id="makefile-wrkdir">
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<