2017-03-19 18:13:37 +00:00
|
|
|
class Grep < Formula
|
|
|
|
desc "GNU grep, egrep and fgrep"
|
|
|
|
homepage "https://www.gnu.org/software/grep/"
|
2017-07-03 04:23:25 +00:00
|
|
|
url "https://ftp.gnu.org/gnu/grep/grep-3.1.tar.xz"
|
|
|
|
mirror "https://ftpmirror.gnu.org/grep/grep-3.1.tar.xz"
|
|
|
|
sha256 "db625c7ab3bb3ee757b3926a5cfa8d9e1c3991ad24707a83dde8a5ef2bf7a07e"
|
2017-03-19 18:13:37 +00:00
|
|
|
|
|
|
|
bottle do
|
|
|
|
cellar :any
|
2017-09-18 09:53:35 +00:00
|
|
|
sha256 "8dadfa6959ee17790ef8cc578981ede226b29339549c72d26eaaa1c1dab5e0e8" => :high_sierra
|
2017-07-03 04:29:17 +00:00
|
|
|
sha256 "75fd5efc0986b1771c3082e08b9dc2d8495546f81ad1a38a9a05f506c8046687" => :sierra
|
|
|
|
sha256 "867dffadb33d24d4a743df13c95ec08ff526f3be96b4965ae5e97ec08d46192d" => :el_capitan
|
|
|
|
sha256 "72ea449768eb5745712b40464b8eb1e7b9dc908ce26c8353e453681ee824ec89" => :yosemite
|
2017-03-19 18:13:37 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
option "with-default-names", "Do not prepend 'g' to the binary"
|
|
|
|
deprecated_option "default-names" => "with-default-names"
|
|
|
|
|
|
|
|
depends_on "pkg-config" => :build
|
|
|
|
depends_on "pcre"
|
|
|
|
|
|
|
|
def install
|
|
|
|
args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--disable-nls
|
|
|
|
--prefix=#{prefix}
|
|
|
|
--infodir=#{info}
|
|
|
|
--mandir=#{man}
|
|
|
|
--with-packager=Homebrew
|
|
|
|
]
|
|
|
|
|
|
|
|
args << "--program-prefix=g" if build.without? "default-names"
|
|
|
|
|
|
|
|
system "./configure", *args
|
|
|
|
system "make"
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
def caveats
|
2017-10-18 10:10:48 +00:00
|
|
|
if build.without? "default-names" then <<~EOS
|
2017-03-19 18:13:37 +00:00
|
|
|
The command has been installed with the prefix "g".
|
|
|
|
If you do not want the prefix, install using the "with-default-names"
|
|
|
|
option.
|
|
|
|
EOS
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
text_file = testpath/"file.txt"
|
|
|
|
text_file.write "This line should be matched"
|
|
|
|
cmd = build.with?("default-names") ? "grep" : "ggrep"
|
|
|
|
grepped = shell_output("#{bin}/#{cmd} match #{text_file}")
|
|
|
|
assert_match "should be matched", grepped
|
|
|
|
end
|
|
|
|
end
|