git: f515b0e657e7 - main - textproc/gnugrep: add missing dependency, build with --program-prefix=g

From: Alexey Dokuchaev <danfe_at_FreeBSD.org>
Date: Thu, 11 Aug 2022 10:15:11 UTC
The branch main has been updated by danfe:

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

commit f515b0e657e7bd11d88725e9bc3cb1ccb3706baa
Author:     Alexey Dokuchaev <danfe@FreeBSD.org>
AuthorDate: 2022-08-11 10:13:08 +0000
Commit:     Alexey Dokuchaev <danfe@FreeBSD.org>
CommitDate: 2022-08-11 10:13:08 +0000

    textproc/gnugrep: add missing dependency, build with --program-prefix=g
    
    - Add run-time dependency on `textproc/groff': the manual page won't be
      rendered if groff(1) is not installed;
    - By popular demand, configure the port with `--program-prefix=g' as we
      do for other GNU utilities.  This places the binaries within the same
      namespace more consistently; several other non-GNU/Linux systems, e.g.
      NetBSD, OpenBSD, Solaris, macOS (Homebrew) are doing the same.  Avoid
      POLA violation by creating traditionally named compatibility symlinks.
    
    PR:     263275, 265729
---
 textproc/gnugrep/Makefile  | 9 +++++++++
 textproc/gnugrep/pkg-plist | 9 ++++++---
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/textproc/gnugrep/Makefile b/textproc/gnugrep/Makefile
index 914bc036b3d0..9534e9ff6289 100644
--- a/textproc/gnugrep/Makefile
+++ b/textproc/gnugrep/Makefile
@@ -1,5 +1,6 @@
 PORTNAME=	grep
 PORTVERSION=	3.7
+PORTREVISION=	1
 CATEGORIES=	textproc
 MASTER_SITES=	GNU
 PKGNAMEPREFIX=	gnu
@@ -11,8 +12,11 @@ LICENSE=	GPLv3+
 
 CONFLICTS=	bsd-grep
 
+RUN_DEPENDS=	groff:textproc/groff
+
 USES=		charsetfix cpe tar:xz
 GNU_CONFIGURE=	yes
+CONFIGURE_ARGS=	--program-prefix=g
 TEST_TARGET=	check
 
 INFO=		grep
@@ -46,4 +50,9 @@ post-patch-NLS-off:
 	@${REINPLACE_CMD} '/install-exec-local:/s/install-exec-localcharset//' \
 		${WRKSRC}/lib/Makefile.in
 
+post-install:
+.for p in grep egrep fgrep
+	${LN} -sf g${p} ${STAGEDIR}${PREFIX}/bin/${p}
+.endfor
+
 .include <bsd.port.mk>
diff --git a/textproc/gnugrep/pkg-plist b/textproc/gnugrep/pkg-plist
index 6d59dd1baef0..499828b03cb5 100644
--- a/textproc/gnugrep/pkg-plist
+++ b/textproc/gnugrep/pkg-plist
@@ -1,9 +1,12 @@
 bin/egrep
 bin/fgrep
+bin/gegrep
+bin/gfgrep
+bin/ggrep
 bin/grep
-man/man1/egrep.1.gz
-man/man1/fgrep.1.gz
-man/man1/grep.1.gz
+man/man1/gegrep.1.gz
+man/man1/gfgrep.1.gz
+man/man1/ggrep.1.gz
 %%NLS%%share/locale/af/LC_MESSAGES/grep.mo
 %%NLS%%share/locale/be/LC_MESSAGES/grep.mo
 %%NLS%%share/locale/bg/LC_MESSAGES/grep.mo