Index: Mk/Scripts/smart_makepatch.sh =================================================================== --- Mk/Scripts/smart_makepatch.sh +++ Mk/Scripts/smart_makepatch.sh @@ -22,8 +22,7 @@ # # Reminder # Don't forget to disable post-patch targets before regenerating patches -# if those targets modify source files (e.g. with sed). You may also -# want to disable EXTRA_PATCHES as well if that is being used. +# if those targets modify source files (e.g. with sed). [ -n "${DEBUG_MK_SCRIPTS}" -o -n "${DEBUG_MK_SCRIPTS_SMART_MAKEPATCH}" ] && set -x @@ -71,6 +70,11 @@ (cd ${PATCHDIR} && \ find * -type f -name "patch-*" -maxdepth 0 \ 2>/dev/null | sed -e '/\.orig$/d' + for i in ${EXTRA_PATCHES}; do + if [ -f ${i##*/} ]; then + echo ${i##*/} + fi + done ) fi; } @@ -115,7 +119,16 @@ break; fi std_target=$(std_patch_filename ${t}) - future_name=$(valid_name ${P} ${t} ${std_target}) + # If the file is not named `patch-*` it is an extra + # patch, so use the current name, even if it is a + # single patch. + # Otherwise, it is a normal patch, use the canonical + # name. + if [ "${P#patch-}" = "${P}" ]; then + future_name=${P} + else + future_name=$(valid_name ${P} ${t} ${std_target}) + fi done for t in ${target}; do std_target=$(std_patch_filename ${t}) Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -1101,6 +1101,7 @@ makepatch: @${SETENV} WRKDIR=${WRKDIR} PATCHDIR=${PATCHDIR} \ PATCH_WRKSRC=${PATCH_WRKSRC} \ + EXTRA_PATCHES="${EXTRA_PATCHES}" \ STRIP_COMPONENTS="${PATCH_STRIP:S/-p//}" \ ${SH} ${SCRIPTSDIR}/smart_makepatch.sh .endif