class Libmill < Formula desc "Go-style concurrency in C" homepage "http://libmill.org/" url "http://libmill.org/libmill-1.17.tar.gz" sha256 "ada513275d8d5a2ce98cdbc47ad491bfb10f5e9a5429656e539a5889f863042d" head "https://github.com/sustrik/libmill.git" bottle do cellar :any sha256 "87f7c6a68ad1018d2a8b11eacba35a9e1414ade0f8044d40103c0c89e42c7324" => :sierra sha256 "a96990618d70fd944a8b80f61ab73aa4407ef6873bfa3bf9ca4b6bad066a762f" => :el_capitan sha256 "fe7866efb6ec01c4cdd85f0844b38b1218e2807343cc4e885ed21bb4aed624a3" => :yosemite end depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build def install system "./autogen.sh" if build.head? system "./configure", "--prefix=#{prefix}" system "make", "all", "check", "install" end test do (testpath/"test.c").write <<-EOS.undent #include #include void worker(int count, const char *text) { int i; for(i = 0; i != count; ++i) { printf("%s\\n", text); msleep(10); } } int main() { go(worker(4, "a")); go(worker(2, "b")); go(worker(3, "c")); msleep(100); return 0; } EOS system ENV.cc, "test.c", "-L#{lib}", "-lmill", "-o", "test" system "./test" end end