]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
build-aux: require GNU grep on FreeBSD
authorRoman Bogorodskiy <bogorodskiy@gmail.com>
Tue, 2 Mar 2021 14:31:36 +0000 (18:31 +0400)
committerRoman Bogorodskiy <bogorodskiy@gmail.com>
Thu, 4 Mar 2021 15:17:15 +0000 (19:17 +0400)
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>
build-aux/Makefile.in
build-aux/meson.build
build-aux/syntax-check.mk

index 0424ff39fc176bc2382ea1f0ceced2f3cdb95186..415a8df30574567da3e62682241180b6fe41f373 100644 (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
index c506feefd2119c989caaabf70fae741bb770baca..c44ed6821cd4f8a0bffe97391d8574c76b298696 100644 (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())
 
-configure_file(
-  input: 'Makefile.in',
-  output: '@BASENAME@',
-  configuration: syntax_check_conf,
-)
+
+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,
+)
+
 rc = run_command(
   'sed', '-n',
   's/^\\(sc_[a-zA-Z0-9_-]*\\):.*/\\1/p',
index e1ccb7498671a3be1d38d024b84baaefddb30cb0..2f4f932a5b71dabdc2c948757647d458bbab1cc4 100644 (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