homebrew-core/Formula/libdill.rb
2018-04-28 09:13:05 +10:00

50 lines
1.5 KiB
Ruby

class Libdill < Formula
desc "Structured concurrency in C"
homepage "http://libdill.org/"
url "https://github.com/sustrik/libdill/archive/2.8.tar.gz"
sha256 "117038cd0f9bbfc51e6001a28ae6fd915b7c9047d8da7358208792d997037d6d"
bottle do
cellar :any
sha256 "7249c2040cd3a5fd4058ad28e1f2dd25e552ab0a23138776edd445b795099df7" => :high_sierra
sha256 "be553f9e5a9019a013b16d1df66810dd6475cdc4e399e4f91749f3f0f4e6955e" => :sierra
sha256 "052a3fd8d95b2083364dff50f2589801fe0ab64b9cc5d42ad2a2840d4f319e80" => :el_capitan
end
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