homebrew-core/Formula/zeromq.rb
2016-11-02 01:51:44 -07:00

73 lines
2 KiB
Ruby

class Zeromq < Formula
desc "High-performance, asynchronous messaging library"
homepage "http://www.zeromq.org/"
url "https://github.com/zeromq/zeromq4-1/releases/download/v4.1.6/zeromq-4.1.6.tar.gz"
sha256 "02ebf60a43011e770799336365bcbce2eb85569e9b5f52aa0d8cc04672438a0a"
bottle do
cellar :any
sha256 "645c9105c89e648da736ce466dccbdf9b87c3b3a6cd6d57d7d7ca43876661232" => :sierra
sha256 "b7dcf178923f7f1e47f69c2d01ca8b810e5b22c23f1af9dc9c88765e3fbe3d26" => :el_capitan
sha256 "78c24719c7c8dbba157ca225b41d515190281eb27549caaa60a359ec9f33e3f1" => :yosemite
end
head do
url "https://github.com/zeromq/libzmq.git"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
end
option :universal
option "with-libpgm", "Build with PGM extension"
option "with-norm", "Build with NORM extension"
deprecated_option "with-pgm" => "with-libpgm"
depends_on "pkg-config" => :build
depends_on "libpgm" => :optional
depends_on "libsodium" => :optional
depends_on "norm" => :optional
def install
ENV.universal_binary if build.universal?
args = ["--disable-dependency-tracking", "--prefix=#{prefix}"]
if build.with? "libpgm"
# Use HB libpgm-5.2 because their internal 5.1 is b0rked.
ENV["pgm_CFLAGS"] = `pkg-config --cflags openpgm-5.2`.chomp
ENV["pgm_LIBS"] = `pkg-config --libs openpgm-5.2`.chomp
args << "--with-pgm"
end
if build.with? "libsodium"
args << "--with-libsodium"
else
args << "--without-libsodium"
end
args << "--with-norm" if build.with? "norm"
system "./autogen.sh" if build.head?
system "./configure", *args
system "make"
system "make", "install"
end
test do
(testpath/"test.c").write <<-EOS.undent
#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