Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Document options helpers |
---|---|
Downloads: | Tarball | ZIP archive | SQL archive |
Timelines: | family | ancestors | descendants | both | trunk |
Files: | files | file ages | folders |
SHA1: |
d11b73831a323ffe0ffbdb2520290e13 |
User & Date: | bapt 2013-07-29 16:39:23 |
Context
2013-07-29
| ||
16:46 | Document new libdepends way check-in: c60d5d2fe2 user: bapt tags: trunk | |
16:39 | Document options helpers check-in: d11b73831a user: bapt tags: trunk | |
15:41 | USE_DISPLAY is now USES=display check-in: 89dd423fcb user: bapt tags: trunk | |
Changes
Added options-helpers.patch.
1 +Index: book.xml 2 +=================================================================== 3 +diff --git a/head/en_US.ISO8859-1/books/porters-handbook/book.xml b/head/en_US.ISO8859-1/books/porters-handbook/book.xml 4 +--- a/head/en_US.ISO8859-1/books/porters-handbook/book.xml (revision 42469) 5 ++++ b/head/en_US.ISO8859-1/books/porters-handbook/book.xml (working copy) 6 +@@ -4645,6 +4645,246 @@ 7 + .if ${VARIABLE:MVALUE}</programlisting> 8 + </note> 9 + </sect2> 10 ++ <sect2> 11 ++ <title>Options helpers</title> 12 ++ 13 ++ <para>A couple of helpers exists to simplify handling actions 14 ++ based on the value of an option.</para> 15 ++ 16 ++ <para>If <makevar>OPTIONS_SUB</makevar> is set to 17 ++ <literal>yes</literal> then all <makevar>PLIST_SUB<makevar> 18 ++ will be populated automatically for each options defined in 19 ++ <makevar>OPTIONS_DEFINE</makevar>, for example:</para> 20 ++ 21 ++ <programlisting>OPTIONS_DEFINE= OPT1 22 ++OPTIONS_SUB= yes</programlisting> 23 ++ 24 ++ <para> is equivalent of:</para> 25 ++ 26 ++ <programlisting>OPTIONS_DEFINE= OPT1 27 ++ 28 ++.include &ls;bsd.port.options.mk> 29 ++ 30 ++.if ${PORT_OPTIONS:MOPT1} 31 ++PLIST_SUB+= OPT1="" 32 ++.else 33 ++PLIST_SUB+= OPT1="@comment " 34 ++.endif</programlisting> 35 ++ 36 ++ <para>If <makevar>X_CONFIGURE_ENABLE</makevar> is set then it 37 ++ will add <literal>--enable-${X_CONFIGURE_ENABLE}</literal> 38 ++ or <literal>--disable-${X_CONFIGURE_ENABLE}</literal> to 39 ++ <makevar>CONFIGURE_ARGS</makevar depending the value of the 40 ++ option<makevar>X</makevar>, for example:</para> 41 ++ 42 ++ <programlisting>OPTIONS_DEFINE= OPT1 43 ++OPT1_CONFIGURE_ENABLE= test</programlisting> 44 ++ 45 ++ <para>is equivalent of:</para> 46 ++ 47 ++ <programlisting>OPTIONS_DEFINE= OPT1 48 ++ 49 ++.include &ls;bsd.port.options.mk> 50 ++ 51 ++.if ${PORT_OPTIONS:MOPT1} 52 ++CONFIGURE_ARGS+= --enable-test 53 ++.else 54 ++CONFIGURE_ARGS+= --disable-test 55 ++.endif</programlisting> 56 ++ 57 ++ <para>If <makevar>X_CONFIGURE_WITH</makevar> is set then it 58 ++ will add <literal>--with-${X_CONFIGURE_WITH}</literal> 59 ++ or <literal>--without-${X_CONFIGURE_WITH}</literal> to 60 ++ <makevar>CONFIGURE_ARGS</makevar depending the value of the 61 ++ option<makevar>X</makevar>, for example:</para> 62 ++ 63 ++ <programlisting>OPTIONS_DEFINE= OPT1 64 ++OPT1_CONFIGURE_WITH= test</programlisting> 65 ++ 66 ++ <para>is equivalent of:</para> 67 ++ 68 ++ <programlisting>OPTIONS_DEFINE= OPT1 69 ++ 70 ++.include &ls;bsd.port.options.mk> 71 ++ 72 ++.if ${PORT_OPTIONS:MOPT1} 73 ++CONFIGURE_ARGS+= --with-test 74 ++.else 75 ++CONFIGURE_ARGS+= --without-test 76 ++.endif</programlisting> 77 ++ 78 ++ <para>If <makevar>X_CONFIGURE_ON<makevar> is then its value 79 ++ will be appended to <makevar>CONFIGURE_ARGS</makevar> if 80 ++ the options <makevar>X</makevar> is activated, for example: 81 ++ </para> 82 ++ 83 ++ <programlisting>OPTIONS_DEFINE= OPT1 84 ++OPT1_CONFIGURE_ON= --add-test</programlisting> 85 ++ 86 ++ <para>is equivalent of</para> 87 ++ 88 ++ <programlisting>OPTIONS_DEFINE= OPT1 89 ++ 90 ++.include &ls;bsd.port.options.mk> 91 ++ 92 ++.if ${PORT_OPTIONS:MOPT1} 93 ++CONFIGURE_ARGS+= --add-test 94 ++.endif</programlisting> 95 ++ 96 ++ <para>If <makevar>X_CONFIGURE_OFF<makevar> is then its value 97 ++ will be appended to <makevar>CONFIGURE_ARGS</makevar> if 98 ++ the options <makevar>X</makevar> is deactivated, for example: 99 ++ </para> 100 ++ 101 ++ <programlisting>OPTIONS_DEFINE= OPT1 102 ++OPT1_CONFIGURE_OFF= --no-test</programlisting> 103 ++ 104 ++ <para>is equivalent of</para> 105 ++ 106 ++ <programlisting>OPTIONS_DEFINE= OPT1 107 ++.include &ls;bsd.port.options.mk> 108 ++.if ! ${PORT_OPTIONS:MOPT1} 109 ++CONFIGURE_ARGS+= --no-test 110 ++.endif</programlisting> 111 ++ 112 ++ <para>If <makevar>X_CMAKE_ON<makevar> is then its value 113 ++ will be appended to <makevar>CMAKE_ARGS</makevar> if 114 ++ the options <makevar>X</makevar> is activated, for example: 115 ++ </para> 116 ++ 117 ++ <programlisting>OPTIONS_DEFINE= OPT1 118 ++OPT1_CMAKE_ON= -DTEST:BOOL=true</programlisting> 119 ++ 120 ++ <para>is equivalent of</para> 121 ++ 122 ++ <programlisting>OPTIONS_DEFINE= OPT1 123 ++ 124 ++.include &ls;bsd.port.options.mk> 125 ++ 126 ++.if ${PORT_OPTIONS:MOPT1} 127 ++CMAKE_ARGS+= -DTEST:BOOL=true 128 ++.endif</programlisting> 129 ++ 130 ++ <para>If <makevar>X_CMAKE_OFF<makevar> is then its value 131 ++ will be appended to <makevar>CMAKE_ARGS</makevar> if 132 ++ the options <makevar>X</makevar> is deactivated, for example: 133 ++ </para> 134 ++ 135 ++ <programlisting>OPTIONS_DEFINE= OPT1 136 ++OPT1_CMAKE_OFF= -DTEST:BOOL=false</programlisting> 137 ++ 138 ++ <para>is equivalent of</para> 139 ++ 140 ++ <programlisting>OPTIONS_DEFINE= OPT1 141 ++ 142 ++.include &ls;bsd.port.options.mk> 143 ++ 144 ++.if ! ${PORT_OPTIONS:MOPT1} 145 ++CMAKE_ARGS+= -DTEST:BOOL=false 146 ++.endif<programlisting> 147 ++ 148 ++ <para>For any of the following variables:</para> 149 ++ 150 ++ <itemizedlist> 151 ++ <listitem> 152 ++ <para><makevar>CFLAGS</makevar>.</para> 153 ++ </listitem> 154 ++ 155 ++ <listitem> 156 ++ <para><makevar>CXXFLAGS</makevar>.</para> 157 ++ </listitem> 158 ++ 159 ++ <listitem> 160 ++ <para><makevar>LDLAGS</makevar>.</para> 161 ++ </listitem> 162 ++ 163 ++ <listitem> 164 ++ <para><makevar>CONFIGURE_ENV</makevar>.</para> 165 ++ </listitem> 166 ++ 167 ++ <listitem> 168 ++ <para><makevar>MAKE_ENV</makevar>.</para> 169 ++ </listitem> 170 ++ 171 ++ <listitem> 172 ++ <para><makevar>USES</makevar>.</para> 173 ++ </listitem> 174 ++ 175 ++ <listitem> 176 ++ <para><makevar>DISTFILES</makevar>.</para> 177 ++ </listitem> 178 ++ </itemizedlist> 179 ++ 180 ++ <para>If <makevar>X_ABOVEVARIABLE</makevar> is defined then 181 ++ its value will be appended to 182 ++ <makevar>ABOVEVARIABLE</makevar> if <makevar>X</makevar> 183 ++ is activated, for example:</para> 184 ++ 185 ++ <programlisting>OPTIONS_DEFINE= OPT1 186 ++OPT1_USES= gmake 187 ++OPT1_CFLAGS= -DTEST</programlisting> 188 ++ 189 ++ <para>is equivalent of:</para> 190 ++ 191 ++ <programlisting>OPTIONS_DEFINE= OPT1 192 ++ 193 ++.include &ls;bsd.port.options.mk> 194 ++ 195 ++.if ${PORT_OPTIONS:MOPT1} 196 ++USES+= gmake 197 ++CFLAGS+= -DTEST 198 ++.endif</programlisting> 199 ++ 200 ++ <para>For any of the following dependency type:</para> 201 ++ 202 ++ <itemizedlist> 203 ++ <listitem> 204 ++ <para><makevar>PKG_DEPENDS</makevar>.</para> 205 ++ </listitem> 206 ++ 207 ++ <listitem> 208 ++ <para><makevar>EXTRACT_DEPENDS</makevar>.</para> 209 ++ </listitem> 210 ++ 211 ++ <listitem> 212 ++ <para><makevar>PATCH_DEPENDS</makevar>.</para> 213 ++ </listitem> 214 ++ 215 ++ <listitem> 216 ++ <para><makevar>FETCH_DEPENDS</makevar>.</para> 217 ++ </listitem> 218 ++ 219 ++ <listitem> 220 ++ <para><makevar>BUILD_DEPENDS</makevar>.</para> 221 ++ </listitem> 222 ++ 223 ++ <listitem> 224 ++ <para><makevar>LIB_DEPENDS</makevar>.</para> 225 ++ </listitem> 226 ++ 227 ++ <listitem> 228 ++ <para><makevar>RUN_DEPENDS</makevar>.</para> 229 ++ </listitem> 230 ++ </itemizedlist> 231 ++ 232 ++ <para>If <makevar>X_ABOVEVARIABLE</makevar> is defined then 233 ++ its value will be appended to 234 ++ <makevar>ABOVEVARIABLE</makevar> if <makevar>X</makevar> 235 ++ is activated, for example:</para> 236 ++ 237 ++ <programlisting>OPTIONS_DEFINE= OPT1 238 ++OPT1_LIB_DEPENDS= liba.so:${PORTSDIR}/devel/a</programlisting> 239 ++ 240 ++ <para>is equivalent of:</para> 241 ++ 242 ++ <programlisting>OPTIONS_DEFINE= OPT1 243 ++ 244 ++.include &ls;bsd.port.options.mk> 245 ++ 246 ++.if ${PORT_OPTIONS:MOPT1} 247 ++LIB_DEPENDS+= liba.so:${PORTSDIR}/devel/a 248 ++.endif</programlisting> 249 ++ </sect2> 250 + </sect1> 251 + 252 + <sect1 id="makefile-wrkdir">