changeset 21815:418b6066e544

new maintainer-mode for build (bug #48101) * configure.ac: Provide --enable-maintainer-mode option. If maintainer-mode is enabled, set AM_CONDITIONAL AMCOND_MAINTAINER_MODE to true. * Makefile.am (HG-ID): Write "maintainer-mode" to HG-ID file if AMCOND_MAINTAINER_MODE is true. (maintainer-mode-dist-hook): New target. (dist-hook): Also depend on maintainer-mode-dist-hook.
author John W. Eaton <jwe@octave.org>
date Thu, 02 Jun 2016 17:58:33 -0400
parents 0b5fd19477fd
children acc95f403d73
files Makefile.am configure.ac
diffstat 2 files changed, 31 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Makefile.am	Wed Jun 01 19:02:03 2016 -0400
+++ b/Makefile.am	Thu Jun 02 17:58:33 2016 -0400
@@ -173,7 +173,16 @@
 include m4/module.mk
 include test/module.mk
 
-dist-hook: doc-interpreter-dist-hook docs-dist-hook icons-dist-hook scripts-dist-hook
+dist-hook: maintainer-mode-dist-hook doc-interpreter-dist-hook docs-dist-hook icons-dist-hook scripts-dist-hook
+
+if AMCOND_MAINTAINER_MODE
+## HG-ID must be correct to package distribution.
+maintainer-mode-dist-hook:
+	@echo "Maintainer-mode enabled.  Cannot package distribution!"
+	exit 1
+else
+maintainer-mode-dist-hook:
+endif
 
 if AMCOND_BUILD_DOCS
 docs-dist-hook:
@@ -293,8 +302,20 @@
 	$(AM_V_GEN)$(changelog-from-hg-log)
 .PHONY: ChangeLog
 
+if AMCOND_MAINTAINER_MODE
+## Avoid unnecessary building just because HG-ID changes (for example,
+## editing a .m file will cause + to be appended to the hg ID and that
+## will trigger compiling the build-info.cc files, relinking libraries
+## and .oct files).
 HG-ID:
 	$(AM_V_GEN)rm -f $@-t && \
+	echo "maintainer-mode" > $@-t && \
+	$(simple_move_if_change_rule)
+else
+HG-ID:
+## Store hg ID in binaries so that we can identify botched installations
+## that are using incorrect or mismatched libraries.
+	$(AM_V_GEN)rm -f $@-t && \
 	if [ -d $(srcdir)/.hg ]; then \
 	  ( cd $(srcdir) && hg identify --id || echo "unknown" ) > $@-t && \
 	  $(simple_move_if_change_rule); \
@@ -305,6 +326,7 @@
 	  echo "preserving existing HG-ID file" 1>&2; \
 	  $(cp_update_rule); \
 	fi
+endif
 .PHONY: HG-ID
 
 octetc_DATA += \
--- a/configure.ac	Wed Jun 01 19:02:03 2016 -0400
+++ b/configure.ac	Thu Jun 02 17:58:33 2016 -0400
@@ -285,6 +285,14 @@
 AC_DEFINE_UNQUOTED([SHELL_PATH], ["$SHELL_PATH"],
   [Define this to be the path to the shell command interpreter.])
 
+ENABLE_MAINTAINER_MODE=no
+AC_ARG_ENABLE([maintainer-mode],
+  [AS_HELP_STRING([--enable-maintainer-mode],
+    [enable maintainer mode features in build system])],
+  [if test "$enableval" = yes; then ENABLE_MAINTAINER_MODE=yes; fi], [])
+AM_CONDITIONAL([AMCOND_MAINTAINER_MODE],
+  [test $ENABLE_MAINTAINER_MODE = yes])
+
 ### Enable bounds checking on element references within Octave's array and
 ### matrix classes.  This slows down some operations a bit, so it is turned off
 ### by default.