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

Mathieu Arnold <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
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 &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">
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.