build-aux: require GNU grep on FreeBSD

FreeBSD 13.x and newer ship BSD grep which apparently has some
performance issues causing certain syntax check tests to run longer than
the default 30 seconds timeout used by meson.

However, GNU grep is still available through the textproc/gnugrep port,
so require it on FreeBSD if /usr/bin/grep is a BSD grep to make checks
pass in a reasonable time.

Signed-off-by: Roman Bogorodskiy <bogorodskiy@gmail.com>
Reviewed-by: Ján Tomko <jtomko@redhat.com>
This commit is contained in:
Roman Bogorodskiy 2021-03-02 18:31:36 +04:00
parent e7bd2f6a73
commit 7dd7ddac50
3 changed files with 21 additions and 7 deletions

View File

@ -5,6 +5,7 @@ top_builddir = @top_builddir@
FLAKE8 = @flake8_path@
RUNUTF8 = @runutf8@
PYTHON = @PYTHON3@
GREP = @GREP@
# include syntax-check.mk file
include $(top_srcdir)/build-aux/syntax-check.mk

View File

@ -10,18 +10,32 @@ syntax_check_conf.set('flake8_path', flake8_path)
syntax_check_conf.set('runutf8', ' '.join(runutf8))
syntax_check_conf.set('PYTHON3', python3_prog.path())
grep_prog = find_program('grep')
if host_machine.system() == 'freebsd'
make_prog = find_program('gmake')
grep_cmd = run_command(grep_prog, '--version')
if grep_cmd.stdout().startswith('grep (BSD grep')
grep_prog = find_program('/usr/local/bin/grep')
grep_cmd = run_command(grep_prog, '--version')
if grep_cmd.stdout().startswith('grep (BSD grep')
error('GNU grep not found')
endif
endif
else
make_prog = find_program('make')
endif
syntax_check_conf.set('GREP', grep_prog.path())
configure_file(
input: 'Makefile.in',
output: '@BASENAME@',
configuration: syntax_check_conf,
)
if host_machine.system() == 'freebsd'
make_prog = find_program('gmake')
else
make_prog = find_program('make')
endif
rc = run_command(
'sed', '-n',
's/^\\(sc_[a-zA-Z0-9_-]*\\):.*/\\1/p',

View File

@ -27,7 +27,6 @@ ME := build-aux/syntax-check.mk
# of the module description. But some packages import this file directly,
# ignoring the module description.
AWK ?= awk
GREP ?= grep
# FreeBSD (and probably some other OSes too) ships own version of sed(1), not
# compatible with the GNU sed. GNU sed is available as gsed(1), so use this
# instead