Index: head/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml =================================================================== --- head/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml +++ head/en_US.ISO8859-1/books/porters-handbook/slow-porting/chapter.xml @@ -450,6 +450,50 @@ 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 + + +