Index: Mk/Uses/autoreconf.mk =================================================================== --- Mk/Uses/autoreconf.mk +++ Mk/Uses/autoreconf.mk @@ -70,6 +70,7 @@ _INCLUDE_USES_AUTORECONF_POST_MK= yes .if ! ${autoreconf_ARGS:Mbuild} +_USES_configure+= 470:do-autoreconf do-autoreconf: .for f in AUTHORS ChangeLog INSTALL NEWS README # Don't modify time stamps if the files already exist Index: Mk/Uses/charsetfix.mk =================================================================== --- Mk/Uses/charsetfix.mk +++ Mk/Uses/charsetfix.mk @@ -17,6 +17,7 @@ CHARSETFIX_MAKEFILEIN?= Makefile.in +_USES_patch+= 600:charsetfix-post-patch charsetfix-post-patch: @${FIND} ${WRKSRC} -name "${CHARSETFIX_MAKEFILEIN}" -type f | ${XARGS} ${REINPLACE_CMD} \ -e 's|need_charset_alias=true|need_charset_alias=false|g ; \ Index: Mk/Uses/cran.mk =================================================================== --- Mk/Uses/cran.mk +++ Mk/Uses/cran.mk @@ -70,11 +70,10 @@ .endif .if ${cran_ARGS:Mauto-plist} -.if !target(post-install-script) -post-install-script: +_USES_install+= 750: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 -.endif .endif #_INCLUDE_USES_CRAN_MK Index: Mk/Uses/display.mk =================================================================== --- Mk/Uses/display.mk +++ Mk/Uses/display.mk @@ -26,11 +26,7 @@ XVFBPIDFILE= /tmp/.xvfb-${XVFBPORT}.pid MAKE_ENV+= DISPLAY=":${XVFBPORT}" -.PHONY: start-display stop-display -pre-${display_ARGS}: start-display - -post-${display_ARGS}: stop-display - +_USES_${display_ARGS}+= 290:start-display 860:stop-display start-display: daemon -p ${XVFBPIDFILE} Xvfb :${XVFBPORT} Index: Mk/Uses/dos2unix.mk =================================================================== --- Mk/Uses/dos2unix.mk +++ Mk/Uses/dos2unix.mk @@ -15,6 +15,7 @@ _DOS2UNIX_ALL= yes .endif +_USES_patch+= 200:dos2unix dos2unix: @${ECHO_MSG} "===> Converting DOS text files to UNIX text files" .if defined(_DOS2UNIX_ALL) Index: Mk/Uses/erlang.mk =================================================================== --- Mk/Uses/erlang.mk +++ Mk/Uses/erlang.mk @@ -65,18 +65,7 @@ ERLANG_COMPILE= ${REBAR3_CMD} .endif -.if !target(post-patch) -post-patch: post-patch-erlang -.endif - -.if !target(do-build) -do-build: do-build-erlang -.endif - -.if !target(do-install) -do-install: do-install-erlang -.endif - +_USES_patch+= 650:post-patch-erlang post-patch-erlang: @${FIND} ${WRKSRC} -name .gitignore -delete # Attempt to remove all traces of {vsn, ....}; replace with actual PORTVERSION @@ -99,7 +88,8 @@ fi @${RM} -f ${WRKSRC}/src/*.orig ${WRKSRC}/include/*.orig -do-build-erlang: +.if !target(do-build) +do-build: # This will cause calls to local rebar and rebar3 to fail; makes it easier to spot them @${RM} -f ${WRKSRC}/rebar ${WRKSRC}/rebar3 .for target in ${REBAR_TARGETS} @@ -107,8 +97,10 @@ @${RM} ${WRKSRC}/rebar.lock @cd ${WRKSRC} && REBAR_PROFILE=${REBAR_PROFILE} ${ERLANG_COMPILE} ${target} .endfor +.endif # !target(do-build) -do-install-erlang: +.if !target(do-install) +do-install: @${MKDIR} ${STAGEDIR}${ERL_APP_ROOT} @${MKDIR} ${STAGEDIR}${ERL_APP_ROOT}/src cd ${WRKSRC}/src && ${COPYTREE_SHARE} \* ${STAGEDIR}${ERL_APP_ROOT}/src @@ -141,5 +133,6 @@ @${MKDIR} ${STAGEDIR}${PREFIX}/bin ${INSTALL_SCRIPT} ${WRKSRC}/${PORTNAME} ${STAGEDIR}${PREFIX}/bin .endif +.endif # !target(do-install) .endif #!defined(_INCLUDE_USES_ERLANG_MK) 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_install+= 290:${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_configure+= 480:patch-libtool patch-libtool: @${FIND} ${WRKDIR} \( -name configure -or -name ltconfig \) \ -type f | while read i; do ${SED} -i.libtool.bak \ @@ -66,6 +67,7 @@ -e '/if.*prog.*linkmode.*relink = .*mode/s/||.*;/;/' \ -e 's/|-p|-pg|/|-B*|-fstack-protector*|-p|-pg|/' +_USES_stage+= 790:patch-lafiles patch-lafiles: .if ${libtool_ARGS:Mkeepla} @${FIND} ${STAGEDIR} -type f -name '*.la' | \ Index: Mk/Uses/ncurses.mk =================================================================== --- Mk/Uses/ncurses.mk +++ Mk/Uses/ncurses.mk @@ -39,7 +39,8 @@ NCURSESINC= ${NCURSESBASE}/include . if exists(${LOCALBASE}/lib/libncurses.so) -check-depends:: +_USES_sanity+= 400:check-depends-ncurses +check-depends-ncurses: @${ECHO_CMD} "Dependency error: this port wants the ncurses library from the FreeBSD" @${ECHO_CMD} "base system. You can't build against it, while a newer" @${ECHO_CMD} "version is installed by a port." Index: Mk/Uses/pathfix.mk =================================================================== --- Mk/Uses/pathfix.mk +++ Mk/Uses/pathfix.mk @@ -18,6 +18,7 @@ PATHFIX_MAKEFILEIN?= Makefile.in +_USES_patch+= 190: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_install+= 560: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 @@ -64,6 +64,7 @@ _SHEBANG_REINPLACE_ARGS+= -e "1s|^\#![[:space:]]*${${lang}_OLD_CMD}|\#!${${lang}_CMD}|" .endfor +_USES_patch+= 210:fix-shebang fix-shebang: @cd ${WRKSRC}; \ ${ECHO_CMD} ${SHEBANG_FILES} | ${XARGS} ${SED} -i '' ${_SHEBANG_REINPLACE_ARGS} Index: Mk/Uses/uniquefiles.mk =================================================================== --- Mk/Uses/uniquefiles.mk +++ Mk/Uses/uniquefiles.mk @@ -101,6 +101,7 @@ _DO_CONDITIONAL_SYMLINK= ${DO_NADA} .endif +_USES_stage+= 775:move-uniquefiles move-uniquefiles: .if ${UNIQUE_PREFIX_FILES} || ${UNIQUE_FIND_PREFIX_FILES} @${ECHO_MSG} "===> Creating unique files: Move files needing PREFIX"; @@ -166,6 +167,7 @@ # Using .if exists(${_UNIQUEPKGPLIST} below instead of the sh test # does not work in poudriere. It works fine on the CLI, though... +_USES_stage+= 950:move-uniquefiles-plist move-uniquefiles-plist: @if [ -e ${_UNIQUEPKGLIST} ]; then \ orgIFS=$$IFS; IFS=":"; while read command entry newentry; do \ Index: Mk/Uses/webplugin.mk =================================================================== --- Mk/Uses/webplugin.mk +++ Mk/Uses/webplugin.mk @@ -167,6 +167,7 @@ .endfor .endfor +_USES_install+= 600:webplugin-post-install webplugin-post-install: .for d in ${_WEBPLUGIN_LINKFARMS} ${MKDIR} ${STAGEDIR}${d} Index: Mk/Uses/zope.mk =================================================================== --- Mk/Uses/zope.mk +++ Mk/Uses/zope.mk @@ -79,7 +79,8 @@ .if ${ZOPE_VERSION} == ${_ZOPE_PORTBRANCH} RUN_DEPENDS+= zope213>0:${PORTSDIR}/www/zope213 .else -check-makevars:: +_USES_sanity+= 300:check-makevars-zope +check-makevars-zope: @${ECHO} "Makefile error: bad value for ZOPE_VERSION: ${ZOPE_VERSION}." @${ECHO} "Legal values are: ${_ZOPE_PORTBRANCH} (default)" @${FALSE} Index: Mk/bsd.options.mk =================================================================== --- Mk/bsd.options.mk +++ Mk/bsd.options.mk @@ -137,7 +137,11 @@ PATCH_SITES PLIST_DIRS PLIST_DIRSTRY PLIST_FILES PLIST_SUB \ PORTDOCS SUB_FILES SUB_LIST USES _OPTIONS_DEPENDS= PKG FETCH EXTRACT PATCH BUILD LIB RUN -_OPTIONS_TARGETS= fetch extract patch configure build install package stage + +# The format here is :, +_OPTIONS_TARGETS= fetch:300,700 extract:300,700 patch:300,700 \ + configure:300,700 build:300,700 install:300,700 \ + package:300,700 stage:300,800 # Set the default values for the global options, as defined by portmgr .if !defined(NOPORTDOCS) @@ -413,10 +417,8 @@ ALL_OPTIONS= ${OPTIONS_DEFINE} .endif -.for target in ${_OPTIONS_TARGETS} -.for prepost in pre post -_OPTIONS_${prepost}_${target}?= -.endfor +.for target in ${_OPTIONS_TARGETS:C/:.*//} +_OPTIONS_${target}?= .endfor .for opt in ${COMPLETE_OPTIONS_LIST} ${OPTIONS_SLAVE} ${OPTIONS_EXCLUDE_${ARCH}} ${OPTIONS_EXCLUDE} @@ -473,8 +475,12 @@ . endif . endfor . for target in ${_OPTIONS_TARGETS} -. for prepost in pre post -_OPTIONS_${prepost}_${target}+= ${prepost}-${target}-${opt}-on +_target= ${target:C/:.*//} +_pre= ${target:C/.*://:C/,.*//} +_post= ${target:C/.*://:C/.*,//} +. for pre_post in pre post +_full_target= ${pre_post}-${_target}-${opt}-on +_OPTIONS_${_target}:= ${_OPTIONS_${_target}} ${_${pre_post}}:${_full_target} . endfor . endfor . else @@ -510,8 +516,12 @@ . endif . endfor . for target in ${_OPTIONS_TARGETS} -. for prepost in pre post -_OPTIONS_${prepost}_${target}+= ${prepost}-${target}-${opt}-off +_target= ${target:C/:.*//} +_pre= ${target:C/.*://:C/,.*//} +_post= ${target:C/.*://:C/.*,//} +. for pre_post in pre post +_full_target= ${pre_post}-${_target}-${opt}-off +_OPTIONS_${_target}:= ${_OPTIONS_${_target}} ${_${pre_post}}:${_full_target} . endfor . endfor . endif Index: Mk/bsd.port.mk =================================================================== --- Mk/bsd.port.mk +++ Mk/bsd.port.mk @@ -1427,6 +1427,11 @@ DESTDIRNAME?= DESTDIR +# setup empty variables for USES targets +.for target in sanity fetch extract patch configure build install package stage +_USES_${target}?= +.endfor + # Loading features .for f in ${USES} _f:= ${f:C/\:.*//} @@ -5527,62 +5532,95 @@ # Define the SEQ of actions to take when each target is ran, and which targets # it depends on before running its SEQ. +# +# Main target has a priority of 500, pre-target 300, post-target 700, +# target-depends 150. Other targets are spaced in between those +# +# If you change the pre-foo and post-foo values here, go and keep them in sync +# in _OPTIONS_TARGETS in bsd.options.mk -_SANITY_SEQ= post-chroot pre-everything check-makefile \ - show-warnings show-dev-warnings show-dev-errors \ - check-categories check-makevars check-desktop-entries \ - check-depends identify-install-conflicts check-deprecated \ - check-vulnerable check-license check-config buildanyway-message \ - options-message +_SANITY_SEQ= 050:post-chroot 100:pre-everything 150:check-makefile \ + 200:show-warnings 210:show-dev-warnings 220:show-dev-errors \ + 250:check-categories 300:check-makevars \ + 350:check-desktop-entries 400:check-depends \ + 450:identify-install-conflicts 500:check-deprecated \ + 550:check-vulnerable 600:check-license 650:check-config \ + 700:buildanyway-message 750:options-message ${_USES_sanity} _PKG_DEP= check-sanity -_PKG_SEQ= pkg-depends +_PKG_SEQ= 500: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= 150:fetch-depends 300:pre-fetch 450:pre-fetch-script \ + 500:do-fetch 550:fetch-specials 700:post-fetch \ + 850:post-fetch-script \ + ${_OPTIONS_fetch} ${_USES_fetch} _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 +_EXTRACT_SEQ= 010:check-build-conflicts 050:extract-message 100:checksum \ + 150:extract-depends 190:clean-wrkdir 200:${WRKDIR} \ + 300:pre-extract 450:pre-extract-script 500:do-extract \ + 700:post-extract 850:post-extract-script \ + ${_OPTIONS_extract} ${_USES_extract} _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= 050:ask-license 100:patch-message 150:patch-depends \ + 300:pre-patch 450:pre-patch-script 500:do-patch \ + 700:post-patch 850:post-patch-script \ + ${_OPTIONS_patch} ${_USES_patch} _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 +_CONFIGURE_SEQ= 150:build-depends 151:lib-depends 200:configure-message \ + 300:pre-configure 450:pre-configure-script 460:run-autotools \ + 490:run-autotools-fixup 500:do-configure 700:post-configure \ + 850:post-configure-script \ + ${_OPTIONS_configure} ${_USES_configure} _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= 100:build-message 300:pre-build 450:pre-build-script \ + 500:do-build 700:post-build 850:post-build-script \ + ${_OPTIONS_build} ${_USES_build} _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 \ - 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 \ - 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 \ - move-uniquefiles-plist ${POST_PLIST} +# STAGE is special in its numbering as it has install and stage, so install is +# the main, and stage goes after. +_STAGE_SEQ= 050:stage-message 100:stage-dir 150:run-depends \ + 151:lib-depends 200:apply-slist 300:pre-install \ + 400:generate-plist 450:pre-su-install 475:create-users-groups \ + 500:do-install 550:kmod-post-install 700:post-install \ + 750:post-install-script 800:post-stage 850:compress-man \ + 860:install-rc-script 870:install-ldconfig-file \ + 880:install-license 890:install-desktop-entries \ + 900:add-plist-info 910:add-plist-docs 920:add-plist-examples \ + 930:add-plist-data 940:add-plist-post ${POST_PLIST:C/^/990:/} \ + ${_OPTIONS_install} ${_USES_install} \ + ${_OPTIONS_stage} ${_USES_stage} .if defined(DEVELOPER) -_STAGE_SEQ+= stage-qa +_STAGE_SEQ+= 995:stage-qa .endif _INSTALL_DEP= stage -_INSTALL_SEQ= install-message run-depends lib-depends check-already-installed -_INSTALL_SUSEQ= fake-pkg security-check +_INSTALL_SEQ= 100:install-message 150:run-depends 151:lib-depends \ + 200:check-already-installed +_INSTALL_SUSEQ= 300:fake-pkg 500: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= 100:package-message 300:pre-package 450:pre-package-script \ + 500:do-package 850:post-package-script \ + ${_OPTIONS_pre_package:C/^/300:/} \ + ${_OPTIONS_post_package:C/^/700:/} \ + ${_USES_package} # Enforce order for -jN builds - .for _t in ${_TARGETS_STAGES} -. for s in ${_${_t}_SEQ} +# Check if the port need to change the default order of some targets... +. if defined(TARGET_ORDER_OVERRIDE) +_tmp_seq:= +. for _entry in ${_${_t}_SEQ} +_target:= ${_entry:C/^[0-9]+://} +. if ${TARGET_ORDER_OVERRIDE:M*\:${_target}} +.warning ${_entry} ${_target} ${TARGET_ORDER_OVERRIDE} ${TARGET_ORDER_OVERRIDE:M*\:${_target}} +_tmp_seq:= ${_tmp_seq} ${TARGET_ORDER_OVERRIDE:M*\:${_target}} +. else +_tmp_seq:= ${_tmp_seq} ${_entry} +. endif +. endfor +_${_t}_SEQ:= ${_tmp_seq} +. endif +. for s in ${_${_t}_SEQ:O:C/^[0-9]+://} . if target(${s}) . if ! ${NOTPHONY:M${s}} _PHONY_TARGETS+= ${s} @@ -5590,7 +5628,7 @@ _${_t}_REAL_SEQ+= ${s} . endif . endfor -. for s in ${_${_t}_SUSEQ} +. for s in ${_${_t}_SUSEQ:O:C/^[0-9]+://} . if target(${s}) . if ! ${NOTPHONY:M${s}} _PHONY_TARGETS+= ${s}