gnu: Move numerous "inputs" which should be "native-inputs".
[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* (#:key #:allow-other-keys #:rest args)
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" (("pbmto4425") ""))
81 (substitute* "converter/pbm/Makefile" (("pbmtoln03") ""))
82 (substitute* "converter/pbm/Makefile" (("pbmtolps") ""))
83 (substitute* "converter/pbm/Makefile" (("pbmtopk") ""))
84 (substitute* "converter/pbm/Makefile" (("pktopbm") ""))
85 (substitute* "converter/pgm/Makefile" (("spottopgm") ""))
86 (substitute* "converter/ppm/Makefile" (("ppmtopjxl") ""))
87 ))
88 (alist-replace
89 'check
90 (lambda* (#:key #:allow-other-keys #:rest args)
91 (let ((check (assoc-ref %standard-phases 'check)))
92 ;; install temporarily into /tmp/netpbm
93 (system* "make" "package")
94 ;; remove test requiring X
95 (substitute* "test/all-in-place.test" (("pamx") ""))
96 ;; do not worry about non-existing file
97 (substitute* "test/all-in-place.test" (("^rm ") "rm -f "))
98 ;; remove four tests that fail for unknown reasons
99 (substitute* "test/Test-Order" (("all-in-place.test") ""))
100 (substitute* "test/Test-Order" (("pnmpsnr.test") ""))
101 (substitute* "test/Test-Order" (("pnmremap1.test") ""))
102 (substitute* "test/Test-Order" (("gif-roundtrip.test") ""))
103 (apply check args)))
104 (alist-replace
105 'install
106 (lambda* (#:key outputs make-flags #:allow-other-keys)
107 (let ((out (assoc-ref outputs "out")))
108 (apply system* "make" "package"
109 (string-append "pkgdir=" out) make-flags)
110 ;; copy static library
111 (copy-file (string-append out "/link/libnetpbm.a")
112 (string-append out "/lib/libnetpbm.a"))
113 ;; remove superfluous folders and files
114 (system* "rm" "-r" (string-append out "/link"))
115 (system* "rm" "-r" (string-append out "/misc"))
116 (with-directory-excursion out
117 (for-each delete-file
118 '("config_template" "pkginfo" "README" "VERSION")))))
119 %standard-phases)))))
120 (synopsis "Netpbm, a toolkit for manipulation of images")
121 (description
122 "Netpbm is a toolkit for the manipulation of graphic images, including
123 the conversion of images between a variety of different formats.
124 There are over 300 separate tools in the package including converters for
125 about 100 graphics formats.")
126 (license gpl2)
127 (home-page "http://netpbm.sourceforge.net/")))