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.09.12.00/wangle-v2022.09.12.00.tar.gz"
|
|
sha256 "170956d86089b6ab4e52dbae6ca1cecff874d69ea3bf95aa82b00b0833bac24e"
|
|
license "Apache-2.0"
|
|
head "https://github.com/facebook/wangle.git", branch: "master"
|
|
|
|
bottle do
|
|
sha256 cellar: :any, arm64_monterey: "08961cb5f97efefe840962f8205b42f6a1e3d0131c36b86765378fdf73b6ad6d"
|
|
sha256 cellar: :any, arm64_big_sur: "c10f1d2a09150253813effdb8a7ee597a65c7533c44bc2cb77d3a76eb94745b6"
|
|
sha256 cellar: :any, monterey: "66353f39b477871bc0af61d02044c25a0289ba900c7cbac4d4d2a7b31418f163"
|
|
sha256 cellar: :any, big_sur: "71a875dc60d29999796fefa92ff270bee72e902235fc06f5bba6587f0ac3e7f5"
|
|
sha256 cellar: :any, catalina: "d7d5ba88df3e03b58db803a3698f6e49866d2385d9df182b44a325c57822d058"
|
|
sha256 cellar: :any_skip_relocation, x86_64_linux: "90cb80b1c8e3e4a8444f9d11dd7a1bbade4951ecdc49fe1a65cbedd666fc02c6"
|
|
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
|