svn commit: r50800 - head/en_US.ISO8859-1/books/porters-handbook/slow-porting

Mathieu Arnold mat at FreeBSD.org
Mon Sep 4 12:10:25 UTC 2017


Author: mat
Date: Mon Sep  4 12:10:23 2017
New Revision: 50800
URL: https://svnweb.freebsd.org/changeset/doc/50800

Log:
  Add a section about conditional patching with EXTRA_PATCHES.
  
  Reviewed by:	wblock
  Sponsored by:	Absolight
  Differential Revision:	https://reviews.freebsd.org/D12165

Modified:
  head/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml

Modified: head/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml
==============================================================================
--- head/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml	Mon Sep  4 09:29:51 2017	(r50799)
+++ head/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml	Mon Sep  4 12:10:23 2017	(r50800)
@@ -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 <bsd.port.options.mk>
+
+# Patch in the iconv const qualifier before this
+.if ${OPSYS} == FreeBSD && ${OSVERSION} < 1100069
+EXTRA_PATCHES=	${PATCHDIR}/extra-patch-fbsd10
+.endif
+
+.include <bsd.port.mk></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">


More information about the svn-doc-all mailing list