homebrew-core/Formula/grpc.rb

82 lines
2.2 KiB
Ruby

class Grpc < Formula
desc "Next generation open source RPC library and framework"
homepage "https://grpc.io/"
url "https://github.com/grpc/grpc.git",
tag: "v1.32.0",
revision: "414bb8322de2411eee1f4e841ff29d887bec7884",
shallow: false
license "Apache-2.0"
revision 1
head "https://github.com/grpc/grpc.git"
livecheck do
url "https://github.com/grpc/grpc/releases/latest"
regex(%r{href=.*?/tag/v?(\d+(?:\.\d+)+)["' >]}i)
end
bottle do
cellar :any
rebuild 1
sha256 "0588400a642f91dc3a04a51af045f20f47babc301f87ba8ffa5c7493c2e618a7" => :catalina
sha256 "69135cd3114f1ea57d34be778a992c0e56e9d01253d8f48966e6f5cd51ccf6d3" => :mojave
sha256 "47ccc49dab77f9844283f1edd05a82a4ae64b8f86fd8943b6580ee9fe4abf915" => :high_sierra
end
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "cmake" => :build
depends_on "libtool" => :build
depends_on "abseil"
depends_on "c-ares"
depends_on "gflags"
depends_on "openssl@1.1"
depends_on "protobuf"
depends_on "re2"
def install
mkdir "cmake/build" do
args = %w[
../..
-DBUILD_SHARED_LIBS=ON
-DgRPC_BUILD_TESTS=OFF
-DgRPC_INSTALL=ON
-DgRPC_ABSL_PROVIDER=package
-DgRPC_CARES_PROVIDER=package
-DgRPC_PROTOBUF_PROVIDER=package
-DgRPC_SSL_PROVIDER=package
-DgRPC_ZLIB_PROVIDER=package
-DgRPC_RE2_PROVIDER=package
] + std_cmake_args
system "cmake", *args
system "make", "install"
args = %w[
../..
-DCMAKE_EXE_LINKER_FLAGS=-lgflags
-DCMAKE_SHARED_LINKER_FLAGS=-lgflags
-DBUILD_SHARED_LIBS=ON
-DgRPC_BUILD_TESTS=ON
-DgRPC_GFLAGS_PROVIDER=package
] + std_cmake_args
system "cmake", *args
system "make", "grpc_cli"
bin.install "grpc_cli"
lib.install Dir["libgrpc++_test_config*.dylib"]
end
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