50 lines
1.7 KiB
Ruby
50 lines
1.7 KiB
Ruby
class Liblzf < Formula
|
|
desc "Very small, very fast data compression library"
|
|
homepage "http://oldhome.schmorp.de/marc/liblzf.html"
|
|
url "http://dist.schmorp.de/liblzf/liblzf-3.6.tar.gz"
|
|
mirror "https://deb.debian.org/debian/pool/main/libl/liblzf/liblzf_3.6.orig.tar.gz"
|
|
sha256 "9c5de01f7b9ccae40c3f619d26a7abec9986c06c36d260c179cedd04b89fb46a"
|
|
|
|
bottle do
|
|
cellar :any_skip_relocation
|
|
rebuild 1
|
|
sha256 "9aa8a1495947fe1fd6249abe33de7245f9ae4a58dcf900276253b013f7f148e8" => :catalina
|
|
sha256 "62c558b1b9562038c49c1e83b73dfb08d8fca8b924eb36428a5c0bb566408f9d" => :mojave
|
|
sha256 "66c9ec26bce56b59ffb317d5a415e6358e8246588a3f247c33b8a8d24e714570" => :high_sierra
|
|
end
|
|
|
|
def install
|
|
system "./configure", "--disable-debug",
|
|
"--disable-dependency-tracking",
|
|
"--disable-silent-rules",
|
|
"--prefix=#{prefix}"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
# Adapted from bench.c in the liblzf source
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <assert.h>
|
|
#include <string.h>
|
|
#include <stdlib.h>
|
|
#include "lzf.h"
|
|
#define DSIZE 32768
|
|
unsigned char data[DSIZE], data2[DSIZE*2], data3[DSIZE*2];
|
|
int main()
|
|
{
|
|
unsigned int i, l, j;
|
|
for (i = 0; i < DSIZE; ++i)
|
|
data[i] = i + (rand() & 1);
|
|
l = lzf_compress (data, DSIZE, data2, DSIZE*2);
|
|
assert(l);
|
|
j = lzf_decompress (data2, l, data3, DSIZE*2);
|
|
assert (j == DSIZE);
|
|
assert (!memcmp (data, data3, DSIZE));
|
|
return 0;
|
|
}
|
|
EOS
|
|
system ENV.cc, "test.c", "-L#{lib}", "-llzf", "-o", "test"
|
|
system "./test"
|
|
end
|
|
end
|