From f69efd97d91a22fd475977d1e29f762d7926fadf Mon Sep 17 00:00:00 2001 From: Igor Kapkov Date: Tue, 6 Nov 2018 08:45:07 +1100 Subject: [PATCH] jbig2dec 0.15 Closes #33789. Signed-off-by: FX Coudert --- Formula/jbig2dec.rb | 33 +++++++++++---------------------- 1 file changed, 11 insertions(+), 22 deletions(-) diff --git a/Formula/jbig2dec.rb b/Formula/jbig2dec.rb index 6e59e559c2..229cc6831d 100644 --- a/Formula/jbig2dec.rb +++ b/Formula/jbig2dec.rb @@ -1,8 +1,8 @@ class Jbig2dec < Formula desc "JBIG2 decoder and library (for monochrome documents)" homepage "https://jbig2dec.com/" - url "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs922/jbig2dec-0.14.tar.gz" - sha256 "21b498c3ba566f283d02946f7e78e12abbad89f12fe4958974e50882c185014c" + url "https://github.com/ArtifexSoftware/ghostpdl-downloads/releases/download/gs924/jbig2dec-0.15.tar.gz" + sha256 "6bfa1af72de37c7929315933a1ba696540d860936ad98f9de02fc725d7e53854" bottle do cellar :any @@ -12,38 +12,27 @@ class Jbig2dec < Formula sha256 "beb6ea36ce8edffa4ff8569231413fab5f3de7338379b35b49d208e16243577d" => :el_capitan end - depends_on "libpng" => :optional + resource("test") do + url "https://github.com/apache/tika/raw/master/tika-parsers/src/test/resources/test-documents/testJBIG2.jb2" + sha256 "40764aed6c185f1f82123f9e09de8e4d61120e35d2b5c6ede082123749c22d91" + end def install args = %W[ --disable-dependency-tracking --prefix=#{prefix} --disable-silent-rules + --without-libpng ] - args << "--without-libpng" if build.without? "libpng" system "./configure", *args system "make", "install" end test do - (testpath/"test.c").write <<~EOS - #include - #include - #include - - int main() - { - Jbig2Ctx *ctx; - Jbig2Image *image; - ctx = jbig2_ctx_new(NULL, 0, NULL, NULL, NULL); - image = jbig2_image_new(ctx, 10, 10); - jbig2_image_release(ctx, image); - jbig2_ctx_free(ctx); - return 0; - } - EOS - system ENV.cc, "test.c", "-DJBIG_NO_MEMENTO", "-L#{lib}", "-ljbig2dec", "-o", "test" - system "./test" + resource("test").stage testpath + output = shell_output("#{bin}/jbig2dec -t pbm --hash testJBIG2.jb2") + assert_match "aa35470724c946c7e953ddd49ff5aab9f8289aaf", output + assert_predicate testpath/"testJBIG2.pbm", :exist? end end