72 lines
2 KiB
Ruby
72 lines
2 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.0/czmq-4.1.0.tar.gz"
|
|
sha256 "3befa35b4886b5298e8329b4f0aa5bb9bde0e7439bd3c5c53295cb988371fc11"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "d94e31bd03d2e1b39c9709c26640f06702048b033603824dbc80de808527c4f9" => :high_sierra
|
|
sha256 "152459a284258269a621c46feb6d731acb71b5fb09e9454358e20e4de2511f40" => :sierra
|
|
sha256 "2f7ed27869f798dadf5fefdc0d7534ecec02a7ab6516f62acd4708566b886b7f" => :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
|
|
|
|
option "with-drafts", "Build and install draft classes and methods"
|
|
|
|
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"
|
|
|
|
args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
|
|
args << "--enable-drafts" if build.with? "drafts"
|
|
|
|
system "./autogen.sh" if build.head?
|
|
system "./configure", *args
|
|
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
|