binutils-gdb/gdb/doc/makeinfo-wrapper.sh
Tom de Vries 0c8be8e9c4 [gdb/build] Require makeinfo 5.0
Building GDB documentation in the info format requires makeinfo 5.0 [1].

Bail out when trying to use an older makeinfo version.

I tested this by requiring 7.0 in two setups that have respectively makeinfo
7.1 and 6.5.

In the 7.1 case I got (make output):
...
makeinfo-wrapper.sh 7 0 makeinfo ... -o gdb.info gdb/doc/gdb.texinfo
makeinfo-wrapper.sh 7 0 makeinfo ... -o annotate.info gdb/doc/annotate.texinfo
rluser.texi:2: warning: @setfilename after the first element
...
and in the 6.5 case I got instead:
...
makeinfo-wrapper.sh 7 0 makeinfo ... -o gdb.info gdb/doc/gdb.texinfo
makeinfo-wrapper.sh 7 0 makeinfo ... -o annotate.info gdb/doc/annotate.texinfo
makeinfo is too old, have 6.5, require 7.0.  Info documentation will not be build.
makeinfo is too old, have 6.5, require 7.0.  Info documentation will not be build.
...

Checked new file gdb/doc/makeinfo-wrapper.sh with shellcheck.

Changes in v2:
- handle version line 'texi2any (GNU texinfo) 7.2.90+nc'

Changes in v3:
- handle version line 'texi2any (GNU texinfo) 5.0+dev'

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33870
2026-02-17 15:31:32 +01:00

44 lines
1.5 KiB
Bash
Executable file

#!/bin/sh
# Copyright (C) 2026 Free Software Foundation, Inc.
# 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 3 of the License, 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/>.
# Wrapper around makeinfo to check makeinfo version.
required_major="$1"
required_minor="$2"
prog="$3"
shift 3
major=$("$prog" --version \
| grep "GNU texinfo" \
| sed 's/^.* \([0-9][0-9]*\)\.[0-9][0-9]*\(.*\)\?$/\1/')
minor=$("$prog" --version \
| grep "GNU texinfo" \
| sed 's/^.* [0-9][0-9]*\.\([0-9][0-9]*\)\(.*\)\?$/\1/')
if [ "$major" = "" ] || [ "$major" = "" ]; then
echo "Cannot determine makeinfo version for $prog. Info documentation will not be build."
exit
fi
if [ "$major" -lt "$required_major" ] \
|| { [ "$major" -eq "$required_major" ] \
&& [ "$minor" -lt "$required_minor" ]; }; then
echo "$prog is too old, have $major.$minor, require $required_major.$required_minor. Info documentation will not be build."
exit
fi
exec "$prog" "$@"