gnu: qemu: Remove dependency on Samba.
[jackhill/guix/guix.git] / gnu / packages / netpbm.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013 Andreas Enge <andreas@enge.fr>
3 ;;;
4 ;;; This file is part of GNU Guix.
5 ;;;
6 ;;; GNU Guix is free software; you can redistribute it and/or modify it
7 ;;; under the terms of the GNU General Public License as published by
8 ;;; the Free Software Foundation; either version 3 of the License, or (at
9 ;;; your option) any later version.
10 ;;;
11 ;;; GNU Guix is distributed in the hope that it will be useful, but
12 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
13 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 ;;; GNU General Public License for more details.
15 ;;;
16 ;;; You should have received a copy of the GNU General Public License
17 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
18
19 (define-module (gnu packages netpbm)
20 #:use-module (gnu packages)
21 #:use-module (gnu packages compression)
22 #:use-module (gnu packages flex)
23 #:use-module (gnu packages ghostscript)
24 #:use-module (gnu packages libjpeg)
25 #:use-module (gnu packages libpng)
26 #:use-module (gnu packages libtiff)
27 #:use-module (gnu packages perl)
28 #:use-module (gnu packages pkg-config)
29 #:use-module (gnu packages python)
30 #:use-module (gnu packages xml)
31 #:use-module ((guix licenses) #:select (gpl2))
32 #:use-module (guix packages)
33 #:use-module (guix download)
34 #:use-module (guix build-system gnu))
35
36 (define-public netpbm
37 (package
38 (name "netpbm")
39 (version "10.61.01")
40 (source (origin
41 (method url-fetch)
42 ;; The "super-stable" and "stable" versions do not compile
43 ;; with newer libpng; we need the "advanced" version. The tarball
44 ;; on the server is generated by sourceforge from the "advanced"
45 ;; branch of the subversion repository:
46 ;; svn checkout http://netpbm.svn.sourceforge.net/svnroot/netpbm/advanced netpbm-version
47 (uri (string-append "http://www.multiprecision.org/guix/netpbm-"
48 version ".tar.xz"))
49 (sha256 (base32
50 "10nwvxc85kr6vhlhhahagy7s9848bbixl54b0p4ppim4g0dl10jz"))))
51 (build-system gnu-build-system)
52 (inputs `(("ghostscript" ,ghostscript)
53 ("libjpeg" ,libjpeg)
54 ("libpng" ,libpng)
55 ("libtiff" ,libtiff)
56 ("libxml2" ,libxml2)
57 ("zlib" ,zlib)))
58 (native-inputs
59 `(("flex" ,flex)
60 ("perl" ,perl)
61 ("pkg-config" ,pkg-config)
62 ("python" ,python-wrapper)))
63 (arguments
64 `(#:phases
65 (alist-replace
66 'configure
67 (lambda _
68 (copy-file "config.mk.in" "config.mk")
69 (let ((f (open-file "config.mk" "a")))
70 (display "CC=gcc\n" f)
71 (display "CFLAGS_SHLIB += -fPIC\n" f)
72 (display "TIFFLIB = libtiff.so\n" f)
73 (display "JPEGLIB = libjpeg.so\n" f)
74 (display "ZLIB = libz.so\n" f)
75 (close-port f)
76 ;; drop advertisement for non-free program
77 (substitute* "converter/ppm/Makefile" (("hpcdtoppm") ""))
78 ;; drop programs without license, see
79 ;; http://packages.debian.org/changelogs/pool/main/n/netpbm-free/netpbm-free_10.0-12.2/libnetpbm10.copyright
80 (substitute* "converter/pbm/Makefile"
81 (("pbmto4425") "")
82 (("pbmtoln03") "")
83 (("pbmtolps") "")
84 (("pbmtopk") "")
85 (("pktopbm") ""))
86 (substitute* "converter/pgm/Makefile" (("spottopgm") ""))
87 (substitute* "converter/ppm/Makefile" (("ppmtopjxl") ""))))
88 (alist-cons-before
89 'check 'setup-check
90 (lambda _
91 ;; install temporarily into /tmp/netpbm
92 (system* "make" "package")
93 ;; remove test requiring X
94 (substitute* "test/all-in-place.test" (("pamx") ""))
95 ;; do not worry about non-existing file
96 (substitute* "test/all-in-place.test" (("^rm ") "rm -f "))
97 ;; remove four tests that fail for unknown reasons
98 (substitute* "test/Test-Order"
99 (("all-in-place.test") "")
100 (("pnmpsnr.test") "")
101 (("pnmremap1.test") "")
102 (("gif-roundtrip.test") "")))
103 (alist-replace
104 'install
105 (lambda* (#:key outputs make-flags #:allow-other-keys)
106 (let ((out (assoc-ref outputs "out")))
107 (apply system* "make" "package"
108 (string-append "pkgdir=" out) make-flags)
109 ;; copy static library
110 (copy-file (string-append out "/link/libnetpbm.a")
111 (string-append out "/lib/libnetpbm.a"))
112 ;; remove superfluous folders and files
113 (system* "rm" "-r" (string-append out "/link"))
114 (system* "rm" "-r" (string-append out "/misc"))
115 (with-directory-excursion out
116 (for-each delete-file
117 '("config_template" "pkginfo" "README" "VERSION")))))
118 %standard-phases)))))
119 (synopsis "Netpbm, a toolkit for manipulation of images")
120 (description
121 "Netpbm is a toolkit for the manipulation of graphic images, including
122 the conversion of images between a variety of different formats.
123 There are over 300 separate tools in the package including converters for
124 about 100 graphics formats.")
125 (license gpl2)
126 (home-page "http://netpbm.sourceforge.net/")))