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, 2021 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 ;;; Copyright © 2020 Vinicius Monego <monego@posteo.net>
13 ;;; This file is part of GNU Guix.
15 ;;; GNU Guix is free software; you can redistribute it and/or modify it
16 ;;; under the terms of the GNU General Public License as published by
17 ;;; the Free Software Foundation; either version 3 of the License, or (at
18 ;;; your option) any later version.
20 ;;; GNU Guix is distributed in the hope that it will be useful, but
21 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
22 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 ;;; GNU General Public License for more details.
25 ;;; You should have received a copy of the GNU General Public License
26 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
28 (define-module (gnu packages imagemagick)
29 #:use-module (guix packages)
30 #:use-module (guix build-system gnu)
31 #:use-module (guix build-system perl)
32 #:use-module (guix download)
33 #:use-module (guix utils)
34 #:use-module ((guix licenses) #:prefix license:)
35 #:use-module (gnu packages)
36 #:use-module (gnu packages algebra)
37 #:use-module (gnu packages compression)
38 #:use-module (gnu packages fontutils)
39 #:use-module (gnu packages ghostscript)
40 #:use-module (gnu packages graphviz)
41 #:use-module (gnu packages gtk)
42 #:use-module (gnu packages image)
43 #:use-module (gnu packages pkg-config)
44 #:use-module (gnu packages xml)
45 #:use-module (gnu packages xorg)
46 #:use-module (srfi srfi-1))
48 ;; This is a variant of the 'imagemagick' package that is not updated often.
49 ;; It is intended to be used as a native-input at build-time only, e.g. by
50 ;; 'gtk-doc' (via 'dblatex') for generating package documentation. This
51 ;; allows the main 'imagemagick' package to be freely updated on the 'master'
52 ;; branch without triggering an excessive number of rebuilds.
54 ;; Normally the grafts mechanism would be used, but there are often
55 ;; difficulties grafting imagemagick, e.g. because upstream changes the ABI
56 ;; between micro version updates. Also, the overwhelming majority of
57 ;; dependencies on imagemagick are via 'gtk-doc' in 'native-inputs', where
58 ;; grafting is ineffective. See:
59 ;; <https://lists.gnu.org/archive/html/guix-devel/2021-03/msg00381.html>.
60 (define-public imagemagick/stable
64 ;; The 7 release series has an incompatible API, while the 6 series is still
65 ;; maintained. Don't update to 7 until we've made sure that the ImageMagick
66 ;; users are ready for the 7-series API.
70 (uri (string-append "mirror://imagemagick/ImageMagick-"
74 "0m8nkmywkqwyrr01q7aiakj6mi4rb2psjgzv8n0x82x3s1rpfyql"))))
75 (build-system gnu-build-system)
77 `(#:configure-flags '("--with-frozenpaths" "--without-gcc-arch"
79 ;; Do not embed the build date in binaries.
80 "--enable-reproducible-build")
82 ;; FIXME: The test suite succeeded before version 6.9.6-2.
83 ;; Try enabling it again with newer releases.
85 #:phases (modify-phases %standard-phases
88 (lambda* (#:key outputs #:allow-other-keys)
89 (substitute* "Makefile"
90 ;; Clear the `LIBRARY_PATH' setting, which otherwise
91 ;; interferes with our own use.
92 (("^LIBRARY_PATH[[:blank:]]*=.*$")
95 ;; Since the Makefile overrides $docdir, modify it to
96 ;; refer to what we want.
97 (("^DOCUMENTATION_PATH[[:blank:]]*=.*$")
98 (let ((doc (assoc-ref outputs "doc")))
99 (string-append "DOCUMENTATION_PATH = "
102 ,(package-version this-package) "\n"))))
105 'configure 'strip-configure-xml
107 (substitute* "config/configure.xml.in"
108 ;; Do not record 'configure' arguments in the
109 ;; configure.xml file that gets installed: That would
110 ;; include --docdir, and thus retain a reference to the
112 (("@CONFIGURE_ARGS@")
115 ;; TODO: Add Jasper etc.
116 (inputs `(("fftw" ,fftw)
117 ("graphviz" ,graphviz)
118 ("ghostscript" ,ghostscript)
125 ("libjpeg" ,libjpeg-turbo)
127 ("freetype" ,freetype)
130 (native-inputs `(("pkg-config" ,pkg-config)))
132 "doc")) ; 26 MiB of HTML documentation
133 (home-page "https://www.imagemagick.org/")
134 (synopsis "Create, edit, compose, or convert bitmap images")
136 "ImageMagick is a software suite to create, edit, compose, or convert
137 bitmap images. It can read and write images in a variety of formats (over 100)
138 including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG,
139 and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and
140 transform images, adjust image colors, apply various special effects, or draw
141 text, lines, polygons, ellipses and Bézier curves.")
142 (license (license:fsf-free "http://www.imagemagick.org/script/license.php")))))
144 (define-public imagemagick
146 (inherit imagemagick/stable)
147 (properties (alist-delete 'hidden? (package-properties imagemagick/stable)))
148 ;; The 7 release series has an incompatible API, while the 6 series is still
149 ;; maintained. Don't update to 7 until we've made sure that the ImageMagick
150 ;; users are ready for the 7-series API.
154 (uri (string-append "mirror://imagemagick/ImageMagick-"
158 "1pkwij76yz7vd5grl6520pgpa912qb6kh34qamx4zfndwcx6cf6b"))
160 (search-patches "imagemagick-ReadDCMImage-fix.patch"
161 "imagemagick-ReadDCMPixels-fix.patch"
162 "imagemagick-WriteTHUMBNAILImage-fix.patch"
163 "imagemagick-CVE-2020-27829.patch"))))))
165 (define-public perl-image-magick
167 (name "perl-image-magick")
172 (uri (string-append "mirror://cpan/authors/id/J/JC/JCRISTY/"
173 "PerlMagick-" version "-1.tar.gz"))
176 "0n9afy1z5bhf9phrbahnkwhgcmijn8jggpbzwrivw1zhliliiy68"))))
177 (build-system perl-build-system)
178 (native-inputs `(("pkg-config" ,pkg-config)))
179 (inputs `(("imagemagick" ,imagemagick)))
181 `(#:tests? #f ;;Failed 2/23 test programs. 2/353 subtests failed.
183 (modify-phases %standard-phases
185 'configure 'image-magick-flags
186 (lambda* (#:key inputs #:allow-other-keys)
187 (let ((im (assoc-ref inputs "imagemagick")))
188 (substitute* "Makefile.PL"
189 (("my \\$INC_magick = .*")
190 "my $INC_magick = `pkg-config --cflags ImageMagick`;\n")
191 (("my \\$LIBS_magick = .*")
192 "my $LIBS_magick = `pkg-config --libs ImageMagick`;\n"))
195 'check 'skip-mpeg-tests
197 ;; TODO: MPEG tests fail even though our imagemagick supports
198 ;; MPEG. Has been reported elsewhere,
199 ;; http://www.imagemagick.org/discourse-server/viewtopic.php?f=7&t=25036,
201 (delete-file "t/mpeg/read.t")
203 (home-page "https://metacpan.org/release/PerlMagick")
204 (synopsis "Perl interface to ImageMagick")
205 (description "This Perl extension allows the reading, manipulation and
206 writing of a large number of image file formats using the ImageMagick library.
207 Use it to create, edit, compose, or convert bitmap images from within a Perl
210 (license (package-license imagemagick))))
212 (define-public graphicsmagick
214 (name "graphicsmagick")
221 (string-append "mirror://sourceforge/graphicsmagick/graphicsmagick"
222 "/" version "/GraphicsMagick-" version ".tar.xz")
223 (string-append "ftp://ftp.graphicsmagick.org/pub/"
224 "GraphicsMagick/" (version-major+minor version)
225 "/GraphicsMagick-" version ".tar.xz")))
228 "0ilg6fkppb4avzais1dvi3qf6ln7v3mzj7gjm83w7pwwfpg3ynsx"))))
229 (build-system gnu-build-system)
232 (list "--with-frozenpaths"
233 "--enable-shared=yes"
235 "--with-quantum-depth=16" ; required by Octave
236 "--enable-quantum-library-names"
237 (string-append "--with-gs-font-dir="
238 (assoc-ref %build-inputs "gs-fonts")
239 "/share/fonts/type1/ghostscript"))))
241 `(("graphviz" ,graphviz)
242 ("ghostscript" ,ghostscript)
243 ("gs-fonts" ,gs-fonts)
249 ("libjpeg" ,libjpeg-turbo)
251 ("freetype" ,freetype)
256 `(("pkg-config" ,pkg-config)))
257 (outputs '("out" ; 13 MiB
259 (home-page "http://www.graphicsmagick.org")
260 (synopsis "Create, edit, compose, or convert bitmap images")
262 "GraphicsMagick provides a comprehensive collection of utilities,
263 programming interfaces, and GUIs, to support file format conversion, image
264 processing, and 2D vector rendering.")
265 (license license:expat)))