libdill 2.3 (new formula)
Closes #24134. Signed-off-by: FX Coudert <fxcoudert@gmail.com>
This commit is contained in:
parent
0356a90628
commit
e285e1a318
1 changed files with 43 additions and 0 deletions
43
Formula/libdill.rb
Normal file
43
Formula/libdill.rb
Normal 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
|
Loading…
Reference in a new issue