homebrew-core/Formula/zeromq.rb

71 lines
2.1 KiB
Ruby

class Zeromq < Formula
desc "High-performance, asynchronous messaging library"
homepage "http://www.zeromq.org/"
url "https://github.com/zeromq/libzmq/releases/download/v4.2.3/zeromq-4.2.3.tar.gz"
sha256 "8f1e2b2aade4dbfde98d82366d61baef2f62e812530160d2e6d0a5bb24e40bc0"
bottle do
cellar :any
sha256 "6977c4c28e6bf87938395821f6447316188de80fa61142a6256c218e3cf1f77c" => :high_sierra
sha256 "f1c00c7dd7aa192dd5d88bce737902b4530796259b535adf6e391c1f69a67970" => :sierra
sha256 "6b6abaf6b8466e97605de55d9158e54dd847a09635d0bee1ea00fed93e6f04d7" => :el_capitan
end
head do
url "https://github.com/zeromq/libzmq.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
option "with-libpgm", "Build with PGM extension"
option "with-norm", "Build with NORM extension"
option "with-drafts", "Build and install draft classes and methods"
deprecated_option "with-pgm" => "with-libpgm"
depends_on "asciidoc" => :build
depends_on "pkg-config" => :build
depends_on "xmlto" => :build
depends_on "libpgm" => :optional
depends_on "libsodium" => :optional
depends_on "norm" => :optional
def install
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog"
args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
args << "--with-pgm" if build.with? "libpgm"
args << "--with-libsodium" if build.with? "libsodium"
args << "--with-norm" if build.with? "norm"
args << "--enable-drafts" if build.with?("drafts")
ENV["LIBUNWIND_LIBS"] = "-framework System"
sdk = MacOS::CLT.installed? ? "" : MacOS.sdk_path
ENV["LIBUNWIND_CFLAGS"] = "-I#{sdk}/usr/include"
system "./autogen.sh" if build.head?
system "./configure", *args
system "make"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <assert.h>
#include <zmq.h>
int main()
{
zmq_msg_t query;
assert(0 == zmq_msg_init_size(&query, 1));
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-lzmq", "-o", "test"
system "./test"
end
end