homebrew-core/Formula/re2.rb
2020-01-01 14:23:47 -05:00

39 lines
1.3 KiB
Ruby

class Re2 < Formula
desc "Alternative to backtracking PCRE-style regular expression engines"
homepage "https://github.com/google/re2"
url "https://github.com/google/re2/archive/2020-01-01.tar.gz"
version "20200101"
sha256 "7509a34636b7dd2966f7a34440cee1153983fd61a4bf8f759a4f7781b9ceebaf"
head "https://github.com/google/re2.git"
bottle do
cellar :any
sha256 "eebe26247a98e443c02f2b9cfddbbd5fd5e49435f005db530ba645baa86f6331" => :catalina
sha256 "620e2e371b663ba08f8db374ab07152bd075b7cea1cd8a54dcf8f1552a4d6d67" => :mojave
sha256 "ddd0f9c9099379cdcfb95917da515918e767eee56cce4b779d663ff8efc1c468" => :high_sierra
end
def install
ENV.cxx11
system "make", "install", "prefix=#{prefix}"
MachO::Tools.change_dylib_id("#{lib}/libre2.0.0.0.dylib", "#{lib}/libre2.0.dylib")
lib.install_symlink "libre2.0.0.0.dylib" => "libre2.0.dylib"
lib.install_symlink "libre2.0.0.0.dylib" => "libre2.dylib"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <re2/re2.h>
#include <assert.h>
int main() {
assert(!RE2::FullMatch("hello", "e"));
assert(RE2::PartialMatch("hello", "e"));
return 0;
}
EOS
system ENV.cxx, "-std=c++11", "-I#{include}", "-L#{lib}", "-lre2",
"test.cpp", "-o", "test"
system "./test"
end
end