From mboxrd@z Thu Jan 1 00:00:00 1970 From: contact.ng0@cryptolab.net Subject: [PATCH] gnu: Add catimg. Date: Sun, 29 Jan 2017 21:32:13 +0000 Message-ID: <20170129213213.8219-2-contact.ng0@cryptolab.net> References: <87sho1d0vh.fsf@wasp.i-did-not-set--mail-host-address--so-tickle-me> <20170129213213.8219-1-contact.ng0@cryptolab.net> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:50799) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1cXx4A-0004kK-8T for guix-devel@gnu.org; Sun, 29 Jan 2017 16:31:21 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1cXx45-00005L-L9 for guix-devel@gnu.org; Sun, 29 Jan 2017 16:31:18 -0500 Received: from aibo.runbox.com ([91.220.196.211]:40346) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1cXx45-0008VK-DP for guix-devel@gnu.org; Sun, 29 Jan 2017 16:31:13 -0500 Received: from [10.9.9.212] (helo=mailfront12.runbox.com) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1cXx44-00042q-71 for guix-devel@gnu.org; Sun, 29 Jan 2017 22:31:12 +0100 In-Reply-To: <20170129213213.8219-1-contact.ng0@cryptolab.net> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: guix-devel@gnu.org Cc: ng0 From: ng0 * gnu/packages/image-viewers.scm (catimg): New variable. --- gnu/packages/image-viewers.scm | 59 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/gnu/packages/image-viewers.scm b/gnu/packages/image-viewers.scm index bc56041f8..05d39ba87 100644 --- a/gnu/packages/image-viewers.scm +++ b/gnu/packages/image-viewers.scm @@ -4,6 +4,7 @@ ;;; Copyright © 2015, 2016 Alex Kost ;;; Copyright © 2016 Efraim Flashner ;;; Copyright © 2017 Alex Griffin +;;; Copyright © 2017 ng0 ;;; ;;; This file is part of GNU Guix. ;;; @@ -25,6 +26,7 @@ #:use-module (guix download) #:use-module (guix packages) #:use-module (guix build-system gnu) + #:use-module (guix build-system cmake) #:use-module (gnu packages autotools) #:use-module (gnu packages base) #:use-module (gnu packages curl) @@ -33,6 +35,7 @@ #:use-module (gnu packages gnome) #:use-module (gnu packages gtk) #:use-module (gnu packages image) + #:use-module (gnu packages imagemagick) #:use-module (gnu packages photo) #:use-module (gnu packages pkg-config) #:use-module (gnu packages xorg)) @@ -205,3 +208,59 @@ your images. Among its features are: @item Configurable mouse actions @end enumerate\n") (license license:gpl3+))) + +(define-public catimg + (package + (name "catimg") + (version "2.2.1") + (source + (origin + (method url-fetch) + (uri (string-append "https://github.com/posva/catimg/archive" + "/v" version ".tar.gz")) + (file-name (string-append name "-" version ".tar.gz")) + (sha256 + (base32 + "14g90zwh2d3s13hgyxypx2vc0rj1g58l6zcxhgc84wsyxfxd6xpb")))) + (build-system cmake-build-system) + (arguments + `(#:tests? #f ; No check target + #:phases + (modify-phases %standard-phases + (replace 'configure + (lambda* (#:key inputs #:allow-other-keys) + (let* ((magic (assoc-ref %build-inputs "imagemagick")) + (convert (string-append magic "/bin/convert"))) + (substitute* "catimg" + ;; By replacing "convert", we also replace the "convert" + ;; in the message 'The version of convert is too old, don't + ;; expect good results :('. This should not happen, but in + ;; practice this error message should not affect us. + (("convert") convert)) + #t))) + (replace 'build + (lambda _ + (zero? (system* "cmake" "-D" + (string-append "CMAKE_INSTALL_PREFIX=" + (assoc-ref %outputs "out")) + ".")) + (zero? (system* "make")))) + (add-before 'install 'install-script + (lambda* (#:key outputs #:allow-other-keys) + ;; The bashscript lacks an file extension, we have to rename + ;; it so that the C program and the bash script can be happy + ;; side by side. + (let* ((out (assoc-ref outputs "out")) + (bin (string-append out "/bin"))) + (install-file "catimg" bin) + (rename-file (string-append bin "/catimg") + (string-append bin "/catimg.sh")) + #t)))))) + (inputs + `(("imagemagick" ,imagemagick))) ; For the bash script version + (home-page "https://github.com/posva/catimg") + (synopsis "Render images in the terminal") + (description + "Catimg is a little program that prints images in the terminal. +It supports JPEG, PNG and GIF formats.") + (license license:expat))) -- 2.11.0