summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAde Lovett <ade@FreeBSD.org>2010-12-22 20:04:59 +0000
committerAde Lovett <ade@FreeBSD.org>2010-12-22 20:04:59 +0000
commit55d09a7758330e40bc25cb90b27b1ae9b034af02 (patch)
tree05868b264ad3b8afd72a18a11649fe6aa59b1cb8
parentUpdate port to work with new distfile naming scheme. (diff)
As the final (for now) cleanup of autotools, in order to reduce tree
churn on new versions, a new target has been introduced to allow PLIST_SUB-style patching of files. For example, rather than patching "foo/bar/baz" to tweak some random occurance of an autoconf version number to the latest, the patch should now replace it with %%AUTOCONF_VERSION%% A new Makefile variable, AUTOTOOLSFILES has been introduced, which when populated will automatically go through and patch %%AUTOCONF_VERSION%% to the contents of ${AUTOCONF_VERSION} (and likewise for all other known autotools variables -- "make -V AUTOTOOLS_VARS" to see the list for a specific port. Tested by: pav (-exp run, since it touches bsd.port.mk also)
-rw-r--r--Mk/bsd.autotools.mk43
1 files changed, 28 insertions, 15 deletions
diff --git a/Mk/bsd.autotools.mk b/Mk/bsd.autotools.mk
index 9ef67dde25d3..dbbeb5c798e0 100644
--- a/Mk/bsd.autotools.mk
+++ b/Mk/bsd.autotools.mk
@@ -49,6 +49,10 @@ Autotools_Include_MAINTAINER= autotools@FreeBSD.org
# LIBTOOLFILES=<list-of-files>
# - A list of files to patch during libtool pre-configuration
#
+# AUTOTOOLSFILES=<list-of-files>
+# - A list of files to further patch with derived information
+# post-patching to reduce churn during component updates
+#
#---------------------------------------------------------------------------
#---------------------------------------------------------------------------
@@ -319,13 +323,15 @@ ${var:U}_ENV+= ${AUTOTOOLS_VARS}
#---------------------------------------------------------------------------
.if !target(run-autotools)
-.ORDER: run-autotools run-autotools-aclocal patch-autotools-libtool \
- run-autotools-autoheader run-autotools-libtoolize \
- run-autotools-autoconf run-autotools-automake
-
-run-autotools:: run-autotools-aclocal patch-autotools-libtool \
- run-autotools-autoheader run-autotools-libtoolize \
- run-autotools-autoconf run-autotools-automake
+.ORDER: run-autotools run-autotools-aclocal \
+ patch-autotools-libtool run-autotools-autoheader \
+ run-autotools-libtoolize run-autotools-autoconf \
+ run-autotools-automake
+
+run-autotools:: run-autotools-aclocal \
+ patch-autotools-libtool run-autotools-autoheader \
+ run-autotools-libtoolize run-autotools-autoconf \
+ run-autotools-automake
.endif
.if !target(run-autotools-aclocal)
@@ -393,13 +399,20 @@ patch-autotools-libtool::
.endif
#---------------------------------------------------------------------------
-# XXX: Placeholder - to be implemented
-# substitution of, eg: %%AUTOCONF%% with ${AUTOCONF}
-# to reduce patch churn (patches in files/ will be doing
-# replacement of specific versions to %%AUTOCONF%% then this
-# target will handle the rest
-
-.if !target(patch-autotools)
-patch-autotools::
+# Reduce patch churn by auto-substituting data from AUTOTOOLS_VARS
+# into the correct places. Code shamelessly stolen from PLIST_SUB.
+
+AUTOTOOLSFILES?= # default to empty
+AUTOTOOLS_VARS?= # empty if not already set
+
+.if !target(configure-autotools)
+configure-autotools::
+. if ${AUTOTOOLS_VARS}!="" && ${AUTOTOOLSFILES} != ""
+ @for file in ${AUTOTOOLSFILES}; do \
+ ${REINPLACE_CMD} ${AUTOTOOLS_VARS:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+ ${WRKSRC}/$${file} ; \
+ done
+. else
@${DO_NADA}
+. endif
.endif