60 lines
1.7 KiB
Ruby
60 lines
1.7 KiB
Ruby
class BdwGc < Formula
|
|
desc "Garbage collector for C and C++"
|
|
homepage "http://www.hboehm.info/gc/"
|
|
url "https://github.com/ivmai/bdwgc/releases/download/v7.6.4/gc-7.6.4.tar.gz"
|
|
sha256 "b94c1f2535f98354811ee644dccab6e84a0cf73e477ca03fb5a3758fb1fecd1c"
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "9e4cca3ae473e36efa75c33f41de6be4fa354e37e5a1ff9e577015c4c9523c70" => :high_sierra
|
|
sha256 "5f9c96e3ec026360cedad1488121bfd4bcd79dcb1476548ddcda77e7368b5641" => :sierra
|
|
sha256 "32db63b2c9695a0707a7fad6fdd4b843f1803b92d5272eef4855a4b6c261dc6a" => :el_capitan
|
|
end
|
|
|
|
head do
|
|
url "https://github.com/ivmai/bdwgc.git"
|
|
depends_on "autoconf" => :build
|
|
depends_on "automake" => :build
|
|
depends_on "libtool" => :build
|
|
end
|
|
|
|
depends_on "pkg-config" => :build
|
|
depends_on "libatomic_ops" => :build
|
|
|
|
def install
|
|
system "./autogen.sh" if build.head?
|
|
system "./configure", "--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--prefix=#{prefix}",
|
|
"--enable-cplusplus"
|
|
system "make"
|
|
system "make", "check"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <assert.h>
|
|
#include <stdio.h>
|
|
#include "gc.h"
|
|
|
|
int main(void)
|
|
{
|
|
int i;
|
|
|
|
GC_INIT();
|
|
for (i = 0; i < 10000000; ++i)
|
|
{
|
|
int **p = (int **) GC_MALLOC(sizeof(int *));
|
|
int *q = (int *) GC_MALLOC_ATOMIC(sizeof(int));
|
|
assert(*p == 0);
|
|
*p = (int *) GC_REALLOC(q, 2 * sizeof(int));
|
|
}
|
|
return 0;
|
|
}
|
|
EOS
|
|
|
|
system ENV.cc, "-I#{include}", "-L#{lib}", "-lgc", "-o", "test", "test.c"
|
|
system "./test"
|
|
end
|
|
end
|