summary refs log tree commit diff
diff options
context:
space:
mode:
authorAlex Vong <alexvong1995@gmail.com>2018-11-12 01:55:05 +0800
committerAlex Vong <alexvong1995@gmail.com>2018-11-22 03:20:11 +0800
commit6e35bad0a9d00f1eb94bb427ad856c219655e95d (patch)
tree40428831e9c9640a0c2bfb249f3e04479a598a0d
parenta2aa746cfe38076b87d9cde2252904c0bddd9f9e (diff)
downloadguix-6e35bad0a9d00f1eb94bb427ad856c219655e95d.tar.gz
gnu: Add pnglite.
* gnu/packages/image.scm (pnglite): New variable.
-rw-r--r--gnu/packages/image.scm56
1 files changed, 56 insertions, 0 deletions
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index e88609a7ca..8168a225fc 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -21,6 +21,7 @@
 ;;; Copyright © 2018 Pierre Neidhardt <mail@ambrevar.xyz>
 ;;; Copyright © 2018 Marius Bakke <mbakke@fastmail.com>
 ;;; Copyright © 2018 Pierre-Antoine Rouby <contact@parouby.fr>
+;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -253,6 +254,61 @@ files.  It can compress them as much as 40% losslessly.")
   ;; This package used to be wrongfully name "pngcrunch".
   (deprecated-package "pngcrunch" pngcrush))
 
+(define-public pnglite
+  (let ((commit "11695c56f7d7db806920bd9229b69f230e6ffb38")
+        (revision "1"))
+    (package
+      (name "pnglite")
+      ;; The project was moved from sourceforge to github.
+      ;; The latest version in sourceforge was 0.1.17:
+      ;; https://sourceforge.net/projects/pnglite/files/pnglite/
+      ;; No releases are made in github.
+      (version (git-version "0.1.17" revision commit))
+      (source (origin
+                (method git-fetch)
+                (uri (git-reference
+                      (url "https://github.com/dankar/pnglite")
+                      (commit commit)))
+                (sha256
+                 (base32
+                  "1lmmkdxby5b8z9kx3zrpgpk33njpcf2xx8z9bgqag855sjsqbbby"))
+                (file-name (git-file-name name version))))
+      (build-system gnu-build-system)
+      (arguments
+       `(#:tests? #f ; no tests
+         #:phases
+         (modify-phases %standard-phases
+           (delete 'configure)
+           (replace 'build
+             (lambda _
+               ;; common build flags for building shared libraries
+               (let ((cflags '("-O2" "-g" "-fPIC"))
+                     (ldflags '("-shared")))
+                 (apply invoke
+                        `("gcc"
+                          "-o" "libpnglite.so"
+                          ,@cflags
+                          ,@ldflags
+                          "pnglite.c"))
+                 #t)))
+           (replace 'install
+             (lambda* (#:key outputs #:allow-other-keys)
+               (let* ((out (assoc-ref outputs "out"))
+                      (lib (string-append out "/lib/"))
+                      (include (string-append out "/include/"))
+                      (doc (string-append out "/share/doc/"
+                                          ,name "-" ,version "/")))
+                 (install-file "libpnglite.so" lib)
+                 (install-file "pnglite.h" include)
+                 (install-file "README.md" doc)
+                 #t))))))
+      (inputs `(("zlib" ,zlib)))
+      (home-page "https://github.com/dankar/pnglite")
+      (synopsis "Pretty small png library")
+      (description "A pretty small png library.
+Currently all documentation resides in @file{pnglite.h}.")
+      (license license:zlib))))
+
 (define-public libjpeg
   (package
    (name "libjpeg")