Skip to content

Commit d1d3a3f

Browse files
macOS: Replace grep -P with perl invocation
macOS has an old grep, which doesn't support option -P and hence Perl-style regular expressions. One option to solve this is to require macOS users to install GNU grep with Homebrew and then use ggrep on those systems, however I've preferred instead to use perl directly, in part because I find that Perl expression is actually more readable than grep one, even if more verbose. Signed-off-by: Anton Kolesov <[email protected]>
1 parent 4b412ec commit d1d3a3f

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

build-all.sh

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -915,12 +915,10 @@ if [ $DO_PDF = --pdf ]; then
915915
# Texi is a major source of toolchain build errors -- PDF regularly do not
916916
# work with particular versions of texinfo, but work with others. To
917917
# workaround those issues build scripts should be aware of texi version.
918-
export TEXINFO_VERSION_MAJOR=$(texi2pdf --version | grep -Po '(?<=Texinfo )[0-9]+')
919-
# Grep perl look-behind expressions must have a fixed length, so to future
920-
# proof for texinfo versions 10+, we have to read variable, because that
921-
# wouldn't work: (?<=Texinfo [0-9]+\.)
922-
export TEXINFO_VERSION_MINOR=$(texi2pdf --version |
923-
grep -Po "(?<=Texinfo $TEXINFO_VERSION_MAJOR\.)[0-9]+")
918+
export TEXINFO_VERSION_MAJOR=$(texi2pdf --version | \
919+
perl -ne 'print $1 if /Texinfo ([0-9]+)/')
920+
export TEXINFO_VERSION_MINOR=$(texi2pdf --version | \
921+
perl -ne 'print $2 if /Texinfo ([0-9]+)\.([0-9]+)/')
924922

925923
# There are issues with Texinfo v4 and non-C locales.
926924
# See http://lists.gnu.org/archive/html/bug-texinfo/2010-03/msg00031.html

0 commit comments

Comments
 (0)