This comes from an idea from sthen@
One issue is that ports running autoconf/autoreconf and friends never
quite know whether to do it in post-patch or pre-configure.
post-patch:
+ done once during patch phase
- if it fails for whatever reason, you have to do a full clean
- if you need to tweak it, you also have to do a full clean
pre-configure:
+ doesn't interfere with patch phase
- rerun every configure, can be time consuming, especially if you're just
tweaking small configure properties...
So that smell tends to suggest there's an intermediate step that could be
taken, this is what I'm proposing.
For now, I've called it "preconf" (name subject to change) and I also get
a "reconf" to run it again even if the cookie is already there.
For now, the step would only have a do-preconf target, by default running
MODGNU_preconf steps (or easily running autoreconf or whatever).
We can always extend it to pre/post steps if necessary (note there is a
precedent, as distpatch only has a do-distpatch step).
Impact appears to be minimal. Input on possibly better names welcome.
(maybe call it "autoconf", not strictly accurate, but it always end up
running some variation on autoconf ?...)
Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1436
diff -u -p -r1.1436 bsd.port.mk
--- bsd.port.mk 6 Aug 2018 09:36:32 -0000 1.1436
+++ bsd.port.mk 6 Aug 2018 09:52:50 -0000
@@ -674,6 +674,7 @@ _EXTRACT_COOKIE = ${WRKDIR}/.extract_do
_PATCH_COOKIE = ${WRKDIR}/.patch_done
_DISTPATCH_COOKIE = ${WRKDIR}/.distpatch_done
_PREPATCH_COOKIE = ${WRKDIR}/.prepatch_done
+_PRECONF_COOKIE = ${WRKDIR}/.preconf_done
_BULK_COOKIE = ${BULK_COOKIES_DIR}/${FULLPKGNAME}
_FAKE_COOKIE = ${WRKINST}/.fake_done
_INSTALL_PRE_COOKIE = ${WRKINST}/.install_started
@@ -705,7 +706,8 @@ _TEST_COOKIE = ${WRKDIR}/.test_done
_TS_COOKIE = ${WRKDIR}/.check-wrkdir_stamp
-_ALL_COOKIES = ${_EXTRACT_COOKIE} ${_PATCH_COOKIE} ${_CONFIGURE_COOKIE} \
+_ALL_COOKIES = ${_EXTRACT_COOKIE} ${_PATCH_COOKIE} ${_PRECONF_COOKIE} \
+ ${_CONFIGURE_COOKIE} \
${_INSTALL_PRE_COOKIE} ${_BUILD_COOKIE} ${_TEST_COOKIE} \
${_PACKAGE_COOKIES} ${_CACHE_PACKAGE_COOKIES} \
${_DISTPATCH_COOKIE} ${_PREPATCH_COOKIE} ${_FAKE_COOKIE} \
@@ -2231,7 +2233,7 @@ _internal-fetch-all:
.if (!empty(IGNORE${SUBPACKAGE}) || defined(_EXTRA_IGNORE)) &&
!defined(NO_IGNORE)
_internal-all _internal-build _internal-checksum _internal-configure \
_internal-deinstall _internal-extract _internal-fake _internal-fetch \
- _internal-install _internal-install-all \
+ _internal-install _internal-install-all _internal-preconf \
_internal-package _internal-patch _internal-plist _internal-test \
_internal-subpackage _internal-subupdate _internal-uninstall \
_internal-update _internal-update-or-install _internal-generate-readmes
\
@@ -2348,6 +2350,7 @@ _internal-patch: ${_DEPBUILD_COOKIES} ${
${_DEPBUILDWANTLIB_COOKIE} ${_PATCH_COOKIE}
_internal-distpatch: ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} \
${_DEPBUILDWANTLIB_COOKIE} ${_DISTPATCH_COOKIE}
+_internal-preconf: ${_PRECONF_COOKIE}
_internal-configure: ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} \
${_DEPBUILDWANTLIB_COOKIE} ${_CONFIGURE_COOKIE}
_internal-build _internal-all: ${_DEPBUILD_COOKIES} ${_DEPBUILDLIB_COOKIES} \
@@ -2392,7 +2395,7 @@ update-patches:
# Top-level targets redirect to the real _internal-target, along with locking
# if locking exists.
-.for _t in extract patch distpatch configure build all install fake \
+.for _t in extract patch distpatch preconf configure build all install fake \
subupdate fetch fetch-all checksum test prepare install-depends \
test-depends clean plist update-plist generate-readmes \
update update-or-install update-or-install-all package install-all
@@ -2687,9 +2690,26 @@ do-configure:
.endif
+# run as _pbuild
+.if !target(do-preconf)
+do-preconf:
+. for _m in ${MODULES:T:U}
+. if defined(MOD${_m}_preconf)
+ @${MOD${_m}_preconf}
+. endif
+. endfor
+.endif
+
+# The real preconfigure
+
+${_PRECONF_COOKIE}: ${_PATCH_COOKIE}
+ @${ECHO_MSG} "===> Preconfiguring for ${FULLPKGNAME}${_MASTER}"
+ @${_PMAKE} do-preconf
+ @${_PMAKE_COOKIE} $@
+
# The real configure
-${_CONFIGURE_COOKIE}: ${_PATCH_COOKIE}
+${_CONFIGURE_COOKIE}: ${_PRECONF_COOKIE}
@${ECHO_MSG} "===> Configuring for ${FULLPKGNAME}${_MASTER}"
.if defined(_CONFIG_SITE)
@cd ${PORTSDIR}/infrastructure/db && cat ${CONFIG_SITE_LIST} ${_PREDIR}
${_CONFIG_SITE}
@@ -3434,6 +3454,10 @@ rebuild:
@${_PBUILD} rm -f ${_BUILD_COOKIE}
@${_MAKE} build
+reconf:
+ @${_PBUILD} rm -f ${_PRECONF_COOKIE}
+ @${_MAKE} preconf
+
uninstall deinstall:
@${ECHO_MSG} "===> Deinstalling for ${FULLPKGNAME${SUBPACKAGE}}"
@${SUDO} ${_PKG_DELETE} ${FULLPKGNAME${SUBPACKAGE}}
@@ -3473,7 +3497,7 @@ _all_phony = ${_recursive_depends_target
${_recursive_targets} ${_dangerous_recursive_targets} \
_build-dir-depends _hook-post-install \
_internal-all _internal-build _internal-build-depends \
- _internal-checksum _internal-clean _internal-configure \
+ _internal-checksum _internal-clean _internal-preconf
_internal-configure \
_internal-distpatch _internal-extract _internal-fake _internal-fetch \
_internal-fetch-all _internal-install-depends _internal-install-all \
_internal-package _internal-package-only _internal-plist
_internal-prepare \
@@ -3485,14 +3509,14 @@ _all_phony = ${_recursive_depends_target
_print-package-signature-run _print-packagename
_recurse-all-dir-depends \
_recurse-test-dir-depends _recurse-run-dir-depends \
build-depends-list checkpatch clean clean-depends \
- delete-package distpatch do-build do-configure do-distpatch \
+ delete-package distpatch do-build do-configure do-preconf do-distpatch \
do-extract do-install do-test fetch-all \
install-all lib-depends lib-depends-list \
peek-ftp port-lib-depends-check post-build post-configure \
post-distpatch post-extract post-install \
post-patch post-test pre-build pre-configure pre-extract pre-fake \
pre-install pre-patch pre-test prepare \
- print-build-depends print-run-depends rebuild \
+ print-build-depends print-run-depends rebuild reconf \
test-depends test-depends-list run-depends-list \
show-required-by subpackage uninstall _print-metadata \
run-depends-args lib-depends-args all-lib-depends-args wantlib-args \
Index: gnu.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/gnu.port.mk,v
retrieving revision 1.56
diff -u -p -r1.56 gnu.port.mk
--- gnu.port.mk 4 Aug 2018 09:01:08 -0000 1.56
+++ gnu.port.mk 6 Aug 2018 09:52:50 -0000
@@ -113,7 +113,7 @@ CONFIGURE_ENV += ac_cv_path_GTKDOC_MKPDF
TEST_TARGET ?= check
# internal stuff to run on each directory.
-MODGNU_post-patch = for d in ${AUTOCONF_DIR}; do cd $$d; ${_MODGNU_loop} done;
+MODGNU_preconf = for d in ${AUTOCONF_DIR}; do cd $$d; ${_MODGNU_loop} done;
_MODGNU_loop =
PATCH_CHECK_ONLY ?= No
Index: pkgpath.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/pkgpath.mk,v
retrieving revision 1.74
diff -u -p -r1.74 pkgpath.mk
--- pkgpath.mk 29 Jul 2018 13:27:44 -0000 1.74
+++ pkgpath.mk 6 Aug 2018 09:52:50 -0000
@@ -162,8 +162,8 @@ REPORT_PROBLEM ?= exit 1
.endif
_recursive_targets = \
- all build checksum configure deinstall distclean extract fake fetch \
- fetch-all full-all-depends full-build-depends generate-readmes \
+ all build checksum preconf configure deinstall distclean extract fake \
+ fetch fetch-all full-all-depends full-build-depends generate-readmes \
full-test-depends full-run-depends \
install install-all \
license-check package patch \