git: 1a8a9a832eb5 - main - devel/libvirt: depend on GNU grep(1) in a more robust way

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Sat, 10 May 2025 09:36:05 UTC
The branch main has been updated by danfe:

URL: https://cgit.FreeBSD.org/ports/commit/?id=1a8a9a832eb52cb3bb7ea6453a88451d54ebc597

commit 1a8a9a832eb52cb3bb7ea6453a88451d54ebc597
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2025-05-10 09:33:44 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2025-05-10 09:33:44 +0000

    devel/libvirt: depend on GNU grep(1) in a more robust way
    
    FreeBSD ships native grep(1) implementation in the base for
    quite a while, so don't bother to check its origin and just
    request GNU version explicitly like on Darwin (macOS).
    
    Depending on `/usr/local/bin/grep' is also wrong because of
    the hardcoded prefix and because compatibility symlinks are
    optional (plans are to disable them in the future).
---
 devel/libvirt/Makefile                          |  2 +-
 devel/libvirt/files/patch-build-aux_meson.build | 27 +++++++++++++++++++++++++
 2 files changed, 28 insertions(+), 1 deletion(-)

diff --git a/devel/libvirt/Makefile b/devel/libvirt/Makefile
index 97f20f5b39ac..12c6bae430f8 100644
--- a/devel/libvirt/Makefile
+++ b/devel/libvirt/Makefile
@@ -13,7 +13,7 @@ LICENSE=	LGPL3
 LIB_DEPENDS=	libcurl.so:ftp/curl \
 		libgnutls.so:security/gnutls
 BUILD_DEPENDS=	dnsmasq:dns/dnsmasq \
-		${LOCALBASE}/bin/grep:textproc/gnugrep \
+		ggrep:textproc/gnugrep \
 		gsed:textproc/gsed \
 		rst2html:textproc/py-docutils@${PY_FLAVOR} \
 		xsltproc:textproc/libxslt
diff --git a/devel/libvirt/files/patch-build-aux_meson.build b/devel/libvirt/files/patch-build-aux_meson.build
new file mode 100644
index 000000000000..63e689340bbc
--- /dev/null
+++ b/devel/libvirt/files/patch-build-aux_meson.build
@@ -0,0 +1,27 @@
+--- build-aux/meson.build.orig	2025-05-02 07:25:45 UTC
++++ build-aux/meson.build
+@@ -13,23 +13,10 @@ if git and tests_enabled[0]
+   if host_machine.system() == 'freebsd' or host_machine.system() == 'darwin'
+     make_prog = find_program('gmake')
+     sed_prog = find_program('gsed')
++    grep_prog = find_program('ggrep')
+   else
+     make_prog = find_program('make')
+     sed_prog = find_program('sed')
+-  endif
+-
+-  if host_machine.system() == 'freebsd'
+-    grep_prog = find_program('grep')
+-    grep_cmd = run_command(grep_prog, '--version', check: true)
+-    if grep_cmd.stdout().startswith('grep (BSD grep')
+-      grep_prog = find_program('/usr/local/bin/grep', required: false)
+-      if not grep_prog.found()
+-        error('GNU grep not found')
+-      endif
+-    endif
+-  elif host_machine.system() == 'darwin'
+-    grep_prog = find_program('ggrep')
+-  else
+     grep_prog = find_program('grep')
+   endif
+