On Jun 27, 2018, at 15:25, Rainer Müller wrote:

> Just to add to the previous discussion, /usr/bin/grep used to be
> GNU grep on older versions of macOS. That is probably the reason why it
> does not implement the g* prefix like the other ports for GNU tools yet.
> 
> On 2018-06-27 21:14, George Plymale II wrote:
>> I noticed that most of them have build dependencies which are declared
>> like so:
>> 
>> depends_build   bin:grep:grep
>> 
>> If my understanding of `depends_build' is correct, these ports aren't
>> really relying on the grep port, right? Since the system /usr/bin/grep
>> will be found first, the grep port won't even be installed so isn't this
>> redundant? I feel like I'm missing something here.
> 
> The grep port will only be installed if the grep binary is not available
> in PATH. On macOS, it is available at /usr/bin/grep, so the grep port is
> not needed. If the grep port is installed, ${prefix}/bin/grep will
> always be used as it comes first in PATH. This dependency declaration
> also allows the use of ${prefix}/bin/grep in trace mode as opposed to
> forcing /usr/bin/grep.

A port that declares a dependency "bin:grep:grep" is making the statement "if 
the grep binary does not already exist, install the grep port, which will 
provide the grep binary". That statement becomes false if we implement George's 
/ Blair's suggestion of having the grep port install the binary as "ggrep" 
instead.

Do all of the ports that declare the dependency "bin:grep:grep" already know 
that they should alternately look for a binary called "ggrep"? I don't know, 
and figuring that out and making any necessary adjustments to the programs 
and/or their build systems would be part of the task. Possible adjustments that 
could me made would include modifying e.g. configure scripts to check for ggrep 
in addition to grep, or modifying the PATH seen by configure scripts to add 
/opt/local/libexec/gnubin so that the "grep" binary there is found, or changing 
the dependency to "port:grep" and modifying the port to always look for a 
binary "ggrep" instead of "grep".



Reply via email to