homebrew-core/Formula/grpc.rb
2019-11-28 12:50:58 -05:00

50 lines
1.5 KiB
Ruby

class Grpc < Formula
desc "Next generation open source RPC library and framework"
homepage "https://grpc.io/"
url "https://github.com/grpc/grpc/archive/v1.25.0.tar.gz"
sha256 "ffbe61269160ea745e487f79b0fd06b6edd3d50c6d9123f053b5634737cf2f69"
revision 1
head "https://github.com/grpc/grpc.git"
bottle do
sha256 "121e8dab5db105879365d17c764a86c4c679ea5382048cb27a877aa2b5e6cd9e" => :catalina
sha256 "5b5a446b37b7b9e23dc4b18eec8597e8d6c50a1fdd04a408e945fdd6949d3ead" => :mojave
sha256 "68680e04a6c8004f8a4a52060d0dec81ba08bce8aa19deb6ab5f59bb87a862f6" => :high_sierra
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "c-ares"
depends_on "gflags"
depends_on "openssl@1.1"
depends_on "protobuf"
resource "gtest" do
url "https://github.com/google/googletest/archive/release-1.8.1.tar.gz"
sha256 "9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c"
end
def install
system "make", "install", "prefix=#{prefix}"
system "make", "install-plugins", "prefix=#{prefix}"
(buildpath/"third_party/googletest").install resource("gtest")
system "make", "grpc_cli", "prefix=#{prefix}"
bin.install "bins/opt/grpc_cli"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <grpc/grpc.h>
int main() {
grpc_init();
grpc_shutdown();
return GRPC_STATUS_OK;
}
EOS
system ENV.cc, "test.cpp", "-I#{include}", "-L#{lib}", "-lgrpc", "-o", "test"
system "./test"
end
end