[PATCH] build-aux: require GNU grep on FreeBSD

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 build-aux/Makefile.in     |  1 +
 build-aux/meson.build     | 24 +++++++++++++++++++-----
 build-aux/syntax-check.mk |  1 -
 3 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/build-aux/Makefile.in b/build-aux/Makefile.in
index 0424ff39fc..415a8df305 100644
--- a/build-aux/Makefile.in
+++ b/build-aux/Makefile.in
@@ -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
diff --git a/build-aux/meson.build b/build-aux/meson.build
index c506feefd2..c44ed6821c 100644
--- a/build-aux/meson.build
+++ b/build-aux/meson.build
@@ -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',
diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk
index e51877648a..6f6603fa6f 100644
--- a/build-aux/syntax-check.mk
+++ b/build-aux/syntax-check.mk
@@ -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
-- 
2.30.0




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]

  Powered by Linux