class Grpc < Formula desc "Next generation open source RPC library and framework" homepage "https://www.grpc.io/" url "https://github.com/grpc/grpc/archive/v1.18.0.tar.gz" sha256 "069a52a166382dd7b99bf8e7e805f6af40d797cfcee5f80e530ca3fc75fd06e2" head "https://github.com/grpc/grpc.git" bottle do sha256 "3783e11c4cb45ca91e26bd638f6f4280d25cb0814f0478980525bc08422940c9" => :mojave sha256 "7b50db8d76643f1d34ae06a32d7942021091aaeed05257f5ff6dbc19d6dc90e3" => :high_sierra sha256 "c45105cc0a7ad77b4ed46b8025a7a3dfa20da120b29fcb017b6d1a8e1610f71e" => :sierra end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build depends_on "c-ares" depends_on "gflags" depends_on "openssl" 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 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