82 lines
2.5 KiB
Ruby
82 lines
2.5 KiB
Ruby
class Wangle < Formula
|
|
desc "Modular, composable client/server abstractions framework"
|
|
homepage "https://github.com/facebook/wangle"
|
|
url "https://github.com/facebook/wangle/releases/download/v2021.03.01.00/wangle-v2021.03.01.00.tar.gz"
|
|
sha256 "3314c0cf79325b48610dac805b9a161c48f11dfb5e31b6c50c3cb1612a1266b2"
|
|
license "Apache-2.0"
|
|
head "https://github.com/facebook/wangle.git"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_big_sur: "f54bb992b1997f05fcb66373852b33089a6e534f1473b4104a0fbbad61e45ace"
|
|
sha256 cellar: :any, big_sur: "bca709b4b07804895cf84298e8a086fee82f050e294ac4bb220c7a8c414fdb84"
|
|
sha256 cellar: :any, catalina: "d2c0d09eba1b8ae06cfd78170d90d9ef96bdc3fb5b47ae6bbfeee4c72adcf7f2"
|
|
sha256 cellar: :any, mojave: "334d82de53bdf65211230301fa72426de599f470618eddb7bd18d4ba885a32e0"
|
|
end
|
|
|
|
depends_on "cmake" => :build
|
|
depends_on "boost"
|
|
depends_on "double-conversion"
|
|
depends_on "fizz"
|
|
depends_on "fmt"
|
|
depends_on "folly"
|
|
depends_on "gflags"
|
|
depends_on "glog"
|
|
depends_on "libevent"
|
|
depends_on "libsodium"
|
|
depends_on "lz4"
|
|
depends_on "openssl@1.1"
|
|
depends_on "snappy"
|
|
depends_on "zstd"
|
|
|
|
uses_from_macos "bzip2"
|
|
uses_from_macos "zlib"
|
|
|
|
def install
|
|
cd "wangle" do
|
|
system "cmake", ".", "-DBUILD_TESTS=OFF", "-DBUILD_SHARED_LIBS=ON", *std_cmake_args
|
|
system "make", "install"
|
|
system "make", "clean"
|
|
system "cmake", ".", "-DBUILD_TESTS=OFF", "-DBUILD_SHARED_LIBS=OFF", *std_cmake_args
|
|
system "make"
|
|
lib.install "lib/libwangle.a"
|
|
|
|
pkgshare.install Dir["example/echo/*.cpp"]
|
|
end
|
|
end
|
|
|
|
test do
|
|
cxx_flags = %W[
|
|
-std=c++14
|
|
-I#{include}
|
|
-I#{Formula["openssl@1.1"].opt_include}
|
|
-L#{Formula["gflags"].opt_lib}
|
|
-L#{Formula["glog"].opt_lib}
|
|
-L#{Formula["folly"].opt_lib}
|
|
-L#{Formula["fizz"].opt_lib}
|
|
-L#{lib}
|
|
-lgflags
|
|
-lglog
|
|
-lfolly
|
|
-lfizz
|
|
-lwangle
|
|
]
|
|
|
|
system ENV.cxx, *cxx_flags, "-o", "EchoClient", pkgshare/"EchoClient.cpp"
|
|
system ENV.cxx, *cxx_flags, "-o", "EchoServer", pkgshare/"EchoServer.cpp"
|
|
|
|
port = free_port
|
|
|
|
fork { exec testpath/"EchoServer", "-port", port.to_s }
|
|
sleep 2
|
|
|
|
require "pty"
|
|
r, w, pid = PTY.spawn(testpath/"EchoClient", "-port", port.to_s)
|
|
w.write "Hello from Homebrew!\nAnother test line.\n"
|
|
sleep 1
|
|
Process.kill("TERM", pid)
|
|
output = r.read
|
|
assert_match("Hello from Homebrew!", output)
|
|
assert_match("Another test line.", output)
|
|
end
|
|
end
|