gnu: packages: Use 'search-patches' everywhere.
[jackhill/guix/guix.git] / gnu / packages / imagemagick.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
4 ;;; Copyright © 2015 Ricardo Wurmus <rekado@elephly.net>
5 ;;;
6 ;;; This file is part of GNU Guix.
7 ;;;
8 ;;; GNU Guix is free software; you can redistribute it and/or modify it
9 ;;; under the terms of the GNU General Public License as published by
10 ;;; the Free Software Foundation; either version 3 of the License, or (at
11 ;;; your option) any later version.
12 ;;;
13 ;;; GNU Guix is distributed in the hope that it will be useful, but
14 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
15 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 ;;; GNU General Public License for more details.
17 ;;;
18 ;;; You should have received a copy of the GNU General Public License
19 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
20
21 (define-module (gnu packages imagemagick)
22 #:use-module (guix packages)
23 #:use-module (guix build-system gnu)
24 #:use-module (guix build-system perl)
25 #:use-module (guix download)
26 #:use-module (guix utils)
27 #:use-module ((guix licenses) #:prefix license:)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages algebra)
30 #:use-module (gnu packages compression)
31 #:use-module (gnu packages fontutils)
32 #:use-module (gnu packages ghostscript)
33 #:use-module (gnu packages graphviz)
34 #:use-module (gnu packages gtk)
35 #:use-module (gnu packages image)
36 #:use-module (gnu packages pkg-config)
37 #:use-module (gnu packages xml)
38 #:use-module (gnu packages xorg))
39
40 (define-public imagemagick
41 (package
42 (name "imagemagick")
43 (version "6.9.2-1")
44 (source (origin
45 (method url-fetch)
46 (uri (string-append "mirror://imagemagick/ImageMagick-"
47 version ".tar.xz"))
48 (sha256
49 (base32
50 "159afhqrj22jlz745ccbgnkdiwvn8pjcc96jic0iv9ms7gqxwln5"))
51 (patches (search-patches "imagemagick-test-segv.patch"))))
52 (build-system gnu-build-system)
53 (arguments
54 `(#:configure-flags '("--with-frozenpaths")
55 #:phases (modify-phases %standard-phases
56 (add-before
57 'build 'pre-build
58 (lambda* (#:key outputs #:allow-other-keys)
59 (substitute* "Makefile"
60 ;; Clear the `LIBRARY_PATH' setting, which otherwise
61 ;; interferes with our own use.
62 (("^LIBRARY_PATH[[:blank:]]*=.*$")
63 "")
64
65 ;; Since the Makefile overrides $docdir, modify it to
66 ;; refer to what we want.
67 (("^DOCUMENTATION_PATH[[:blank:]]*=.*$")
68 (let ((doc (assoc-ref outputs "doc")))
69 (string-append "DOCUMENTATION_PATH = "
70 doc "/share/doc/"
71 ,name "-" ,version "\n"))))))
72 (add-before
73 'configure 'strip-configure-xml
74 (lambda _
75 (substitute* "config/configure.xml.in"
76 ;; Do not record 'configure' arguments in the
77 ;; configure.xml file that gets installed: That would
78 ;; include --docdir, and thus retain a reference to the
79 ;; 'doc' output.
80 (("@CONFIGURE_ARGS@")
81 "not recorded")))))))
82 ;; TODO: Add Jasper etc.
83 (inputs `(("fftw" ,fftw)
84 ("graphviz" ,graphviz)
85 ("ghostscript" ,ghostscript)
86 ("lcms" ,lcms)
87 ("libx11" ,libx11)
88 ("zlib" ,zlib)
89 ("libxml2" ,libxml2)
90 ("libtiff" ,libtiff)
91 ("libpng" ,libpng)
92 ("libjpeg" ,libjpeg)
93 ("pango" ,pango)
94 ("freetype" ,freetype)
95 ("bzip2" ,bzip2)
96 ("xz" ,xz)))
97 (native-inputs `(("pkg-config" ,pkg-config)))
98 (outputs '("out"
99 "doc")) ; 26 MiB of HTML documentation
100 (home-page "http://www.imagemagick.org/")
101 (synopsis "Create, edit, compose, or convert bitmap images")
102 (description
103 "ImageMagick® is a software suite to create, edit, compose, or convert
104 bitmap images. It can read and write images in a variety of formats (over 100)
105 including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG,
106 and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and
107 transform images, adjust image colors, apply various special effects, or draw
108 text, lines, polygons, ellipses and Bézier curves.")
109 (license (license:fsf-free "http://www.imagemagick.org/script/license.php"))))
110
111 (define-public perl-image-magick
112 (package
113 (name "perl-image-magick")
114 (version "6.89")
115 (source
116 (origin
117 (method url-fetch)
118 (uri (string-append "mirror://cpan/authors/id/J/JC/JCRISTY/"
119 "PerlMagick-" version "-1.tar.gz"))
120 (sha256
121 (base32
122 "0n9afy1z5bhf9phrbahnkwhgcmijn8jggpbzwrivw1zhliliiy68"))))
123 (build-system perl-build-system)
124 (native-inputs `(("pkg-config" ,pkg-config)))
125 (inputs `(("imagemagick" ,imagemagick)))
126 (arguments
127 `(#:phases
128 (modify-phases %standard-phases
129 (add-before
130 'configure 'image-magick-flags
131 (lambda* (#:key inputs #:allow-other-keys)
132 (let ((im (assoc-ref inputs "imagemagick")))
133 (substitute* "Makefile.PL"
134 (("my \\$INC_magick = .*")
135 "my $INC_magick = `pkg-config --cflags ImageMagick`;\n")
136 (("my \\$LIBS_magick = .*")
137 "my $LIBS_magick = `pkg-config --libs ImageMagick`;\n")))))
138 (add-before
139 'check 'skip-mpeg-tests
140 (lambda _
141 ;; TODO: MPEG tests fail even though our imagemagick supports
142 ;; MPEG. Has been reported elsewhere,
143 ;; http://www.imagemagick.org/discourse-server/viewtopic.php?f=7&t=25036,
144 ;; so skip for now.
145 (delete-file "t/mpeg/read.t"))))))
146 (home-page "http://search.cpan.org/dist/PerlMagick")
147 (synopsis "Perl interface to ImageMagick")
148 (description "This Perl extension allows the reading, manipulation and
149 writing of a large number of image file formats using the ImageMagick library.
150 Use it to create, edit, compose, or convert bitmap images from within a Perl
151 script.")
152 ;; See Magick.pm
153 (license (package-license imagemagick))))
154
155 (define-public graphicsmagick
156 (package
157 (name "graphicsmagick")
158 (version "1.3.23")
159 (source (origin
160 (method url-fetch)
161 (uri (string-append "ftp://ftp.graphicsmagick.org/pub/"
162 "GraphicsMagick/" (version-major+minor version)
163 "/GraphicsMagick-" version ".tar.xz"))
164 (sha256
165 (base32
166 "03g6l2h8cmf231y1vma0z7x85070jm1ysgs9ppqcd3jj56jka9gx"))))
167 (build-system gnu-build-system)
168 (arguments
169 `(#:configure-flags
170 (list "--with-frozenpaths"
171 "--enable-shared=yes"
172 "--with-x=yes"
173 (string-append "--with-gs-font-dir="
174 (assoc-ref %build-inputs "gs-fonts")
175 "/share/fonts/type1/ghostscript"))))
176 (inputs
177 `(("graphviz" ,graphviz)
178 ("ghostscript" ,ghostscript)
179 ("gs-fonts" ,gs-fonts)
180 ("lcms" ,lcms)
181 ("libx11" ,libx11)
182 ("libxml2" ,libxml2)
183 ("libtiff" ,libtiff)
184 ("libpng" ,libpng)
185 ("libjpeg" ,libjpeg)
186 ("freetype" ,freetype)
187 ("bzip2" ,bzip2)
188 ("xz" ,xz)
189 ("zlib" ,zlib)))
190 (native-inputs
191 `(("pkg-config" ,pkg-config)))
192 (outputs '("out" ; 13 MiB
193 "doc")) ; ~7 MiB
194 (home-page "http://www.graphicsmagick.org")
195 (synopsis "Create, edit, compose, or convert bitmap images")
196 (description
197 "GraphicsMagick provides a comprehensive collection of utilities,
198 programming interfaces, and GUIs, to support file format conversion, image
199 processing, and 2D vector rendering.")
200 (license license:expat)))