diff options
| author | Brad Davis <brd@FreeBSD.org> | 2013-08-02 16:08:38 +0000 |
|---|---|---|
| committer | Brad Davis <brd@FreeBSD.org> | 2013-08-02 16:08:38 +0000 |
| commit | 5f78ff8efe0f4b27a2d13f3cb9eba9ea465c02ab (patch) | |
| tree | ece62e662ea7f78d4b14bdb2cb6ba409ceba8a65 | |
| parent | 989ef6ffafdffffc86b17ccc4691b7b6edc16aa0 (diff) | |
Notes
| -rw-r--r-- | en_US.ISO8859-1/books/porters-handbook/book.xml | 241 |
1 files changed, 241 insertions, 0 deletions
diff --git a/en_US.ISO8859-1/books/porters-handbook/book.xml b/en_US.ISO8859-1/books/porters-handbook/book.xml index 62fd9049f7..417a8ef9ad 100644 --- a/en_US.ISO8859-1/books/porters-handbook/book.xml +++ b/en_US.ISO8859-1/books/porters-handbook/book.xml @@ -4629,6 +4629,247 @@ CONFIGURE_ARGS+= --disable-foo .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 <bsd.port.options.mk> + +.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 <bsd.port.options.mk> + +.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 <bsd.port.options.mk> + +.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 <bsd.port.options.mk> + +.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 <bsd.port.options.mk> +.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 <bsd.port.options.mk> + +.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 status 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 <bsd.port.options.mk> + +.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 <bsd.port.options.mk> + +.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 <bsd.port.options.mk> + +.if ${PORT_OPTIONS:MOPT1} +LIB_DEPENDS+= liba.so:${PORTSDIR}/devel/a +.endif</programlisting> + </sect2> </sect1> <sect1 id="makefile-wrkdir"> |
