Wed Nov 16 12:12:46 2022 UTC ()
mk: Avoid egrep/fgrep wrappers when using GNU grep.

A recent GNU grep release has started to add obnoxious warnings when calling
egrep/fgrep, so use grep with -E or -F flags respectively to avoid them.


(jperkin)
diff -r1.295 -r1.296 pkgsrc/mk/tools/replace.mk

cvs diff -r1.295 -r1.296 pkgsrc/mk/tools/replace.mk (expand / switch to unified diff)

--- pkgsrc/mk/tools/replace.mk 2022/07/24 14:47:00 1.295
+++ pkgsrc/mk/tools/replace.mk 2022/11/16 12:12:46 1.296
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: replace.mk,v 1.295 2022/07/24 14:47:00 wiz Exp $ 1# $NetBSD: replace.mk,v 1.296 2022/11/16 12:12:46 jperkin Exp $
2# 2#
3# Copyright (c) 2005 The NetBSD Foundation, Inc. 3# Copyright (c) 2005 The NetBSD Foundation, Inc.
4# All rights reserved. 4# All rights reserved.
5# 5#
6# This code is derived from software contributed to The NetBSD Foundation 6# This code is derived from software contributed to The NetBSD Foundation
7# by Johnny C. Lam. 7# by Johnny C. Lam.
8# 8#
9# Redistribution and use in source and binary forms, with or without 9# Redistribution and use in source and binary forms, with or without
10# modification, are permitted provided that the following conditions 10# modification, are permitted provided that the following conditions
11# are met: 11# are met:
12# 1. Redistributions of source code must retain the above copyright 12# 1. Redistributions of source code must retain the above copyright
13# notice, this list of conditions and the following disclaimer. 13# notice, this list of conditions and the following disclaimer.
14# 2. Redistributions in binary form must reproduce the above copyright 14# 2. Redistributions in binary form must reproduce the above copyright
@@ -988,30 +988,33 @@ TOOLS_PATH.[= ${LOCALBASE}/bin/g[ @@ -988,30 +988,33 @@ TOOLS_PATH.[= ${LOCALBASE}/bin/g[
988# These tools are all supplied by the textproc/grep package if there is 988# These tools are all supplied by the textproc/grep package if there is
989# no native tool available. If explicit GNU versions are requested via 989# no native tool available. If explicit GNU versions are requested via
990# "ggrep" then they are preferred. 990# "ggrep" then they are preferred.
991# 991#
992_TOOLS.grep= egrep fgrep grep 992_TOOLS.grep= egrep fgrep grep
993 993
994.if !defined(TOOLS_IGNORE.ggrep) && !empty(_USE_TOOLS:Mggrep) 994.if !defined(TOOLS_IGNORE.ggrep) && !empty(_USE_TOOLS:Mggrep)
995. if !empty(PKGPATH:Mtextproc/grep) 995. if !empty(PKGPATH:Mtextproc/grep)
996MAKEFLAGS+= TOOLS_IGNORE.ggrep= 996MAKEFLAGS+= TOOLS_IGNORE.ggrep=
997. elif !empty(_TOOLS_USE_PKGSRC.ggrep:M[yY][eE][sS]) 997. elif !empty(_TOOLS_USE_PKGSRC.ggrep:M[yY][eE][sS])
998TOOLS_DEPENDS.ggrep?= grep>=2.5.1:../../textproc/grep 998TOOLS_DEPENDS.ggrep?= grep>=2.5.1:../../textproc/grep
999. for _t_ in ${_TOOLS.grep} 999. for _t_ in ${_TOOLS.grep}
1000TOOLS_CREATE+= g${_t_} 1000TOOLS_CREATE+= g${_t_}
1001TOOLS_PATH.${_t_}= ${LOCALBASE}/bin/g${_t_} 1001TOOLS_PATH.${_t_}= ${LOCALBASE}/bin/ggrep
1002TOOLS_PATH.g${_t_}= ${LOCALBASE}/bin/g${_t_} 1002TOOLS_PATH.g${_t_}= ${LOCALBASE}/bin/ggrep
1003TOOLS_ALIASES.g${_t_}= ${_t_} 
1004. endfor 1003. endfor
 1004TOOLS_ARGS.egrep= -E
 1005TOOLS_ARGS.gegrep= -E
 1006TOOLS_ARGS.fgrep= -F
 1007TOOLS_ARGS.gfgrep= -F
1005. endif 1008. endif
1006.else 1009.else
1007. for _t_ in ${_TOOLS.grep} 1010. for _t_ in ${_TOOLS.grep}
1008. if !defined(TOOLS_IGNORE.${_t_}) && !empty(_USE_TOOLS:M${_t_}) 1011. if !defined(TOOLS_IGNORE.${_t_}) && !empty(_USE_TOOLS:M${_t_})
1009. if !empty(PKGPATH:Mtextproc/grep) 1012. if !empty(PKGPATH:Mtextproc/grep)
1010MAKEFLAGS+= TOOLS_IGNORE.${_t_}= 1013MAKEFLAGS+= TOOLS_IGNORE.${_t_}=
1011. elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS]) 1014. elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
1012TOOLS_DEPENDS.${_t_}?= grep>=2.5.1:../../textproc/grep 1015TOOLS_DEPENDS.${_t_}?= grep>=2.5.1:../../textproc/grep
1013TOOLS_CREATE+= ${_t_} 1016TOOLS_CREATE+= ${_t_}
1014TOOLS_PATH.${_t_}= ${LOCALBASE}/bin/g${_t_} 1017TOOLS_PATH.${_t_}= ${LOCALBASE}/bin/g${_t_}
1015. endif 1018. endif
1016. endif 1019. endif
1017. endfor 1020. endfor