imagemagick.scm 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  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>
  12. ;;;
  13. ;;; This file is part of GNU Guix.
  14. ;;;
  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.
  19. ;;;
  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.
  24. ;;;
  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/>.
  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. #:use-module (srfi srfi-1))
  46. ;; This is a variant of the 'imagemagick' package that is not updated often.
  47. ;; It is intended to be used as a native-input at build-time only, e.g. by
  48. ;; 'gtk-doc' (via 'dblatex') for generating package documentation. This
  49. ;; allows the main 'imagemagick' package to be freely updated on the 'master'
  50. ;; branch without triggering an excessive number of rebuilds.
  51. ;;
  52. ;; Normally the grafts mechanism would be used, but there are often
  53. ;; difficulties grafting imagemagick, e.g. because upstream changes the ABI
  54. ;; between micro version updates. Also, the overwhelming majority of
  55. ;; dependencies on imagemagick are via 'gtk-doc' in 'native-inputs', where
  56. ;; grafting is ineffective. See:
  57. ;; <https://lists.gnu.org/archive/html/guix-devel/2021-03/msg00381.html>.
  58. (define-public imagemagick/stable
  59. (hidden-package
  60. (package
  61. (name "imagemagick")
  62. ;; The 7 release series has an incompatible API, while the 6 series is still
  63. ;; maintained. Don't update to 7 until we've made sure that the ImageMagick
  64. ;; users are ready for the 7-series API.
  65. (version "6.9.11-48")
  66. (source (origin
  67. (method url-fetch)
  68. (uri (string-append "mirror://imagemagick/ImageMagick-"
  69. version ".tar.xz"))
  70. (sha256
  71. (base32
  72. "0m8nkmywkqwyrr01q7aiakj6mi4rb2psjgzv8n0x82x3s1rpfyql"))))
  73. (build-system gnu-build-system)
  74. (arguments
  75. `(#:configure-flags '("--with-frozenpaths" "--without-gcc-arch"
  76. ;; Do not embed the build date in binaries.
  77. "--enable-reproducible-build")
  78. ;; FIXME: The test suite succeeded before version 6.9.6-2.
  79. ;; Try enabling it again with newer releases.
  80. #:tests? #f
  81. #:phases (modify-phases %standard-phases
  82. (add-before
  83. 'build 'pre-build
  84. (lambda* (#:key outputs #:allow-other-keys)
  85. (substitute* "Makefile"
  86. ;; Clear the `LIBRARY_PATH' setting, which otherwise
  87. ;; interferes with our own use.
  88. (("^LIBRARY_PATH[[:blank:]]*=.*$")
  89. "")
  90. ;; Since the Makefile overrides $docdir, modify it to
  91. ;; refer to what we want.
  92. (("^DOCUMENTATION_PATH[[:blank:]]*=.*$")
  93. (let ((doc (assoc-ref outputs "doc")))
  94. (string-append "DOCUMENTATION_PATH = "
  95. doc "/share/doc/"
  96. ,name "-"
  97. ,(package-version this-package) "\n"))))
  98. #t))
  99. (add-before
  100. 'configure 'strip-configure-xml
  101. (lambda _
  102. (substitute* "config/configure.xml.in"
  103. ;; Do not record 'configure' arguments in the
  104. ;; configure.xml file that gets installed: That would
  105. ;; include --docdir, and thus retain a reference to the
  106. ;; 'doc' output.
  107. (("@CONFIGURE_ARGS@")
  108. "not recorded"))
  109. #t)))))
  110. ;; TODO: Add Jasper etc.
  111. (inputs `(("fftw" ,fftw)
  112. ("graphviz" ,graphviz)
  113. ("ghostscript" ,ghostscript)
  114. ("lcms" ,lcms)
  115. ("libx11" ,libx11)
  116. ("zlib" ,zlib)
  117. ("libxml2" ,libxml2)
  118. ("libtiff" ,libtiff)
  119. ("libpng" ,libpng)
  120. ("libjpeg" ,libjpeg-turbo)
  121. ("pango" ,pango)
  122. ("freetype" ,freetype)
  123. ("bzip2" ,bzip2)
  124. ("xz" ,xz)))
  125. (native-inputs (list pkg-config))
  126. (outputs '("out"
  127. "doc")) ; 26 MiB of HTML documentation
  128. (home-page "https://www.imagemagick.org/")
  129. (synopsis "Create, edit, compose, or convert bitmap images")
  130. (description
  131. "ImageMagick is a software suite to create, edit, compose, or convert
  132. bitmap images. It can read and write images in a variety of formats (over 100)
  133. including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG,
  134. and TIFF. Use ImageMagick to resize, flip, mirror, rotate, distort, shear and
  135. transform images, adjust image colors, apply various special effects, or draw
  136. text, lines, polygons, ellipses and Bézier curves.")
  137. (license (license:fsf-free "http://www.imagemagick.org/script/license.php")))))
  138. (define-public imagemagick
  139. (package
  140. (inherit imagemagick/stable)
  141. (properties (alist-delete 'hidden? (package-properties imagemagick/stable)))
  142. ;; The 7 release series has an incompatible API, while the 6 series is still
  143. ;; maintained. Don't update to 7 until we've made sure that the ImageMagick
  144. ;; users are ready for the 7-series API.
  145. (version "6.9.12-4")
  146. (source (origin
  147. (method url-fetch)
  148. (uri (string-append "mirror://imagemagick/ImageMagick-"
  149. version ".tar.xz"))
  150. (sha256
  151. (base32
  152. "1pkwij76yz7vd5grl6520pgpa912qb6kh34qamx4zfndwcx6cf6b"))
  153. (patches
  154. (search-patches "imagemagick-ReadDCMImage-fix.patch"
  155. "imagemagick-ReadDCMPixels-fix.patch"
  156. "imagemagick-WriteTHUMBNAILImage-fix.patch"
  157. "imagemagick-CVE-2020-27829.patch"))))))
  158. (define-public perl-image-magick
  159. (package
  160. (name "perl-image-magick")
  161. (version "6.89")
  162. (source
  163. (origin
  164. (method url-fetch)
  165. (uri (string-append "mirror://cpan/authors/id/J/JC/JCRISTY/"
  166. "PerlMagick-" version "-1.tar.gz"))
  167. (sha256
  168. (base32
  169. "0n9afy1z5bhf9phrbahnkwhgcmijn8jggpbzwrivw1zhliliiy68"))))
  170. (build-system perl-build-system)
  171. (native-inputs (list pkg-config))
  172. (inputs (list imagemagick))
  173. (arguments
  174. `(#:tests? #f ;;Failed 2/23 test programs. 2/353 subtests failed.
  175. #:phases
  176. (modify-phases %standard-phases
  177. (add-before
  178. 'configure 'image-magick-flags
  179. (lambda* (#:key inputs #:allow-other-keys)
  180. (let ((im (assoc-ref inputs "imagemagick")))
  181. (substitute* "Makefile.PL"
  182. (("my \\$INC_magick = .*")
  183. "my $INC_magick = `pkg-config --cflags ImageMagick`;\n")
  184. (("my \\$LIBS_magick = .*")
  185. "my $LIBS_magick = `pkg-config --libs ImageMagick`;\n"))
  186. #t)))
  187. (add-before
  188. 'check 'skip-mpeg-tests
  189. (lambda _
  190. ;; TODO: MPEG tests fail even though our imagemagick supports
  191. ;; MPEG. Has been reported elsewhere,
  192. ;; http://www.imagemagick.org/discourse-server/viewtopic.php?f=7&t=25036,
  193. ;; so skip for now.
  194. (delete-file "t/mpeg/read.t")
  195. #t)))))
  196. (home-page "https://metacpan.org/release/PerlMagick")
  197. (synopsis "Perl interface to ImageMagick")
  198. (description "This Perl extension allows the reading, manipulation and
  199. writing of a large number of image file formats using the ImageMagick library.
  200. Use it to create, edit, compose, or convert bitmap images from within a Perl
  201. script.")
  202. ;; See Magick.pm
  203. (license (package-license imagemagick))))
  204. (define-public graphicsmagick
  205. (package
  206. (name "graphicsmagick")
  207. (version "1.3.36")
  208. (source
  209. (origin
  210. (method url-fetch)
  211. (uri
  212. (list
  213. (string-append "mirror://sourceforge/graphicsmagick/graphicsmagick"
  214. "/" version "/GraphicsMagick-" version ".tar.xz")
  215. (string-append "ftp://ftp.graphicsmagick.org/pub/"
  216. "GraphicsMagick/" (version-major+minor version)
  217. "/GraphicsMagick-" version ".tar.xz")))
  218. (sha256
  219. (base32
  220. "0ilg6fkppb4avzais1dvi3qf6ln7v3mzj7gjm83w7pwwfpg3ynsx"))))
  221. (build-system gnu-build-system)
  222. (arguments
  223. `(#:configure-flags
  224. (list "--with-frozenpaths"
  225. "--enable-shared=yes"
  226. "--with-x=yes"
  227. "--with-quantum-depth=16" ; required by Octave
  228. "--enable-quantum-library-names"
  229. (string-append "--with-gs-font-dir="
  230. (assoc-ref %build-inputs "font-ghostscript")
  231. "/share/fonts/type1/ghostscript"))))
  232. (inputs
  233. `(("graphviz" ,graphviz)
  234. ("ghostscript" ,ghostscript)
  235. ("font-ghostscript" ,font-ghostscript)
  236. ("lcms" ,lcms)
  237. ("libx11" ,libx11)
  238. ("libxml2" ,libxml2)
  239. ("libtiff" ,libtiff)
  240. ("libpng" ,libpng)
  241. ("libjpeg" ,libjpeg-turbo)
  242. ("libwebp" ,libwebp)
  243. ("freetype" ,freetype)
  244. ("bzip2" ,bzip2)
  245. ("xz" ,xz)
  246. ("zlib" ,zlib)))
  247. (native-inputs
  248. (list pkg-config))
  249. (outputs '("out" ; 13 MiB
  250. "doc")) ; ~7 MiB
  251. (home-page "http://www.graphicsmagick.org")
  252. (synopsis "Create, edit, compose, or convert bitmap images")
  253. (description
  254. "GraphicsMagick provides a comprehensive collection of utilities,
  255. programming interfaces, and GUIs, to support file format conversion, image
  256. processing, and 2D vector rendering.")
  257. (license license:expat)))