--- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -149,6 +149,15 @@ # This variable supercedes CD_MOUNTPT, which is # obsolete. # +# This variables control local modifications. +# +# LOCAL_PATCHDIR_PREFIX - Root of directory tree similar to ports +# directory tree with local patches (and possibly +# local ports). +# WITHOUT_LOCAL_PATCHDIR - Should never be used in official ports tree. +# Set this variable in local ports to not clash +# local pathes themselves. +# # Set these if your port should not be built under certain circumstances. # These are string variables; you should set them to the reason why # they are necessary. @@ -1366,6 +1375,7 @@ FILESDIR?= ${MASTERDIR}/files SCRIPTDIR?= ${MASTERDIR}/scripts PKGDIR?= ${MASTERDIR} +LOCAL_PATCHDIR?= ${LOCAL_PATCHDIR_PREFIX}/${PATCHDIR} .if defined(USE_IMAKE) && !defined(USE_X_PREFIX) USE_X_PREFIX= yes @@ -3572,6 +3582,35 @@ done; \ fi; \ fi +.if defined(LOCAL_PATCHDIR_PREFIX) && !defined(WITHOUT_LOCAL_PATCHDIR) + @if [ -d ${LOCAL_PATCHDIR}/ ]; then \ + if [ "`echo ${LOCAL_PATCHDIR}/patch-*`" != "${LOCAL_PATCHDIR}/patch-*" ]; then \ + ${ECHO_MSG} "===> Applying LOCAL patches for ${PKGNAME}" ; \ + PATCHES_APPLIED="" ; \ + for i in ${LOCAL_PATCHDIR}/patch-*; do \ + case $$i in \ + *.orig|*.rej|*~|*,v) \ + ${ECHO_MSG} "===> Ignoring patchfile $$i" ; \ + ;; \ + *) \ + if [ ${PATCH_DEBUG_TMP} = yes ]; then \ + ${ECHO_MSG} "===> Applying LOCAL patch $$i" ; \ + fi; \ + if ${PATCH} ${PATCH_ARGS} < $$i ; then \ + PATCHES_APPLIED="$$PATCHES_APPLIED $$i" ; \ + else \ + ${ECHO_MSG} `${ECHO} ">> Patch $$i failed to apply cleanly." | ${SED} "s|${LOCAL_PATCHDIR}/||"` ; \ + if [ x"$$PATCHES_APPLIED" != x"" ]; then \ + ${ECHO_MSG} `${ECHO} ">> Patch(es) $$PATCHES_APPLIED applied cleanly." | ${SED} "s|${LOCAL_PATCHDIR}/||g"` ; \ + fi; \ + ${FALSE} ; \ + fi; \ + ;; \ + esac; \ + done; \ + fi; \ + fi +.endif .endif .if !target(run-autotools)