aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorade <ade@FreeBSD.org>2010-12-23 04:04:59 +0800
committerade <ade@FreeBSD.org>2010-12-23 04:04:59 +0800
commit7ff69e2f85702b7c6b49ce09c3f75364c4e21f85 (patch)
treef303f778583d176cae130016ea3162adcbf8107e
parentb55fb23ea6bb3d27fd9bdf74bf5cb742fbdc3e16 (diff)
downloadfreebsd-ports-gnome-7ff69e2f85702b7c6b49ce09c3f75364c4e21f85.tar.gz
freebsd-ports-gnome-7ff69e2f85702b7c6b49ce09c3f75364c4e21f85.tar.zst
freebsd-ports-gnome-7ff69e2f85702b7c6b49ce09c3f75364c4e21f85.zip
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