Skip to contentSkip to conversation

support: add a customized 'missing' script

PATCH New Romain Naour 1 participant 3 messages Mar 9, 2016

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/3 support: add a customized 'missing' script

Since automake v1.12b the 'missing' script return exit status of the given program [1]. This triggers some build failure [2] [3] when one of maintainer tools is missing on the host.

This is the case for binutils and gdb [4] which use an updated version of the 'missing' script.

There is also some case where 'missing' is used as a workaround when a tool is not available (coreutils: PERL=missing, gcc: MAKEINFO=missing) and might stop the build if an updated version of 'missing' is used.

So, add a slightly modified version which return 0 even if one of maintainer tools like makeinfo is missing on the host.
This follow the idea from Arnout about a wrapper for programs that we want to work around [5]. This allow to handle the case where something else uses 'missing' for a more important purpose than makeinfo.

[1] http://git.savannah.gnu.org/cgit/automake.git/commit/?id=a22717dffe37f30ef2ad2c355b68c9b3b5e4b8c7
[2] http://autobuild.buildroot.org/results/244/2442e697d8a300496434fd42fcb1ee3941d13e06/
[3] http://autobuild.buildroot.net/results/dd5/dd50ed99abb2c8495def826866b184030953f90e/
[4] https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;a=commitdiff;h=e30465112ed4c6320dd19107302057a5f7712cf2
[5] http://lists.busybox.net/pipermail/buildroot/2016-February/151277.html

Cc Thomas Petazzoni <[email protected]>
Cc Vicente Olivert Riera <[email protected]>
Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Cc "Yann E. MORIN" <[email protected]>
---
 support/scripts/missing | 218 ++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 218 insertions(+)
 create mode 100755 support/scripts/missing
support/scripts/missing new file +218 -0
new file mode 100755
index 0000000..f74e83c
@@ -0,0 +1,218 @@
+#! /bin/sh
+# Common wrapper for a few potentially missing GNU programs.
+# From the upcoming automake v1.16
+
+scriptversion=2016-01-11.22; # UTC
+
+# Copyright (C) 1996-2015 Free Software Foundation, Inc.
+# Originally written by Fran,cois Pinard <[email protected]>, 1996.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+
+# As a special exception to the GNU General Public License, if you
+# distribute this file as part of a program that contains a
+# configuration script generated by Autoconf, you may include it under
+# the same distribution terms that you use for the rest of that program.
+
+if test $# -eq 0; then
+  echo 1>&2 "Try '$0 --help' for more information"
+  exit 1
+fi
+
+case $1 in
+
+  --is-lightweight)
+    # Used by our autoconf macros to check whether the available missing
+    # script is modern enough.
+    exit 0
+    ;;
+
+  --run)
+    # Back-compat with the calling convention used by older automake.
+    shift
+    ;;
+
+  -h|--h|--he|--hel|--help)
+    echo "\
+$0 [OPTION]... PROGRAM [ARGUMENT]...
+
+Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
+to PROGRAM being missing or too old.
+
+Options:
+  -h, --help      display this help and exit
+  -v, --version   output version information and exit
+
+Supported PROGRAM values:
+  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
+  bison     yacc      flex         lex       help2man
+
+Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
+'g' are ignored when checking the name.
+
+Send bug reports to <[email protected]>."
+    exit $?
+    ;;
+
+  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
+    echo "missing $scriptversion (GNU Automake)"
+    exit $?
+    ;;
+
+  -*)
+    echo 1>&2 "$0: unknown '$1' option"
+    echo 1>&2 "Try '$0 --help' for more information"
+    exit 1
+    ;;
+
+esac
+
+# Run the given program, remember its exit status.
+"$@"; st=$?
+
+# If it succeeded, we are done.
+test $st -eq 0 && exit 0
+
+# Also exit now if we it failed (or wasn't found), and '--version' was
+# passed; such an option is passed most likely to detect whether the
+# program is present and works.
+case $2 in --version|--help) exit $st;; esac
+
+# Exit code 63 means version mismatch.  This often happens when the user
+# tries to use an ancient version of a tool on a file that requires a
+# minimum version.
+if test $st -eq 63; then
+  msg="probably too old"
+elif test $st -eq 127; then
+  # Program was missing.
+  msg="missing on your system"
+else
+  # Program was found and executed, but failed.  Give up.
+  exit $st
+fi
+
+perl_URL=http://www.perl.org/
+flex_URL=http://flex.sourceforge.net/
+gnu_software_URL=http://www.gnu.org/software
+
+program_details ()
+{
+  case $1 in
+    aclocal|automake)
+      echo "The '$1' program is part of the GNU Automake package:"
+      echo "<$gnu_software_URL/automake>"
+      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/autoconf>"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+    autoconf|autom4te|autoheader)
+      echo "The '$1' program is part of the GNU Autoconf package:"
+      echo "<$gnu_software_URL/autoconf/>"
+      echo "It also requires GNU m4 and Perl in order to run:"
+      echo "<$gnu_software_URL/m4/>"
+      echo "<$perl_URL>"
+      ;;
+  esac
+}
+
+give_advice ()
+{
+  # Normalize program name to check for.
+  normalized_program=`echo "$1" | sed '
+    s/^gnu-//; t
+    s/^gnu//; t
+    s/^g//; t'`
+
+  printf '%s\n' "'$1' is $msg."
+
+  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
+  case $normalized_program in
+    autoconf*)
+      echo "You should only need it if you modified 'configure.ac',"
+      echo "or m4 files included by it."
+      program_details 'autoconf'
+      ;;
+    autoheader*)
+      echo "You should only need it if you modified 'acconfig.h' or"
+      echo "$configure_deps."
+      program_details 'autoheader'
+      ;;
+    automake*)
+      echo "You should only need it if you modified 'Makefile.am' or"
+      echo "$configure_deps."
+      program_details 'automake'
+      ;;
+    aclocal*)
+      echo "You should only need it if you modified 'acinclude.m4' or"
+      echo "$configure_deps."
+      program_details 'aclocal'
+      ;;
+   autom4te*)
+      echo "You might have modified some maintainer files that require"
+      echo "the 'autom4te' program to be rebuilt."
+      program_details 'autom4te'
+      ;;
+    bison*|yacc*)
+      echo "You should only need it if you modified a '.y' file."
+      echo "You may want to install the GNU Bison package:"
+      echo "<$gnu_software_URL/bison/>"
+      ;;
+    lex*|flex*)
+      echo "You should only need it if you modified a '.l' file."
+      echo "You may want to install the Fast Lexical Analyzer package:"
+      echo "<$flex_URL>"
+      ;;
+    help2man*)
+      echo "You should only need it if you modified a dependency" \
+           "of a man page."
+      echo "You may want to install the GNU Help2man package:"
+      echo "<$gnu_software_URL/help2man/>"
+    ;;
+    makeinfo*)
+      echo "You should only need it if you modified a '.texi' file, or"
+      echo "any other file indirectly affecting the aspect of the manual."
+      echo "You might want to install the Texinfo package:"
+      echo "<$gnu_software_URL/texinfo/>"
+      echo "The spurious makeinfo call might also be the consequence of"
+      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
+      echo "want to install GNU make:"
+      echo "<$gnu_software_URL/make/>"
+      ;;
+    *)
+      echo "You might have modified some files without having the proper"
+      echo "tools for further handling them.  Check the 'README' file, it"
+      echo "often tells you about the needed prerequisites for installing"
+      echo "this package.  You may also peek at any GNU archive site, in"
+      echo "case some other package contains this missing '$1' program."
+      ;;
+  esac
+}
+
+give_advice "$1" | sed -e '1s/^/WARNING: /' \
+                       -e '2,$s/^/         /' >&2
+
+# Buildroot specific:
+# Do NOT propagate the correct exit status (expected to be 127 for a program
+# not found, 63 for a program that failed due to version mismatch).
+# Exit gracefully
+exit 0
+
+# Local variables:
+# eval: (add-hook 'write-file-hooks 'time-stamp)
+# time-stamp-start: "scriptversion="
+# time-stamp-format: "%:y-%02m-%02d.%02H"
+# time-stamp-time-zone: "UTC0"
+# time-stamp-end: "; # UTC"
+# End:
Signature · 1 line
2.5.0
#1 lore raw

PATCH v2 2/3 package/gdb: use our missing script to disable the doc

In order to workaround a build issue when makeinfo is missing on the host, use our custom 'missing' script. The script bundled with gdb sources return the exit status of the given program (makeinfo) and stop the build.

Remove the script bundled with gdb sources an create a symlink to our customized 'missing' script.

Fixes:
http://autobuild.buildroot.net/results/4fcad074e1c9d66e19283bac9e15039990eb9430/

Cc Thomas Petazzoni <[email protected]>
Cc Vicente Olivert Riera <[email protected]>
Cc Arnout Vandecappelle (Essensium/Mind) <[email protected]>
Cc "Yann E. MORIN" <[email protected]>

---
v2: Remove the script bundled with gdb sources an create a symlink to our
customized 'missing' script.

---
 package/gdb/gdb.mk | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)
package/gdb/gdb.mk +9 -8
index 32d52eb..2aaf154 100644
@@ -51,15 +51,16 @@ GDB_PRE_PATCH_HOOKS += GDB_XTENSA_PRE_PATCH
 HOST_GDB_PRE_PATCH_HOOKS += GDB_XTENSA_PRE_PATCH
 endif
 
-# Prevent gdb to build the documentation
+# Don't build documentation. It takes up extra space / build time,
+# and sometimes needs specific makeinfo versions to work.
+GDB_CONF_ENV += ac_cv_prog_MAKEINFO=missing
+HOST_GDB_CONF_ENV += ac_cv_prog_MAKEINFO=missing
+
+# Since gdb use an updated version of the 'missing' script from automake
+# >= v1.12b, use our customized version.
 define GDB_DISABLE_DOC
-	$(SED) '/^SUBDIRS =/ s/doc//' $(@D)/gdb/Makefile.in
-	if test -e $(@D)/bfd/doc/Makefile.in ; then \
-		$(SED) 's/^INFO_DEPS =.*$$/INFO_DEPS =/' $(@D)/bfd/doc/Makefile.in ; \
-	fi
-	if test -e $(@D)/gprof/Makefile.in ; then \
-		$(SED) 's/^INFO_DEPS =.*$$/INFO_DEPS =/' $(@D)/gprof/Makefile.in ; \
-	fi
+	rm -f $(@D)/missing
+	ln -s $(TOPDIR)/support/scripts/missing $(@D)/missing
 endef
 GDB_PRE_CONFIGURE_HOOKS += GDB_DISABLE_DOC
 HOST_GDB_PRE_CONFIGURE_HOOKS += GDB_DISABLE_DOC
Signature · 1 line
2.5.0
#2 lore raw

PATCH v2 3/3 package/binutils: use our missing script to disable the doc

In reply to Romain Naour

Like for gdb, use our 'missing' script to workaround a build issue when makeinfo is missing on the host.

This fixes the issue with binutils >= 2.26.

---
v2: Remove the script bundled with binutils sources an create a symlink to our
customized 'missing' script.

---
 package/binutils/binutils.mk | 11 ++++++++++-
 1 file changed, 10 insertions(+), 1 deletion(-)
package/binutils/binutils.mk +10 -1
index 0f75c1d..799f083 100644
@@ -52,10 +52,19 @@ BINUTILS_CONF_OPTS = \
 	$(BINUTILS_EXTRA_CONFIG_OPTIONS)
 
 # Don't build documentation. It takes up extra space / build time,
-# and sometimes needs specific makeinfo versions to work
+# and sometimes needs specific makeinfo versions to work.
 BINUTILS_CONF_ENV += ac_cv_prog_MAKEINFO=missing
 HOST_BINUTILS_CONF_ENV += ac_cv_prog_MAKEINFO=missing
 
+# Since binutils use an updated version of the 'missing' script from automake
+# >= v1.12b, use our customized version.
+define BINUTILS_DISABLE_DOC
+	rm -f $(@D)/missing
+	ln -s $(TOPDIR)/support/scripts/missing $(@D)/missing
+endef
+BINUTILS_PRE_CONFIGURE_HOOKS += BINUTILS_DISABLE_DOC
+HOST_BINUTILS_PRE_CONFIGURE_HOOKS += BINUTILS_DISABLE_DOC
+
 # Install binutils after busybox to prefer full-blown utilities
 ifeq ($(BR2_PACKAGE_BUSYBOX),y)
 BINUTILS_DEPENDENCIES += busybox
Signature · 1 line
2.5.0