gnu: gdk-pixbuf: Remove graft for 2.36.10.
[jackhill/guix/guix.git] / gnu / packages / gd.scm
CommitLineData
d517142b 1;;; GNU Guix --- Functional package management for GNU
bbb5d8ae 2;;; Copyright © 2013, 2016 Ludovic Courtès <ludo@gnu.org>
27326064 3;;; Copyright © 2015, 2016 Mark H Weaver <mhw@netris.org>
f7ee7a9b 4;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
3f0603ea 5;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
7ed7be3c 6;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
4f681561 7;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
d517142b
LC
8;;;
9;;; This file is part of GNU Guix.
10;;;
11;;; GNU Guix is free software; you can redistribute it and/or modify it
12;;; under the terms of the GNU General Public License as published by
13;;; the Free Software Foundation; either version 3 of the License, or (at
14;;; your option) any later version.
15;;;
16;;; GNU Guix is distributed in the hope that it will be useful, but
17;;; WITHOUT ANY WARRANTY; without even the implied warranty of
18;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;;; GNU General Public License for more details.
20;;;
21;;; You should have received a copy of the GNU General Public License
22;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
23
24(define-module (gnu packages gd)
25 #:use-module (guix packages)
26 #:use-module (guix build-system gnu)
f7ee7a9b 27 #:use-module (guix build-system perl)
d517142b 28 #:use-module (guix download)
fdbd19ea 29 #:use-module (gnu packages)
f7ee7a9b 30 #:use-module (gnu packages perl)
e55354b8 31 #:use-module (gnu packages image)
d8ae0acc 32 #:use-module (gnu packages imagemagick)
d517142b
LC
33 #:use-module (gnu packages fontutils)
34 #:use-module (gnu packages compression)
b01a0ba8 35 #:use-module (gnu packages pkg-config)
2f3108ad 36 #:use-module ((guix licenses) #:select (non-copyleft perl-license)))
d517142b
LC
37
38(define-public gd
39 (package
40 (name "gd")
4f681561 41 (replacement gd-2.2.5)
b5d08d7c 42 ;; Note: With libgd.org now pointing to github.com, genuine old
b01a0ba8 43 ;; tarballs are no longer available. Notably, versions 2.0.x are
d517142b 44 ;; missing.
c134959b 45 (version "2.2.4")
d517142b
LC
46 (source (origin
47 (method url-fetch)
b01a0ba8 48 (uri (string-append
b5d08d7c
LF
49 "https://github.com/libgd/libgd/releases/download/gd-"
50 version "/libgd-" version ".tar.xz"))
d517142b
LC
51 (sha256
52 (base32
c134959b
LF
53 "1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk"))
54 (patches (search-patches "gd-fix-gd2-read-test.patch"
56a44e2d 55 "gd-fix-tests-on-i686.patch"
e8293ef1
JL
56 "gd-freetype-test-failure.patch"
57 "gd-php-73968-Fix-109-XBM-reading.patch"))))
d517142b 58 (build-system gnu-build-system)
c134959b 59 (arguments
7ed7be3c
EF
60 ;; As recommended by github.com/libgd/libgd/issues/278 to fix rounding
61 ;; issues on aarch64 and other architectures.
62 `(#:make-flags '("CFLAGS=-ffp-contract=off")
63 #:phases
c134959b
LF
64 (modify-phases %standard-phases
65 ;; This test is known to fail on i686-linux:
66 ;; https://github.com/libgd/libgd/issues/359
67 ;; TODO Replace this substitution with an upstream bug fix.
68 (add-after 'unpack 'disable-failing-test
69 (lambda _
70 (substitute* "tests/gdimagegrayscale/basic.c"
71 (("return gdNumFailures\\(\\)")
7ed7be3c
EF
72 "return 0"))
73 #t)))))
b01a0ba8
MW
74 (native-inputs
75 `(("pkg-config" ,pkg-config)))
d517142b
LC
76 (inputs
77 `(("freetype" ,freetype)
78 ("libpng" ,libpng)
79 ("zlib" ,zlib)))
80 (propagated-inputs
81 `(("fontconfig" ,fontconfig)
82 ("libjpeg" ,libjpeg)))
83 (home-page "http://www.libgd.org/")
84 (synopsis "Library for the dynamic creation of images by programmers")
85 (description
86 "GD is a library for the dynamic creation of images by programmers. GD
87is written in C, and \"wrappers\" are available for Perl, PHP and other
88languages. GD creates PNG, JPEG, GIF, WebP, XPM, BMP images, among other
89formats. GD is commonly used to generate charts, graphics, thumbnails, and
90most anything else, on the fly. While not restricted to use on the web, the
91most common applications of GD involve website development.")
166191b3 92 (license (non-copyleft "file://COPYING"
bbb5d8ae
LC
93 "See COPYING file in the distribution."))
94 (properties '((cpe-name . "libgd")))))
f7ee7a9b 95
4f681561
MB
96;; For CVE-2017-6362 and CVE-2017-7890.
97(define-public gd-2.2.5
98 (package
99 (inherit gd)
100 (version "2.2.5")
101 (source (origin
102 (method url-fetch)
103 (uri (string-append
104 "https://github.com/libgd/libgd/releases/download/gd-"
105 version "/libgd-" version ".tar.xz"))
106 (patches (search-patches "gd-fix-tests-on-i686.patch"
107 "gd-freetype-test-failure.patch"))
108 (sha256
109 (base32
110 "0lfy5f241sbv8s3splm2zqiaxv7lxrcshh875xryryk7yk5jqc4c"))))))
111
f7ee7a9b
EB
112(define-public perl-gd
113 (package
114 (name "perl-gd")
115 (version "2.56")
116 (source
117 (origin
118 (method url-fetch)
119 (uri (string-append "mirror://cpan/authors/id/L/LD/LDS/"
120 "GD-" version ".tar.gz"))
121 (sha256
122 (base32
123 "1ya8f9hpiax8j29vwaiwlvvgah0vkyvpzva28r8231nyk0f3s40z"))
fc1adab1
AK
124 (patches (search-patches
125 "perl-gd-options-passthrough-and-fontconfig.patch"))))
f7ee7a9b
EB
126 (build-system perl-build-system)
127 (native-inputs
128 `(("perl-module-build" ,perl-module-build))) ;needs Module::Build >= 0.42
129 (inputs
130 `(("gd" ,gd)
131 ("zlib" ,zlib)
132 ("png" ,libpng)
133 ("ft" ,freetype)
134 ("jpeg" ,libjpeg)
135 ("fontconfig" ,fontconfig)))
136 (arguments
137 ;; We must use Build.PL for building because Makefile.PL fails to build
138 ;; the XS source.
139 `(#:module-build-flags (map (lambda (i)
140 (string-append "--lib_" i "_path="
141 (assoc-ref %build-inputs i)))
142 '("zlib" "png" "ft" "jpeg" "fontconfig"))
2792a6b4 143 #:tests? #f ;; Failed 1/2 test programs. 1/12 subtests failed.
f7ee7a9b
EB
144 #:phases (alist-cons-after
145 'configure 'clear-autogenerated-files
146 (lambda _
147 ;; This file is autogenerated by its .PLS script at build
148 ;; time, but file creation fails because that file already
149 ;; exists in the distribution with non-writable
150 ;; permissions, so delete it first.
151 (delete-file "bdf_scripts/bdf2gdfont.pl"))
152 %standard-phases)))
153 (home-page "http://search.cpan.org/dist/GD")
154 (synopsis "Perl interface to the GD graphics library")
155 (description "GD.pm is an autoloadable interface module for libgd, a
156popular library for creating and manipulating PNG files. With this library
157you can create PNG images on the fly or modify existing files.")
2f3108ad 158 (license perl-license)))
d8ae0acc
EB
159
160(define-public perl-gd-securityimage
161 (package
162 (name "perl-gd-securityimage")
163 (version "1.73")
164 (source
165 (origin
166 (method url-fetch)
167 (uri (string-append "mirror://cpan/authors/id/B/BU/BURAK/"
168 "GD-SecurityImage-" version ".tar.gz"))
169 (sha256
170 (base32
171 "1kaxs67rfd4w46lxgcg3pa05a596l0h1k8n4zk2gwrrar4022wpx"))))
172 (build-system perl-build-system)
201c0e72
LF
173 (arguments
174 '(#:phases
175 (modify-phases %standard-phases
176 (add-after 'unpack 'set-env
177 (lambda _ (setenv "PERL_USE_UNSAFE_INC" "1"))))))
d8ae0acc
EB
178 (native-inputs
179 `(("perl-module-build" ,perl-module-build)))
180 (propagated-inputs
181 `(("perl-gd" ,perl-gd)
182 ("perl-image-magick" ,perl-image-magick)))
183 (home-page "http://search.cpan.org/dist/GD-SecurityImage")
e881752c 184 (synopsis "Security image generator")
d8ae0acc
EB
185 (description "This module provides a basic interface to create
186security (captcha) images. The final output is the actual graphic data, the
187mime type of the graphic, and the created random string. The module also has
188some \"styles\" that are used to create the background (or foreground) of the
189image.")
2f3108ad 190 (license perl-license)))