[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/02: gnu: Add lodepng.
From: |
guix-commits |
Subject: |
01/02: gnu: Add lodepng. |
Date: |
Mon, 24 Feb 2020 15:56:12 -0500 (EST) |
mbakke pushed a commit to branch master
in repository guix.
commit 7eed584507738c11df178740bba2980f1e4d307e
Author: Giacomo Leidi <address@hidden>
AuthorDate: Sun Feb 16 22:21:32 2020 +0100
gnu: Add lodepng.
* gnu/packages/image.scm (lodepng): New variable.
Signed-off-by: Marius Bakke <address@hidden>
---
gnu/packages/image.scm | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/gnu/packages/image.scm b/gnu/packages/image.scm
index f9da1e9..106b733 100644
--- a/gnu/packages/image.scm
+++ b/gnu/packages/image.scm
@@ -23,6 +23,7 @@
;;; Copyright © 2018 Pierre-Antoine Rouby <address@hidden>
;;; Copyright © 2018 Alex Vong <address@hidden>
;;; Copyright © 2018 Rutger Helling <address@hidden>
+;;; Copyright © 2020 Giacomo Leidi <address@hidden>
;;;
;;; This file is part of GNU Guix.
;;;
@@ -1844,3 +1845,58 @@ using only text tools.
SNG is implemented by a compiler/decompiler called sng that
losslessly translates between SNG and PNG.")
(license license:zlib)))
+
+(define-public lodepng
+ ;; There are no tags in the repository, so we take the version as defined in
+ ;; lodepng.cpp.
+ (let ((commit "48e5364ef48ec2408f44c727657ac1b6703185f8")
+ (revision "1")
+ (version "20200215"))
+ (package
+ (name "lodepng")
+ (version (git-version version revision commit))
+ (source (origin
+ (method git-fetch)
+ (uri (git-reference
+ (url "https://github.com/lvandeve/lodepng")
+ (commit commit)))
+ (sha256
+ (base32
+ "1a1x8ag2scanzb2066jm9hg2y9kaa3wmpgmz10l1x9bkpik612lw"))
+ (file-name (git-file-name name version))))
+ (build-system gnu-build-system)
+ (arguments
+ '(#:phases
+ (modify-phases %standard-phases
+ (delete 'configure)
+ (replace 'build
+ (lambda _
+ (setenv "CXXFLAGS" "-fPIC")
+ (invoke "make" "lodepng.o")
+ (invoke "make" "lodepng_util.o")
+ (invoke "g++" "-fPIC" "-O3"
+ "-o" "liblodepng.so"
+ "-shared" "lodepng.o" "lodepng_util.o")
+ #t))
+ (replace 'check
+ (lambda _
+ (invoke "make" "unittest")
+ (invoke "./unittest")
+ #t))
+ (replace 'install
+ (lambda* (#:key outputs #:allow-other-keys)
+ (let* ((out (assoc-ref outputs "out"))
+ (doc (string-append out "/share/doc"))
+ (lib (string-append out "/lib"))
+ (include (string-append out "/include")))
+ (install-file "lodepng.h" include)
+ (install-file "lodepng_util.h" include)
+ (install-file "liblodepng.so" lib)
+ (install-file "README.md" doc)
+ #t))))))
+ (home-page "https://lodev.org/lodepng/")
+ (synopsis "PNG encoder and decoder in C and C++, without dependencies")
+ (description "LodePNG is a PNG image decoder and encoder, all in one,
+no dependency or linkage required. It's made for C (ISO C90), and has a C++
+wrapper with a more convenient interface on top.")
+ (license license:zlib))))