--- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -147,6 +147,15 @@ # MASTER_SITE_FREEBSD # - If set, prepend ${MASTER_SITE_BACKUP} in MASTER_SITES. # +# 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. @@ -1338,6 +1347,7 @@ FILESDIR?= ${MASTERDIR}/files SCRIPTDIR?= ${MASTERDIR}/scripts PKGDIR?= ${MASTERDIR} +LOCAL_PATCHDIR?= ${LOCAL_PATCHDIR_PREFIX}/${PATCHDIR} PREFIX?= ${LOCALBASE} @@ -3138,7 +3148,37 @@ dp_UNZIP_NATIVE_CMD="${UNZIP_NATIVE_CMD}" \ dp_XZCAT="${XZCAT}" \ ${SH} ${SCRIPTSDIR}/do-patch.sh +.if defined(LOCAL_PATCHDIR_PREFIX) && !defined(WITHOUT_LOCAL_PATCHDIR) + @if [ -d ${LOCAL_PATCHDIR}/ ]; then \ + cd ${PATCH_WRKSRC}; \ + 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-fixup) run-autotools-fixup: