Add a section about conditional patching with EXTRA_PATCHES.

Reviewed by:	wblock
Sponsored by:	Absolight
Differential Revision:	https://reviews.freebsd.org/D12165
This commit is contained in:
Mathieu Arnold 2017-09-04 12:10:23 +00:00
parent b41e80a744
commit 82627333fa
Notes: svn2git 2020-12-08 03:00:23 +00:00
svn path=/head/; revision=50800

View file

@ -450,6 +450,50 @@ DOS2UNIX_GLOB= *.c *.cpp *.h</programlisting>
<programlisting>USES= dos2unix
DOS2UNIX_WRKSRC= ${WRKDIR}</programlisting>
</sect2>
<sect2 xml:id="slow-patch-extra">
<title>Patching Conditionally</title>
<para>Some ports need patches that are only applied for specific
&os; versions or when a particular option is enabled or
disabled. Conditional patches are specified by placing the
full paths to the patch files in
<varname>EXTRA_PATCHES</varname>.</para>
<example xml:id="slow-patch-extra-ex1">
<title>Applying a Patch for a Specific &os; Version</title>
<programlisting>.include &lt;bsd.port.options.mk&gt;
# Patch in the iconv const qualifier before this
.if ${OPSYS} == FreeBSD &amp;&amp; ${OSVERSION} &lt; 1100069
EXTRA_PATCHES= ${PATCHDIR}/extra-patch-fbsd10
.endif
.include &lt;bsd.port.mk&gt;</programlisting>
</example>
<example xml:id="slow-patch-extra-ex2">
<title>Optionaly Applying a Patch</title>
<para>When an <link linkend="makefile-options">option</link>
requires a patch, use
<varname><replaceable>opt</replaceable>_EXTRA_PATCHES</varname>
and
<varname><replaceable>opt</replaceable>_EXTRA_PATCHES_OFF</varname>
to make the patch conditional on the
<literal><replaceable>opt</replaceable></literal> option.
See <xref linkend="options-variables"/> for more
information.</para>
<programlisting>OPTIONS_DEFINE= FOO BAR
FOO_EXTRA_PATCHES= ${PATCHDIR}/extra-patch-foo
BAR_EXTRA_PATCHES_OFF= ${PATCHDIR}/extra-patch-bar.c \
${PATCHDIR}/extra-patch-bar.h</programlisting>
</example>
</sect2>
</sect1>
<sect1 xml:id="slow-configure">