homebrew-core/Formula/libuv.rb
2018-06-24 06:53:06 -07:00

60 lines
1.8 KiB
Ruby

class Libuv < Formula
desc "Multi-platform support library with a focus on asynchronous I/O"
homepage "https://github.com/libuv/libuv"
url "https://github.com/libuv/libuv/archive/v1.21.0.tar.gz"
sha256 "c6f53e4a75d2601db8efe0e837839969de7667d36569110429a0bc8f8229bf59"
head "https://github.com/libuv/libuv.git", :branch => "v1.x"
bottle do
cellar :any
sha256 "4293522be5ff8ef2188e7caf96e88bfd005d1d3a5ff8995a4e6bb154589c5502" => :high_sierra
sha256 "14a4c33369cf44d3eaab60ceb8b1afd105e1a436132ae435d411b607b0fc25eb" => :sierra
sha256 "8891886d64a1dda646f2d3f50545981dfb3161fb1d636eb61700f80da1dd0dee" => :el_capitan
end
option "with-test", "Execute compile time checks (Requires Internet connection)"
deprecated_option "with-check" => "with-test"
depends_on "pkg-config" => :build
depends_on "automake" => :build
depends_on "autoconf" => :build
depends_on "libtool" => :build
depends_on "sphinx-doc" => :build
def install
# This isn't yet handled by the make install process sadly.
cd "docs" do
system "make", "man"
system "make", "singlehtml"
man1.install "build/man/libuv.1"
doc.install Dir["build/singlehtml/*"]
end
system "./autogen.sh"
system "./configure", "--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make"
system "make", "check" if build.with? "test"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <uv.h>
#include <stdlib.h>
int main()
{
uv_loop_t* loop = malloc(sizeof *loop);
uv_loop_init(loop);
uv_loop_close(loop);
free(loop);
return 0;
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-luv", "-o", "test"
system "./test"
end
end