Index: Mk/Uses/autoreconf.mk =================================================================== --- Mk/Uses/autoreconf.mk +++ Mk/Uses/autoreconf.mk @@ -84,5 +84,6 @@ .endif @(cd ${CONFIGURE_WRKSRC} && ${LOCALBASE}/bin/autoreconf -f -i) .endif +_USES_pre_configure+= do-autoreconf .endif Index: Mk/Uses/charsetfix.mk =================================================================== --- Mk/Uses/charsetfix.mk +++ Mk/Uses/charsetfix.mk @@ -22,5 +22,6 @@ -e 's|need_charset_alias=true|need_charset_alias=false|g ; \ s|test -f $$(charset_alias)|false|g ;\ s|test -f $$(DESTDIR)$$(libdir)/charset.alias|false|g' +_USES_post_patch+= charsetfix-post-patch .endif Index: Mk/Uses/cran.mk =================================================================== --- Mk/Uses/cran.mk +++ Mk/Uses/cran.mk @@ -70,11 +70,12 @@ .endif .if ${cran_ARGS:Mauto-plist} -.if !target(post-install-script) -post-install-script: +.if !target(cran-auto-plist) +cran-auto-plist: @${FIND} -ds ${STAGEDIR}${PREFIX}/${R_MOD_DIR} \( -type f -or -type l \) -print | \ ${SED} -E -e 's,^${STAGEDIR}${PREFIX}/?,,' >> ${TMPPLIST} .endif +_USES_post_install+= cran-auto-plist .endif .endif #_INCLUDE_USES_CRAN_MK Index: Mk/Uses/display.mk =================================================================== --- Mk/Uses/display.mk +++ Mk/Uses/display.mk @@ -26,16 +26,13 @@ XVFBPIDFILE= /tmp/.xvfb-${XVFBPORT}.pid MAKE_ENV+= DISPLAY=":${XVFBPORT}" -.PHONY: start-display stop-display -pre-${display_ARGS}: start-display - -post-${display_ARGS}: stop-display - -start-display: +start-display:: daemon -p ${XVFBPIDFILE} Xvfb :${XVFBPORT} -stop-display: +stop-display:: pkill -15 -F ${XVFBPIDFILE} +_USES_pre_${display_ARGS}+= start-display +_USES_post_${display_ARGS}+= stop-display .endif .endif Index: Mk/Uses/kmod.mk =================================================================== --- Mk/Uses/kmod.mk +++ Mk/Uses/kmod.mk @@ -39,7 +39,7 @@ .if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_KMOD_POST_MK) _INCLUDE_USES_KMOD_POST_MK= yes -pre-install: ${STAGEDIR}${KMODDIR} +_USES_pre_install+= ${STAGEDIR}${KMODDIR} ${STAGEDIR}${KMODDIR}: @${MKDIR} ${.TARGET} Index: Mk/Uses/libtool.mk =================================================================== --- Mk/Uses/libtool.mk +++ Mk/Uses/libtool.mk @@ -25,6 +25,7 @@ .if defined(_POSTMKINCLUDED) && !defined(_INCLUDE_USES_LIBTOOL_POST_MK) _INCLUDE_USES_LIBTOOL_POST_MK= yes +_USES_post_configure+= patch-libtool patch-libtool: @${FIND} ${WRKDIR} \( -name configure -or -name ltconfig \) \ -type f | while read i; do ${SED} -i.libtool.bak \ @@ -60,6 +61,7 @@ -e '/if.*prog.*linkmode.*relink = .*mode/s/||.*;/;/' \ -e 's/|-p|-pg|/|-B*|-fstack-protector*|-p|-pg|/' +_USES_post_stage+= patch-lafiles patch-lafiles: .if ${libtool_ARGS:Mkeepla} @${FIND} ${STAGEDIR} -type f -name '*.la' | \ Index: Mk/Uses/pathfix.mk =================================================================== --- Mk/Uses/pathfix.mk +++ Mk/Uses/pathfix.mk @@ -18,6 +18,7 @@ PATHFIX_MAKEFILEIN?= Makefile.in +_USES_pre_patch+= pathfix pathfix: @${FIND} ${WRKSRC} -name "${PATHFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} -e \ 's|[(]libdir[)]/locale|(prefix)/share/locale|g ; \ Index: Mk/Uses/perl5.mk =================================================================== --- Mk/Uses/perl5.mk +++ Mk/Uses/perl5.mk @@ -274,6 +274,7 @@ # In all those, don't use - before the command so that the user does # not wonder what has been ignored by this message "*** Error code 1 (ignored)" +_USES_post_install+= fix-perl-things fix-perl-things: # Remove STAGEDIR from .packlist and add the file to the plist. @(if [ -d ${STAGEDIR}${PACKLIST_DIR} ] ; then \ Index: Mk/Uses/shebangfix.mk =================================================================== --- Mk/Uses/shebangfix.mk +++ Mk/Uses/shebangfix.mk @@ -60,6 +60,7 @@ _SHEBANG_REINPLACE_ARGS+= -e "1s|^\#![[:space:]]*${${lang}_OLD_CMD}|\#!${${lang}_CMD}|" .endfor +_USES_pre_patch+= fix-shebang fix-shebang: @cd ${WRKSRC}; \ ${ECHO_CMD} ${SHEBANG_FILES} | ${XARGS} ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -1447,6 +1447,13 @@ DESTDIRNAME?= DESTDIR +# setup empty variables for USES targets +.for target in fetch extract patch configure build install package stage +.for prepost in pre post +_USES_${prepost}_${target}?= +.endfor +.endfor + # Loading features .for f in ${USES} _f:= ${f:C/\:.*//} @@ -5609,33 +5616,33 @@ _PKG_DEP= check-sanity _PKG_SEQ= pkg-depends _FETCH_DEP= pkg -_FETCH_SEQ= fetch-depends pre-fetch ${_OPTIONS_pre_fetch} pre-fetch-script \ - do-fetch fetch-specials post-fetch ${_OPTIONS_post_fetch} post-fetch-script +_FETCH_SEQ= fetch-depends pre-fetch ${_OPTIONS_pre_fetch} ${_USES_pre_fetch:O} pre-fetch-script \ + do-fetch fetch-specials post-fetch ${_OPTIONS_post_fetch} ${_USES_post_fetch:O} post-fetch-script _EXTRACT_DEP= fetch _EXTRACT_SEQ= check-build-conflicts extract-message checksum extract-depends \ - clean-wrkdir ${WRKDIR} pre-extract ${_OPTIONS_pre_extract} pre-extract-script do-extract \ - post-extract ${_OPTIONS_post_extract} post-extract-script + clean-wrkdir ${WRKDIR} pre-extract ${_OPTIONS_pre_extract} ${_USES_pre_extract:O} pre-extract-script do-extract \ + post-extract ${_OPTIONS_post_extract} ${_USES_post_extract:O} post-extract-script _PATCH_DEP= extract -_PATCH_SEQ= ask-license patch-message patch-depends pathfix dos2unix fix-shebang \ - pre-patch ${_OPTIONS_pre_patch} \ - pre-patch-script do-patch charsetfix-post-patch post-patch ${_OPTIONS_post_patch} post-patch-script +_PATCH_SEQ= ask-license patch-message patch-depends dos2unix \ + pre-patch ${_OPTIONS_pre_patch} ${_USES_pre_patch:O} \ + pre-patch-script do-patch post-patch ${_OPTIONS_post_patch} ${_USES_post_patch:O} post-patch-script _CONFIGURE_DEP= patch _CONFIGURE_SEQ= build-depends lib-depends configure-message \ - pre-configure ${_OPTIONS_pre_configure} pre-configure-script \ - run-autotools do-autoreconf patch-libtool run-autotools-fixup do-configure \ - post-configure ${_OPTIONS_post_configure} post-configure-script + pre-configure ${_OPTIONS_pre_configure} ${_USES_pre_configure:O} pre-configure-script \ + run-autotools run-autotools-fixup do-configure \ + post-configure ${_OPTIONS_post_configure} ${_USES_post_configure:O} post-configure-script _BUILD_DEP= configure -_BUILD_SEQ= build-message pre-build ${_OPTIONS_pre_build} pre-build-script do-build \ - post-build ${_OPTIONS_post_build} post-build-script +_BUILD_SEQ= build-message pre-build ${_OPTIONS_pre_build} ${_USES_pre_build:O} pre-build-script do-build \ + post-build ${_OPTIONS_post_build} ${_USES_post_build:O} post-build-script _STAGE_DEP= build -_STAGE_SEQ= stage-message stage-dir run-depends lib-depends apply-slist pre-install ${_OPTIONS_pre_install} ${_OPTIONS_pre_stage} generate-plist \ +_STAGE_SEQ= stage-message stage-dir run-depends lib-depends apply-slist pre-install ${_OPTIONS_pre_install} ${_USES_pre_install:O} ${_OPTIONS_pre_stage} ${_USES_pre_stage:O} generate-plist \ pre-su-install # ${POST_PLIST} must be after anything that modifies TMPPLIST _STAGE_SEQ+= create-users-groups do-install \ - kmod-post-install fix-perl-things \ - webplugin-post-install post-install ${_OPTIONS_post_install} post-install-script \ - move-uniquefiles patch-lafiles post-stage ${_OPTIONS_post_stage} compress-man \ + kmod-post-install \ + webplugin-post-install post-install ${_OPTIONS_post_install} ${_USES_post_install:O} post-install-script \ + move-uniquefiles post-stage ${_OPTIONS_post_stage} ${_USES_post_stage:O} compress-man \ install-rc-script install-ldconfig-file install-license \ install-desktop-entries add-plist-info add-plist-docs \ add-plist-examples add-plist-data add-plist-post \ @@ -5648,7 +5655,7 @@ _INSTALL_SUSEQ= fake-pkg security-check _PACKAGE_DEP= stage -_PACKAGE_SEQ= package-message pre-package ${_OPTIONS_pre_package} pre-package-script do-package ${_OPTIONS_post_package} post-package-script +_PACKAGE_SEQ= package-message pre-package ${_OPTIONS_pre_package} ${_USES_pre_package:O} pre-package-script do-package ${_OPTIONS_post_package} ${_USES_post_package:O} post-package-script # Enforce order for -jN builds