2017-01-12 17:23:54 +00:00
|
|
|
class Cnats < Formula
|
|
|
|
desc "C client for the NATS messaging system"
|
|
|
|
homepage "https://github.com/nats-io/cnats"
|
2017-05-18 17:21:05 +00:00
|
|
|
url "https://github.com/nats-io/cnats/archive/v1.6.0.tar.gz"
|
|
|
|
sha256 "ce2eb48ac9fa6e89cacb3271f06780a2161c9b7f71dc520e09d4b1b0c4091dd8"
|
2017-01-12 17:23:54 +00:00
|
|
|
|
2017-01-15 11:58:50 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2017-05-18 17:31:19 +00:00
|
|
|
sha256 "bcae1cd8aa2f660206b91d2493e4d8d2c62d37f35e4831e15bc4276d542e0d3c" => :sierra
|
|
|
|
sha256 "2cb0cff286bad7230ba159f1d44f5b19a8d00078600ebe1110f4070e979fc09b" => :el_capitan
|
|
|
|
sha256 "f9d09b229aa310ce11c6e19582b7905fd3e2f59200c4e985050377af9675ed55" => :yosemite
|
2017-01-15 11:58:50 +00:00
|
|
|
end
|
|
|
|
|
2017-01-12 17:23:54 +00:00
|
|
|
depends_on "cmake" => :build
|
|
|
|
depends_on "libevent" => :optional
|
|
|
|
depends_on "libuv" => :optional
|
|
|
|
depends_on "openssl"
|
|
|
|
|
|
|
|
def install
|
|
|
|
local_cmake_args = ["-DNATS_INSTALL_PREFIX=#{prefix}", "-DBUILD_TESTING=OFF"]
|
|
|
|
system "cmake", ".", *local_cmake_args, *std_cmake_args
|
|
|
|
system "make", "install"
|
|
|
|
end
|
|
|
|
|
|
|
|
test do
|
|
|
|
(testpath/"test.c").write <<-EOS.undent
|
2017-05-18 17:21:05 +00:00
|
|
|
#include <nats/nats.h>
|
2017-01-12 17:23:54 +00:00
|
|
|
#include <stdio.h>
|
|
|
|
int main() {
|
|
|
|
printf("%s\\n", nats_GetVersion());
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
EOS
|
|
|
|
system ENV.cc, "test.c", "-L#{lib}", "-lnats", "-o", "test"
|
|
|
|
test_version = shell_output "./test", 0
|
|
|
|
assert_equal version, test_version.strip
|
|
|
|
end
|
|
|
|
end
|