68 lines
1.9 KiB
Ruby
68 lines
1.9 KiB
Ruby
class Czmq < Formula
|
|
desc "High-level C binding for ZeroMQ"
|
|
homepage "http://czmq.zeromq.org/"
|
|
url "https://github.com/zeromq/czmq/releases/download/v4.1.1/czmq-4.1.1.tar.gz"
|
|
sha256 "f00ff419881dc2a05d0686c8467cd89b4882677fc56f31c0e2cc81c134cbb0c0"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "38d2b6120f6d06c9a45c895f52949a2ddd01f72d7e91d3ff83cd39c954492300" => :mojave
|
|
sha256 "1e414d17fd6c0a4dd9939e84091b5073c23d2477569d12b0ee08d6a425abea14" => :high_sierra
|
|
sha256 "c0b2b82ae2edfa4dc97f48789ed87050dc0fb602e85a2b510fee6336afe17a5c" => :sierra
|
|
sha256 "d6966061fd61f2440713473c4f65bb9fd541be2f3be78e1d3f56ca54d366202e" => :el_capitan
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/zeromq/czmq.git"
|
|
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
depends_on "asciidoc" => :build
|
|
depends_on "pkg-config" => :build
|
|
depends_on "xmlto" => :build
|
|
depends_on "zeromq"
|
|
|
|
def install
|
|
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
|
|
|
|
system "./autogen.sh" if build.head?
|
|
system "./configure", "--disable-dependency-tracking", "--prefix=#{prefix}"
|
|
system "make"
|
|
system "make", "ZSYS_INTERFACE=lo0", "check-verbose"
|
|
system "make", "install"
|
|
rm Dir["#{bin}/*.gsl"]
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <czmq.h>
|
|
|
|
int main(void)
|
|
{
|
|
zsock_t *push = zsock_new_push("inproc://hello-world");
|
|
zsock_t *pull = zsock_new_pull("inproc://hello-world");
|
|
|
|
zstr_send(push, "Hello, World!");
|
|
char *string = zstr_recv(pull);
|
|
puts(string);
|
|
zstr_free(&string);
|
|
|
|
zsock_destroy(&pull);
|
|
zsock_destroy(&push);
|
|
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
flags = ENV.cflags.to_s.split + %W[
|
|
-I#{include}
|
|
-L#{lib}
|
|
-lczmq
|
|
]
|
|
system ENV.cc, "-o", "test", "test.c", *flags
|
|
assert_equal "Hello, World!\n", shell_output("./test")
|
|
end
|
|
end
|