Commit | Line | Data |
---|---|---|
05bf6f82 | 1 | ;;; GNU Guix --- Functional package management for GNU |
7d8379a7 | 2 | ;;; Copyright © 2013, 2015 Andreas Enge <andreas@enge.fr> |
61dc82d9 | 3 | ;;; Copyright © 2015, 2016 Ludovic Courtès <ludo@gnu.org> |
05bf6f82 AE |
4 | ;;; |
5 | ;;; This file is part of GNU Guix. | |
6 | ;;; | |
7 | ;;; GNU Guix is free software; you can redistribute it and/or modify it | |
8 | ;;; under the terms of the GNU General Public License as published by | |
9 | ;;; the Free Software Foundation; either version 3 of the License, or (at | |
10 | ;;; your option) any later version. | |
11 | ;;; | |
12 | ;;; GNU Guix is distributed in the hope that it will be useful, but | |
13 | ;;; WITHOUT ANY WARRANTY; without even the implied warranty of | |
14 | ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
15 | ;;; GNU General Public License for more details. | |
16 | ;;; | |
17 | ;;; You should have received a copy of the GNU General Public License | |
18 | ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>. | |
19 | ||
20 | (define-module (gnu packages netpbm) | |
21 | #:use-module (gnu packages) | |
22 | #:use-module (gnu packages compression) | |
23 | #:use-module (gnu packages flex) | |
24 | #:use-module (gnu packages ghostscript) | |
e55354b8 | 25 | #:use-module (gnu packages image) |
05bf6f82 AE |
26 | #:use-module (gnu packages perl) |
27 | #:use-module (gnu packages pkg-config) | |
28 | #:use-module (gnu packages python) | |
29 | #:use-module (gnu packages xml) | |
2492581f | 30 | #:use-module (gnu packages xorg) |
7d8379a7 | 31 | #:use-module (guix build-system gnu) |
05bf6f82 AE |
32 | #:use-module ((guix licenses) #:select (gpl2)) |
33 | #:use-module (guix packages) | |
7d8379a7 | 34 | #:use-module (guix svn-download)) |
05bf6f82 AE |
35 | |
36 | (define-public netpbm | |
37 | (package | |
38 | (name "netpbm") | |
664ac384 | 39 | (version "10.78.3") |
05bf6f82 | 40 | (source (origin |
7d8379a7 AE |
41 | (method svn-fetch) |
42 | ;; At the time of first packaging, the "super-stable" and | |
43 | ;; "stable" versions did not compile with newer libpng; | |
44 | ;; we needed the "advanced" version. | |
836223f7 AE |
45 | ;; The currently highest stable version is 10.47.53, |
46 | ;; the currently highest advanced version is 10.69.4, | |
47 | ;; svn release 2397. | |
7d8379a7 AE |
48 | ;; To determine the correct release: "svn log version.mk". |
49 | (uri (svn-reference | |
50 | (url "http://svn.code.sf.net/p/netpbm/code/advanced") | |
664ac384 | 51 | (revision 2965))) |
7d8379a7 AE |
52 | (sha256 |
53 | (base32 | |
664ac384 | 54 | "1k7as9qi1942wyjxpvbf02wg0h4braw44m3m3vvi8sm9y5z1m967")) |
713e0aa4 LC |
55 | (file-name (string-append name "-" version "-checkout")) |
56 | (modules '((guix build utils))) | |
57 | (snippet | |
713e0aa4 | 58 | '(begin |
56501d3b | 59 | ;; Remove non-FSDG-compliant code. |
713e0aa4 LC |
60 | |
61 | (define-syntax drop | |
62 | (syntax-rules (in) | |
63 | ;; Remove PROGRAM from DIRECTORY/Makefile, and remove | |
64 | ;; DIRECTORY/PROGRAM and DIRECTORY/PROGRAM.c. | |
65 | ((_ program ... in directory) | |
66 | (begin | |
67 | (substitute* (string-append directory "/Makefile") | |
68 | ((program) "") ...) | |
69 | ||
70 | (let* ((subdir (string-append directory "/" program)) | |
71 | (dot-c (string-append subdir ".c"))) | |
72 | (when (file-exists? subdir) | |
73 | (delete-file-recursively subdir)) | |
74 | (when (file-exists? dot-c) | |
75 | (delete-file dot-c))) | |
76 | ||
77 | ...)))) | |
78 | ||
79 | ;; Drop advertisement for non-free program. | |
80 | (drop "hpcdtoppm" in "converter/ppm") | |
81 | ||
82 | ;; Drop programs without a license, see | |
83 | ;; <http://packages.debian.org/changelogs/pool/main/n/netpbm-free/netpbm-free_10.0-12.2/libnetpbm10.copyright>. | |
84 | (drop "pbmto4425" "pbmtoln03" "pbmtolps" "pbmtopk" "pktopbm" | |
85 | in "converter/pbm") | |
86 | (drop "spottopgm" in "converter/pgm") | |
56501d3b LC |
87 | (drop "ppmtopjxl" in "converter/ppm") |
88 | ||
89 | ;; Remove timestamps from the generated code. | |
5bc42e1a DM |
90 | (substitute* "buildtools/makepointerman" |
91 | (("gmctime[(][)]") | |
92 | "\"Thu Jan 1 00:00:00 1970\"")) | |
56501d3b LC |
93 | (substitute* "buildtools/stamp-date" |
94 | (("^DATE=.*") | |
95 | "DATE=\"Thu Jan 01 00:00:00+0000 1970\"\n") | |
96 | (("^USER=.*") | |
97 | "USER=Guix\n")))))) | |
98 | ||
05bf6f82 | 99 | (build-system gnu-build-system) |
c4c4cc05 | 100 | (inputs `(("ghostscript" ,ghostscript) |
05bf6f82 AE |
101 | ("libjpeg" ,libjpeg) |
102 | ("libpng" ,libpng) | |
103 | ("libtiff" ,libtiff) | |
104 | ("libxml2" ,libxml2) | |
2492581f | 105 | ("xorg-rgb" ,xorg-rgb) |
05bf6f82 | 106 | ("zlib" ,zlib))) |
c4c4cc05 JD |
107 | (native-inputs |
108 | `(("flex" ,flex) | |
109 | ("perl" ,perl) | |
110 | ("pkg-config" ,pkg-config) | |
111 | ("python" ,python-wrapper))) | |
05bf6f82 AE |
112 | (arguments |
113 | `(#:phases | |
1de1c56d FB |
114 | (modify-phases %standard-phases |
115 | (replace 'configure | |
116 | (lambda* (#:key inputs outputs #:allow-other-keys) | |
117 | (copy-file "config.mk.in" "config.mk") | |
118 | (chmod "config.mk" #o664) | |
119 | (let ((f (open-file "config.mk" "a"))) | |
120 | (display "CC=gcc\n" f) | |
121 | (display "CFLAGS_SHLIB += -fPIC\n" f) | |
122 | (display "TIFFLIB = libtiff.so\n" f) | |
123 | (display "JPEGLIB = libjpeg.so\n" f) | |
124 | (display "ZLIB = libz.so\n" f) | |
125 | (display (string-append "LDFLAGS += -Wl,-rpath=" %output "/lib") f) | |
2492581f | 126 | (close-port f)) |
61dc82d9 | 127 | |
2492581f FB |
128 | (let ((rgb (string-append (assoc-ref inputs "xorg-rgb") |
129 | "/share/X11/rgb.txt"))) | |
664ac384 LF |
130 | (substitute* "config.mk" |
131 | (("/usr/share/netpbm/rgb.txt") rgb)) | |
61dc82d9 LC |
132 | |
133 | ;; Our Ghostscript no longer provides the 'gs' command, only | |
134 | ;; 'gsc', so look for that instead. | |
135 | (substitute* "converter/other/pstopnm.c" | |
136 | (("\"%s/gs\"") | |
137 | "\"%s/gsc\""))) | |
9f9861d7 | 138 | #t)) |
1de1c56d FB |
139 | (add-before 'check 'setup-check |
140 | (lambda _ | |
141 | ;; install temporarily into /tmp/netpbm | |
142 | (system* "make" "package") | |
143 | ;; remove test requiring X | |
144 | (substitute* "test/all-in-place.test" (("pamx") "")) | |
145 | ;; do not worry about non-existing file | |
146 | (substitute* "test/all-in-place.test" (("^rm ") "rm -f ")) | |
147 | ;; remove four tests that fail for unknown reasons | |
148 | (substitute* "test/Test-Order" | |
149 | (("all-in-place.test") "") | |
150 | (("pnmpsnr.test") "") | |
151 | (("pnmremap1.test") "") | |
664ac384 LF |
152 | (("gif-roundtrip.test") "") |
153 | ||
154 | ;; These two tests started failing in netpbm-10.78.3. | |
155 | (("jpeg-roundtrip.test") "") | |
156 | (("pbmtext.test") "") | |
157 | ||
158 | ;; Skip tests that use nonfree programs that we don't build. | |
159 | (("ps-alt-roundtrip.test") "" ) | |
160 | (("pbm-misc-converters.test") "")) | |
9f9861d7 | 161 | #t)) |
1de1c56d FB |
162 | (replace 'install |
163 | (lambda* (#:key outputs make-flags #:allow-other-keys) | |
164 | (let ((out (assoc-ref outputs "out"))) | |
165 | (apply system* "make" "package" | |
166 | (string-append "pkgdir=" out) make-flags) | |
167 | ;; copy static library | |
168 | (copy-file (string-append out "/link/libnetpbm.a") | |
169 | (string-append out "/lib/libnetpbm.a")) | |
170 | ;; remove superfluous folders and files | |
171 | (system* "rm" "-r" (string-append out "/link")) | |
172 | (system* "rm" "-r" (string-append out "/misc")) | |
173 | (with-directory-excursion out | |
174 | (for-each delete-file | |
175 | '("config_template" "pkginfo" "README" | |
9f9861d7 FB |
176 | "VERSION"))) |
177 | #t)))))) | |
35b9e423 | 178 | (synopsis "Toolkit for manipulation of images") |
05bf6f82 AE |
179 | (description |
180 | "Netpbm is a toolkit for the manipulation of graphic images, including | |
181 | the conversion of images between a variety of different formats. | |
182 | There are over 300 separate tools in the package including converters for | |
183 | about 100 graphics formats.") | |
184 | (license gpl2) | |
185 | (home-page "http://netpbm.sourceforge.net/"))) |