2013-09-17 18:35:50 +00:00
|
|
|
class Nanomsg < Formula
|
2015-05-19 00:00:59 +00:00
|
|
|
desc "Socket library in C"
|
2015-08-03 12:55:31 +00:00
|
|
|
homepage "http://nanomsg.org"
|
2015-08-20 01:21:51 +00:00
|
|
|
url "https://github.com/nanomsg/nanomsg/releases/download/0.6-beta/nanomsg-0.6-beta.tar.gz"
|
|
|
|
sha256 "69e2098446c9cd2c067b5ba38567c9ba30bf861a515b3d0a9302cb21c1167a69"
|
2013-09-17 18:35:50 +00:00
|
|
|
|
2014-11-14 23:00:07 +00:00
|
|
|
bottle do
|
|
|
|
cellar :any
|
2015-08-21 00:16:29 +00:00
|
|
|
revision 1
|
|
|
|
sha256 "4938a9377541b66566101d55b27d13d356f34f0a8426a2cd579cc7349ace824d" => :yosemite
|
|
|
|
sha256 "8a5f9f04595732195ae673d4ff4ca28b8bdc980528b95f8b75a005c472eead28" => :mavericks
|
|
|
|
sha256 "c84dbd9e0f86d2435d1ac94ec7af6ea83f7f11bfa50e3f5d7593c266bfba9ee3" => :mountain_lion
|
2014-11-14 23:00:07 +00:00
|
|
|
end
|
|
|
|
|
2013-09-22 01:47:31 +00:00
|
|
|
head do
|
2015-08-03 12:55:31 +00:00
|
|
|
url "https://github.com/nanomsg/nanomsg.git"
|
2013-09-17 18:35:50 +00:00
|
|
|
|
2014-06-01 01:11:05 +00:00
|
|
|
depends_on "autoconf" => :build
|
|
|
|
depends_on "automake" => :build
|
|
|
|
depends_on "libtool" => :build
|
2013-09-17 18:35:50 +00:00
|
|
|
end
|
|
|
|
|
2015-08-20 19:42:32 +00:00
|
|
|
option "without-test", "Skip verifying the build (Not Recommended)"
|
|
|
|
option "without-doc", "Skip building manpages"
|
2015-08-03 12:55:31 +00:00
|
|
|
option "without-nanocat", "Do not install nanocat tool"
|
|
|
|
option "with-debug", "Compile with debug symbols"
|
2013-09-22 01:47:31 +00:00
|
|
|
|
2015-08-03 12:55:31 +00:00
|
|
|
depends_on "pkg-config" => :build
|
2013-09-17 18:35:50 +00:00
|
|
|
|
2015-08-03 12:55:31 +00:00
|
|
|
if build.with? "doc"
|
|
|
|
depends_on "asciidoc" => :build
|
|
|
|
depends_on "xmlto" => :build
|
2013-09-17 18:35:50 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def install
|
2015-08-03 12:55:31 +00:00
|
|
|
ENV["XML_CATALOG_FILES"] = "#{etc}/xml/catalog" if build.with? "doc"
|
2013-09-17 18:35:50 +00:00
|
|
|
|
2015-08-20 19:42:32 +00:00
|
|
|
args = %W[
|
|
|
|
--disable-dependency-tracking
|
|
|
|
--disable-silent-rules
|
|
|
|
--prefix=#{prefix}
|
|
|
|
]
|
2013-09-17 18:35:50 +00:00
|
|
|
|
2015-08-03 12:55:31 +00:00
|
|
|
args << "--disable-nanocat" if build.without? "nanocat"
|
|
|
|
args << "--enable-debug" if build.with? "debug"
|
|
|
|
args << "--enable-doc" if build.with? "doc"
|
|
|
|
|
2015-08-20 19:42:32 +00:00
|
|
|
system "./autogen.sh" if build.head?
|
2015-08-03 12:55:31 +00:00
|
|
|
system "./configure", *args
|
|
|
|
system "make"
|
2015-08-20 19:42:32 +00:00
|
|
|
system "make", "-j1", "check" if build.bottle? || build.with?("test")
|
2015-08-03 12:55:31 +00:00
|
|
|
system "make", "install"
|
2013-09-17 18:35:50 +00:00
|
|
|
end
|
2015-08-20 19:42:32 +00:00
|
|
|
|
|
|
|
test do
|
|
|
|
bind = "tcp://127.0.0.1:8000"
|
|
|
|
|
|
|
|
pid = fork do
|
|
|
|
exec "#{bin}/nanocat --rep --bind #{bind} --format ascii --data home"
|
|
|
|
end
|
|
|
|
sleep 2
|
|
|
|
|
|
|
|
begin
|
|
|
|
output = shell_output("#{bin}/nanocat --req --connect #{bind} --format ascii --data brew")
|
|
|
|
assert_match /home/, output
|
|
|
|
ensure
|
|
|
|
Process.kill("SIGINT", pid)
|
|
|
|
Process.wait(pid)
|
|
|
|
end
|
|
|
|
end
|
2013-09-17 18:35:50 +00:00
|
|
|
end
|