libdill 2.3 (new formula)

Closes #24134.

Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
Caleb Xu 2017-12-27 17:51:10 -05:00 committed by FX Coudert
parent 0356a90628
commit e285e1a318

43
Formula/libdill.rb Normal file
View file

@ -0,0 +1,43 @@
class Libdill < Formula
desc "Structured concurrency in C"
homepage "http://libdill.org/"
url "https://github.com/sustrik/libdill/archive/2.3.tar.gz"
sha256 "f83cba87b1b0d1a8ad0f6345c448c14dee685ee733f3c3ee93f2321acc1bd083"
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
def install
system "./autogen.sh"
system "./configure", "--disable-debug",
"--disable-dependency-tracking",
"--disable-silent-rules",
"--prefix=#{prefix}"
system "make", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <libdill.h>
#include <stdio.h>
#include <stdlib.h>
coroutine void worker(const char *text) {
while(1) {
printf("%s\\n", text);
msleep(now() + random() % 500);
}
}
int main() {
go(worker("Hello!"));
go(worker("World!"));
msleep(now() + 5000);
return 0;
}
EOS
system ENV.cc, "-I#{include}", "-L#{lib}", "-ldill", "-o", "test", "test.c"
system "./test"
end
end