28 lines
1,006 B
Ruby
28 lines
1,006 B
Ruby
|
class Libspng < Formula
|
||
|
desc "C library for reading and writing PNG format files"
|
||
|
homepage "https://libspng.org/"
|
||
|
url "https://gitlab.com/randy408/libspng/uploads/6ddcaa59367b2cea474213a994b82012/libspng-0.4.5.tar.xz"
|
||
|
sha256 "a6b18bf8bdef479d7556dba7e19d781cb9032aef04b2f95e855e0f563c5aee45"
|
||
|
|
||
|
depends_on "meson" => :build
|
||
|
depends_on "ninja" => :build
|
||
|
depends_on "pkg-config" => :build
|
||
|
|
||
|
def install
|
||
|
mkdir "build" do
|
||
|
system "meson", "--prefix=#{prefix}", ".."
|
||
|
system "ninja", "-v"
|
||
|
system "ninja", "install", "-v"
|
||
|
end
|
||
|
pkgshare.install "examples/example.c"
|
||
|
end
|
||
|
|
||
|
test do
|
||
|
fixture = test_fixtures("test.png")
|
||
|
cp pkgshare/"example.c", testpath/"example.c"
|
||
|
system ENV.cc, "example.c", "-L#{lib}", "-I#{include}", "-lspng", "-o", "example"
|
||
|
output = shell_output("./example #{fixture}")
|
||
|
assert_match "width: 8\nheight: 8\nbit depth: 1\ncolor type: 3 - indexed color\ncompression method: 0\nfilter method: 0\ninterlace method: 0", output
|
||
|
end
|
||
|
end
|