97 lines
3.1 KiB
Ruby
97 lines
3.1 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/v2022.10.10.00/wangle-v2022.10.10.00.tar.gz"
|
|
sha256 "45242738d1c008b0d76e883cdfe36cf0a8112753b81392e230465044190eb294"
|
|
license "Apache-2.0"
|
|
head "https://github.com/facebook/wangle.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "a57ad567f1f6e919d4d53e1b1e6f9faa4381236e106d466c8d2cf02ee4a2497f"
|
|
sha256 cellar: :any, arm64_big_sur: "db36b29423913b6e517182e8f22821d14fb7b9f7e0ae6834d11d1009a27e53a3"
|
|
sha256 cellar: :any, monterey: "ca1751c0a41f816636b6d3d253b53758a324bd5176dabfe90ce17001a0658d05"
|
|
sha256 cellar: :any, big_sur: "321e0d6945e0f273bcec6fc67d514e280a609f529f7be6080142e4b6ededb089"
|
|
sha256 cellar: :any, catalina: "f5895f578303d6b487d5085dec443a647ded0cb6357273ab272c802f9302e0f6"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "5340ee1438c01b1a4fbb6b4f40bfda2e38d124c0a89b081b14243d19f45ff455"
|
|
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"
|
|
|
|
fails_with gcc: "5"
|
|
|
|
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++17
|
|
-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
|
|
]
|
|
if OS.linux?
|
|
cxx_flags << "-L#{Formula["boost"].opt_lib}"
|
|
cxx_flags << "-lboost_context-mt"
|
|
cxx_flags << "-ldl"
|
|
cxx_flags << "-lpthread"
|
|
end
|
|
|
|
system ENV.cxx, pkgshare/"EchoClient.cpp", *cxx_flags, "-o", "EchoClient"
|
|
system ENV.cxx, pkgshare/"EchoServer.cpp", *cxx_flags, "-o", "EchoServer"
|
|
|
|
port = free_port
|
|
fork { exec testpath/"EchoServer", "-port", port.to_s }
|
|
sleep 10
|
|
|
|
require "pty"
|
|
output = ""
|
|
PTY.spawn(testpath/"EchoClient", "-port", port.to_s) do |r, w, pid|
|
|
w.write "Hello from Homebrew!\nAnother test line.\n"
|
|
sleep 20
|
|
Process.kill "TERM", pid
|
|
begin
|
|
r.each_line { |line| output += line }
|
|
rescue Errno::EIO
|
|
# GNU/Linux raises EIO when read is done on closed pty
|
|
end
|
|
end
|
|
assert_match("Hello from Homebrew!", output)
|
|
assert_match("Another test line.", output)
|
|
end
|
|
end
|