39 lines
1.1 KiB
Ruby
39 lines
1.1 KiB
Ruby
class Libimagequant < Formula
|
|
desc "Palette quantization library extracted from pnquant2"
|
|
homepage "https://pngquant.org/lib/"
|
|
url "https://github.com/ImageOptim/libimagequant/archive/2.13.0.tar.gz"
|
|
sha256 "1dcd874f97758472d5282ea1241f50959a6e643b8b5ad07dad100b7a85633efd"
|
|
license :cannot_represent
|
|
|
|
bottle do
|
|
cellar :any
|
|
sha256 "cf22020efa8a6816521877e04ac132876ab81362bb5e28b992ddfa76f3d9a228" => :catalina
|
|
sha256 "cfffbc501d8bf39d8305421921f0ec4d727f7bb5548481e9e4908164b0c45db0" => :mojave
|
|
sha256 "ddb7eba89c6e65024e72c9cb3272b7c4f7edc0f5b54eb232ebce9f958e8a6480" => :high_sierra
|
|
end
|
|
|
|
def install
|
|
system "./configure", "--prefix=#{prefix}"
|
|
system "make", "install"
|
|
end
|
|
|
|
test do
|
|
(testpath/"test.c").write <<~EOS
|
|
#include <libimagequant.h>
|
|
|
|
int main()
|
|
{
|
|
liq_attr *attr = liq_attr_create();
|
|
if (!attr) {
|
|
return 1;
|
|
} else {
|
|
liq_attr_destroy(attr);
|
|
return 0;
|
|
}
|
|
}
|
|
EOS
|
|
system ENV.cc, "test.c", "-I#{include}", "-L#{lib}", "-limagequant", "-o", "test"
|
|
system "./test"
|
|
end
|
|
end
|