Subject: [PATCH] gnu: Add pngcrunch.
From: Hartmut Goebel <[email-masked]>
To: [email-masked]
Date: Sun, 7 May 2017 19:24:59 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

* gnu/packages/image.scm (pngcrunch): New variable.
---
 gnu/packages/image.scm | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index 1a11085..3368e23 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -155,6 +155,40 @@ APNG patch provides APNG support to libpng.")
        (sha256
         (base32 "1n2lrzjkm5jhfg2bs10q398lkwbbx742fi27zgdgx0x23zhj0ihg"))))))
 
+(define-public pngcrunch
+  (package
+   (name "pngcrunch")
+   (version "1.8.11")
+   (source (origin
+            (method url-fetch)
+            (uri (string-append "mirror://sourceforge/pmt/pngcrush/"
+                                version "/pngcrush-" version ".tar.xz"))
+            (sha256 (base32
+                     "1c7m316i91jp3h1dj1ppppdv6zilm2njk1wrpqy2zj0fcll06lwd"))))
+   (build-system gnu-build-system)
+   (arguments
+    '(#:make-flags '("-f" "Makefile-nolib")
+      #:tests? #f ; no check target
+      #:phases
+      (modify-phases %standard-phases
+        (replace 'configure
+          (lambda* (#:key inputs outputs #:allow-other-keys)
+            (substitute* "Makefile-nolib"
+              (("^(PNG(INC|LIB) = )/usr/local/" line vardef)
+               (string-append vardef (assoc-ref inputs "libpng") "/"))
+              (("^(Z(INC|LIB) = )/usr/local/" line vardef)
+               (string-append vardef (assoc-ref inputs "zlib") "/"))
+              (("\\$\\(DESTDIR\\)/usr/")
+               (string-append (assoc-ref outputs "out") "/"))))))))
+   (inputs
+    `(("libpng" ,libpng)
+      ("zlib" , zlib)))
+   (home-page "https://pmt.sourceforge.net/pngcrush")
+   (synopsis "Utility to compress PNG files")
+   (description "pngcrusqh is an optimizer for PNG (Portable Network Graphics)
+files.  It can compress them as much as 40% losslessly.")
+   (license license:zlib)))
+
 (define-public libjpeg
   (package
    (name "libjpeg")
-- 
2.7.4