libmill 1.0; import from dev-only
Closes Homebrew/homebrew#45512. Signed-off-by: Baptiste Fontaine <batifon@yahoo.fr>
This commit is contained in:
parent
94dbc2d8d0
commit
b8af4baba2
1 changed files with 43 additions and 0 deletions
43
Formula/libmill.rb
Normal file
43
Formula/libmill.rb
Normal file
|
@ -0,0 +1,43 @@
|
|||
class Libmill < Formula
|
||||
desc "Go-style concurrency in C"
|
||||
homepage "http://libmill.org/"
|
||||
url "http://libmill.org/libmill-1.0.tar.gz"
|
||||
sha256 "746fd55c4ae31b8c2142c9a413a4dacfb47e3db970ec7ea5bc4053525f9c12e0"
|
||||
head "https://github.com/sustrik/libmill.git"
|
||||
|
||||
depends_on "autoconf" => :build
|
||||
depends_on "automake" => :build
|
||||
depends_on "libtool" => :build
|
||||
depends_on "cmake" => :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 <stdio.h>
|
||||
#include <libmill.h>
|
||||
|
||||
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
|
Loading…
Reference in a new issue