From 82627333fa87664d7cb1ea6bef3f5ec9189cc934 Mon Sep 17 00:00:00 2001 From: Mathieu Arnold Date: Mon, 4 Sep 2017 12:10:23 +0000 Subject: [PATCH] Add a section about conditional patching with EXTRA_PATCHES. Reviewed by: wblock Sponsored by: Absolight Differential Revision: https://reviews.freebsd.org/D12165 --- .../porters-handbook/slow-porting/chapter.xml | 44 +++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml b/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml index 18927b2aff..9ee340673c 100644 --- a/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml +++ b/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml @@ -450,6 +450,50 @@ DOS2UNIX_GLOB= *.c *.cpp *.h USES= dos2unix DOS2UNIX_WRKSRC= ${WRKDIR} + + + Patching Conditionally + + 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 + EXTRA_PATCHES. + + + Applying a Patch for a Specific &os; Version + + .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> + + + + + Optionaly Applying a Patch + + When an option + requires a patch, use + opt_EXTRA_PATCHES + and + opt_EXTRA_PATCHES_OFF + to make the patch conditional on the + opt option. + See for more + information. + + 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 + + +