pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/tools mk: Add support for a ggrep tool.



details:   https://anonhg.NetBSD.org/pkgsrc/rev/5078cd630236
branches:  trunk
changeset: 324369:5078cd630236
user:      jperkin <jperkin%pkgsrc.org@localhost>
date:      Wed Oct 17 08:22:19 2018 +0000

description:
mk: Add support for a ggrep tool.

This is for when GNU features are required that aren't available in some
other greps, for example -o or --color.  If ggrep is requested then it
takes precedence over grep/egrep/fgrep and the GNU versions are used for
all three.

BSD grep aims for GNU compatibility so it is anticipated that it can be
used as a native tool to avoid a dependency on textproc/grep on platforms
that provide it.

diffstat:

 mk/tools/replace.mk |  30 ++++++++++++++++++++++--------
 1 files changed, 22 insertions(+), 8 deletions(-)

diffs (52 lines):

diff -r cf9ed293ddd0 -r 5078cd630236 mk/tools/replace.mk
--- a/mk/tools/replace.mk       Wed Oct 17 07:02:06 2018 +0000
+++ b/mk/tools/replace.mk       Wed Oct 17 08:22:19 2018 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: replace.mk,v 1.284 2018/08/22 20:48:37 maya Exp $
+# $NetBSD: replace.mk,v 1.285 2018/10/17 08:22:19 jperkin Exp $
 #
 # Copyright (c) 2005 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -970,21 +970,35 @@
 ######################################################################
 
 # These tools are all supplied by the textproc/grep package if there is
-# no native tool available.
+# no native tool available.  If explicit GNU versions are requested via
+# "ggrep" then they are preferred.
 #
 _TOOLS.grep=   egrep fgrep grep
 
-.for _t_ in ${_TOOLS.grep}
-.  if !defined(TOOLS_IGNORE.${_t_}) && !empty(_USE_TOOLS:M${_t_})
-.    if !empty(PKGPATH:Mtextproc/grep)
+.if !defined(TOOLS_IGNORE.ggrep) && !empty(_USE_TOOLS:Mggrep)
+.  if !empty(PKGPATH:Mtextproc/grep)
+MAKEFLAGS+=            TOOLS_IGNORE.ggrep=
+.  elif !empty(_TOOLS_USE_PKGSRC.ggrep:M[yY][eE][sS])
+TOOLS_DEPENDS.ggrep?=  grep>=2.5.1:../../textproc/grep
+.    for _t_ in ${_TOOLS.grep}
+TOOLS_CREATE+=         g${_t_}
+TOOLS_PATH.g${_t_}=    ${LOCALBASE}/bin/g${_t_}
+TOOLS_ALIASES.g${_t_}= ${_t_}
+.    endfor
+.  endif
+.else
+.  for _t_ in ${_TOOLS.grep}
+.    if !defined(TOOLS_IGNORE.${_t_}) && !empty(_USE_TOOLS:M${_t_})
+.      if !empty(PKGPATH:Mtextproc/grep)
 MAKEFLAGS+=            TOOLS_IGNORE.${_t_}=
-.    elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
+.      elif !empty(_TOOLS_USE_PKGSRC.${_t_}:M[yY][eE][sS])
 TOOLS_DEPENDS.${_t_}?= grep>=2.5.1:../../textproc/grep
 TOOLS_CREATE+=         ${_t_}
 TOOLS_PATH.${_t_}=     ${LOCALBASE}/bin/g${_t_}
+.      endif
 .    endif
-.  endif
-.endfor
+.  endfor
+.endif
 
 ######################################################################
 



Home | Main Index | Thread Index | Old Index