Merge branch 'master' into staging
[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 ;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
6 ;;; Copyright © 2016 Mark H Weaver <mhw@netris.org>
7 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
8 ;;; Copyright © 2018, 2019 Tobias Geerinckx-Rice <me@tobias.gr>
9 ;;; Copyright © 2018 Alex Vong <alexvong1995@gmail.com>
10 ;;; Copyright © 2020 Marius Bakke <marius@gnu.org>
11 ;;;
12 ;;; This file is part of GNU Guix.
13 ;;;
14 ;;; GNU Guix is free software; you can redistribute it and/or modify it
15 ;;; under the terms of the GNU General Public License as published by
16 ;;; the Free Software Foundation; either version 3 of the License, or (at
17 ;;; your option) any later version.
18 ;;;
19 ;;; GNU Guix is distributed in the hope that it will be useful, but
20 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
21 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 ;;; GNU General Public License for more details.
23 ;;;
24 ;;; You should have received a copy of the GNU General Public License
25 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
26
27 (define-module (gnu packages imagemagick)
28 #:use-module (guix packages)
29 #:use-module (guix build-system gnu)
30 #:use-module (guix build-system perl)
31 #:use-module (guix download)
32 #:use-module (guix utils)
33 #:use-module ((guix licenses) #:prefix license:)
34 #:use-module (gnu packages)
35 #:use-module (gnu packages algebra)
36 #:use-module (gnu packages compression)
37 #:use-module (gnu packages fontutils)
38 #:use-module (gnu packages ghostscript)
39 #:use-module (gnu packages graphviz)
40 #:use-module (gnu packages gtk)
41 #:use-module (gnu packages image)
42 #:use-module (gnu packages pkg-config)
43 #:use-module (gnu packages xml)
44 #:use-module (gnu packages xorg))
45
46 (define-public imagemagick
47 (package
48 (name "imagemagick")
49 ;; The 7 release series has an incompatible API, while the 6 series is still
50 ;; maintained. Don't update to 7 until we've made sure that the ImageMagick
51 ;; users are ready for the 7-series API.
52 (version "6.9.11-34")
53 (source (origin
54 (method url-fetch)
55 (uri (string-append "mirror://imagemagick/ImageMagick-"
56 version ".tar.xz"))
57 (sha256
58 (base32
59 "0acdjkkgjgpfcwj9h9zncywjjrrgb9sh0cvfn3jamjxh5byf638s"))))
60 (build-system gnu-build-system)
61 (arguments
62 `(#:configure-flags '("--with-frozenpaths" "--without-gcc-arch"
63
64 ;; Do not embed the build date in binaries.
65 "--enable-reproducible-build")
66
67 ;; FIXME: The test suite succeeded before version 6.9.6-2.
68 ;; Try enabling it again with newer releases.
69 #:tests? #f
70 #:phases (modify-phases %standard-phases
71 (add-before
72 'build 'pre-build
73 (lambda* (#:key outputs #:allow-other-keys)
74 (substitute* "Makefile"
75 ;; Clear the `LIBRARY_PATH' setting, which otherwise
76 ;; interferes with our own use.
77 (("^LIBRARY_PATH[[:blank:]]*=.*$")
78 "")
79
80 ;; Since the Makefile overrides $docdir, modify it to
81 ;; refer to what we want.
82 (("^DOCUMENTATION_PATH[[:blank:]]*=.*$")
83 (let ((doc (assoc-ref outputs "doc")))
84 (string-append "DOCUMENTATION_PATH = "
85 doc "/share/doc/"
86 ,name "-" ,version "\n"))))
87 #t))
88 (add-before
89 'configure 'strip-configure-xml
90 (lambda _
91 (substitute* "config/configure.xml.in"
92 ;; Do not record 'configure' arguments in the
93 ;; configure.xml file that gets installed: That would
94 ;; include --docdir, and thus retain a reference to the
95 ;; 'doc' output.
96 (("@CONFIGURE_ARGS@")
97 "not recorded"))
98 #t)))))
99 ;; TODO: Add Jasper etc.
100 (inputs `(("fftw" ,fftw)
101 ("graphviz" ,graphviz)
102 ("ghostscript" ,ghostscript)
103 ("lcms" ,lcms)
104 ("libx11" ,libx11)
105 ("zlib" ,zlib)
106 ("libxml2" ,libxml2)
107 ("libtiff" ,libtiff)
108 ("libpng" ,libpng)
109 ("libjpeg" ,libjpeg-turbo)
110 ("pango" ,pango)
111 ("freetype" ,freetype)
112 ("bzip2" ,bzip2)
113 ("xz" ,xz)))
114 (native-inputs `(("pkg-config" ,pkg-config)))
115 (outputs '("out"
116 "doc")) ; 26 MiB of HTML documentation
117 (home-page "https://www.imagemagick.org/")
118 (synopsis "Create, edit, compose, or convert bitmap images")
119 (description
120 "ImageMagick is a software suite to create, edit, compose, or convert
121 bitmap images. It can read and write images in a variety of formats (over 100)
122 including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG,
123 and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and
124 transform images, adjust image colors, apply various special effects, or draw
125 text, lines, polygons, ellipses and Bézier curves.")
126 (license (license:fsf-free "http://www.imagemagick.org/script/license.php"))))
127
128 ;; XXX: 'transcode' fails to detect the above ImageMagick, so we provide
129 ;; this newer version.
130 (define-public imagemagick-next
131 (package
132 (inherit imagemagick)
133 (version "6.9.11-37")
134 (source (origin
135 (method url-fetch)
136 (uri (string-append "mirror://imagemagick/ImageMagick-"
137 version ".tar.xz"))
138 (sha256
139 (base32
140 "19r6fyhr1bycx0p6jz034mil1zh2k7hfr02is40h4g3wf9b9sdni"))))))
141
142 (define-public perl-image-magick
143 (package
144 (name "perl-image-magick")
145 (version "6.89")
146 (source
147 (origin
148 (method url-fetch)
149 (uri (string-append "mirror://cpan/authors/id/J/JC/JCRISTY/"
150 "PerlMagick-" version "-1.tar.gz"))
151 (sha256
152 (base32
153 "0n9afy1z5bhf9phrbahnkwhgcmijn8jggpbzwrivw1zhliliiy68"))))
154 (build-system perl-build-system)
155 (native-inputs `(("pkg-config" ,pkg-config)))
156 (inputs `(("imagemagick" ,imagemagick)))
157 (arguments
158 `(#:tests? #f ;;Failed 2/23 test programs. 2/353 subtests failed.
159 #:phases
160 (modify-phases %standard-phases
161 (add-before
162 'configure 'image-magick-flags
163 (lambda* (#:key inputs #:allow-other-keys)
164 (let ((im (assoc-ref inputs "imagemagick")))
165 (substitute* "Makefile.PL"
166 (("my \\$INC_magick = .*")
167 "my $INC_magick = `pkg-config --cflags ImageMagick`;\n")
168 (("my \\$LIBS_magick = .*")
169 "my $LIBS_magick = `pkg-config --libs ImageMagick`;\n"))
170 #t)))
171 (add-before
172 'check 'skip-mpeg-tests
173 (lambda _
174 ;; TODO: MPEG tests fail even though our imagemagick supports
175 ;; MPEG. Has been reported elsewhere,
176 ;; http://www.imagemagick.org/discourse-server/viewtopic.php?f=7&t=25036,
177 ;; so skip for now.
178 (delete-file "t/mpeg/read.t")
179 #t)))))
180 (home-page "https://metacpan.org/release/PerlMagick")
181 (synopsis "Perl interface to ImageMagick")
182 (description "This Perl extension allows the reading, manipulation and
183 writing of a large number of image file formats using the ImageMagick library.
184 Use it to create, edit, compose, or convert bitmap images from within a Perl
185 script.")
186 ;; See Magick.pm
187 (license (package-license imagemagick))))
188
189 (define-public graphicsmagick
190 (package
191 (name "graphicsmagick")
192 (version "1.3.35")
193 (source
194 (origin
195 (method url-fetch)
196 (uri
197 (list
198 (string-append "mirror://sourceforge/graphicsmagick/graphicsmagick"
199 "/" version "/GraphicsMagick-" version ".tar.xz")
200 (string-append "ftp://ftp.graphicsmagick.org/pub/"
201 "GraphicsMagick/" (version-major+minor version)
202 "/GraphicsMagick-" version ".tar.xz")))
203 (sha256
204 (base32
205 "0l024l4hawm9s3jqrgi2j0lxgm61dqh8sgkj1017ma7y11hqv2hq"))))
206 (build-system gnu-build-system)
207 (arguments
208 `(#:configure-flags
209 (list "--with-frozenpaths"
210 "--enable-shared=yes"
211 "--with-x=yes"
212 "--with-quantum-depth=16" ; required by Octave
213 "--enable-quantum-library-names"
214 (string-append "--with-gs-font-dir="
215 (assoc-ref %build-inputs "gs-fonts")
216 "/share/fonts/type1/ghostscript"))))
217 (inputs
218 `(("graphviz" ,graphviz)
219 ("ghostscript" ,ghostscript)
220 ("gs-fonts" ,gs-fonts)
221 ("lcms" ,lcms)
222 ("libx11" ,libx11)
223 ("libxml2" ,libxml2)
224 ("libtiff" ,libtiff)
225 ("libpng" ,libpng)
226 ("libjpeg" ,libjpeg-turbo)
227 ("freetype" ,freetype)
228 ("bzip2" ,bzip2)
229 ("xz" ,xz)
230 ("zlib" ,zlib)))
231 (native-inputs
232 `(("pkg-config" ,pkg-config)))
233 (outputs '("out" ; 13 MiB
234 "doc")) ; ~7 MiB
235 (home-page "http://www.graphicsmagick.org")
236 (synopsis "Create, edit, compose, or convert bitmap images")
237 (description
238 "GraphicsMagick provides a comprehensive collection of utilities,
239 programming interfaces, and GUIs, to support file format conversion, image
240 processing, and 2D vector rendering.")
241 (license license:expat)))