re2 20150501

Closes Homebrew/homebrew#39654.

Signed-off-by: Xu Cheng <xucheng@me.com>
This commit is contained in:
Alex Dunn 2015-05-11 14:43:40 -07:00 committed by Xu Cheng
parent 666fb2c20a
commit 15352b3c55

View file

@ -1,7 +1,8 @@
class Re2 < Formula
homepage "https://github.com/google/re2"
url "https://re2.googlecode.com/files/re2-20140304.tgz"
sha1 "f30dda8e530921b623c32aa58a5dabbe9157f6ca"
url "https://github.com/google/re2/archive/2015-05-01.tar.gz"
sha256 "35c890e61ea3f259940d236b84a5249afb698197897268868fd753ebe088c225"
version "20150501"
head "https://github.com/google/re2.git"
@ -16,11 +17,11 @@ class Re2 < Formula
def install
# https://code.google.com/p/re2/issues/detail?id=99
if ENV.compiler != :clang || MacOS.version < :mavericks
inreplace 'libre2.symbols.darwin',
inreplace "libre2.symbols.darwin",
# operator<<(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, re2::StringPiece const&)
'__ZlsRNSt3__113basic_ostreamIcNS_11char_traitsIcEEEERKN3re211StringPieceE',
"__ZlsRNSt3__113basic_ostreamIcNS_11char_traitsIcEEEERKN3re211StringPieceE",
# operator<<(std::ostream&, re2::StringPiece const&)
'__ZlsRSoRKN3re211StringPieceE'
"__ZlsRSoRKN3re211StringPieceE"
end
system "make", "install", "prefix=#{prefix}"
mv lib/"libre2.so.0.0.0", lib/"libre2.0.0.0.dylib"
@ -28,4 +29,19 @@ class Re2 < Formula
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.undent
#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, "-I#{include}", "-L#{lib}", "-lre2",
testpath/"test.cpp", "-o", "test"
system "./test"
end
end