gnu: gd: Fix CVE-2016-{5766,6128,6132,6214}.
[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>
b01a0ba8 3;;; Copyright © 2015 Mark H Weaver <mhw@netris.org>
f7ee7a9b 4;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
fb2b0f5c 5;;; Copyright © 2016 Leo Famulari <leo@famulari.name>
d517142b
LC
6;;;
7;;; This file is part of GNU Guix.
8;;;
9;;; GNU Guix is free software; you can redistribute it and/or modify it
10;;; under the terms of the GNU General Public License as published by
11;;; the Free Software Foundation; either version 3 of the License, or (at
12;;; your option) any later version.
13;;;
14;;; GNU Guix is distributed in the hope that it will be useful, but
15;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17;;; GNU General Public License for more details.
18;;;
19;;; You should have received a copy of the GNU General Public License
20;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22(define-module (gnu packages gd)
23 #:use-module (guix packages)
24 #:use-module (guix build-system gnu)
f7ee7a9b 25 #:use-module (guix build-system perl)
d517142b 26 #:use-module (guix download)
fdbd19ea 27 #:use-module (gnu packages)
f7ee7a9b 28 #:use-module (gnu packages perl)
e55354b8 29 #:use-module (gnu packages image)
d8ae0acc 30 #:use-module (gnu packages imagemagick)
d517142b
LC
31 #:use-module (gnu packages fontutils)
32 #:use-module (gnu packages compression)
b01a0ba8 33 #:use-module (gnu packages pkg-config)
166191b3 34 #:use-module ((guix licenses) #:select (non-copyleft)))
d517142b
LC
35
36(define-public gd
37 (package
38 (name "gd")
39
b5d08d7c 40 ;; Note: With libgd.org now pointing to github.com, genuine old
b01a0ba8 41 ;; tarballs are no longer available. Notably, versions 2.0.x are
d517142b 42 ;; missing.
b9174ff4 43 (version "2.2.2")
d517142b
LC
44
45 (source (origin
46 (method url-fetch)
b01a0ba8 47 (uri (string-append
b5d08d7c
LF
48 "https://github.com/libgd/libgd/releases/download/gd-"
49 version "/libgd-" version ".tar.xz"))
a1537ac2
LF
50 (patches (search-patches "gd-CVE-2016-5766.patch"
51 "gd-CVE-2016-6128.patch"
52 "gd-CVE-2016-6132.patch"
53 "gd-CVE-2016-6214.patch"))
d517142b
LC
54 (sha256
55 (base32
b9174ff4 56 "1311g5mva2xlzqv3rjqjc4jjkn5lzls4skvr395h633zw1n7b7s8"))))
d517142b 57 (build-system gnu-build-system)
b01a0ba8
MW
58 (native-inputs
59 `(("pkg-config" ,pkg-config)))
d517142b
LC
60 (inputs
61 `(("freetype" ,freetype)
62 ("libpng" ,libpng)
63 ("zlib" ,zlib)))
64 (propagated-inputs
65 `(("fontconfig" ,fontconfig)
66 ("libjpeg" ,libjpeg)))
67 (home-page "http://www.libgd.org/")
68 (synopsis "Library for the dynamic creation of images by programmers")
69 (description
70 "GD is a library for the dynamic creation of images by programmers. GD
71is written in C, and \"wrappers\" are available for Perl, PHP and other
72languages. GD creates PNG, JPEG, GIF, WebP, XPM, BMP images, among other
73formats. GD is commonly used to generate charts, graphics, thumbnails, and
74most anything else, on the fly. While not restricted to use on the web, the
75most common applications of GD involve website development.")
166191b3 76 (license (non-copyleft "file://COPYING"
bbb5d8ae
LC
77 "See COPYING file in the distribution."))
78 (properties '((cpe-name . "libgd")))))
f7ee7a9b
EB
79
80(define-public perl-gd
81 (package
82 (name "perl-gd")
83 (version "2.56")
84 (source
85 (origin
86 (method url-fetch)
87 (uri (string-append "mirror://cpan/authors/id/L/LD/LDS/"
88 "GD-" version ".tar.gz"))
89 (sha256
90 (base32
91 "1ya8f9hpiax8j29vwaiwlvvgah0vkyvpzva28r8231nyk0f3s40z"))
fc1adab1
AK
92 (patches (search-patches
93 "perl-gd-options-passthrough-and-fontconfig.patch"))))
f7ee7a9b
EB
94 (build-system perl-build-system)
95 (native-inputs
96 `(("perl-module-build" ,perl-module-build))) ;needs Module::Build >= 0.42
97 (inputs
98 `(("gd" ,gd)
99 ("zlib" ,zlib)
100 ("png" ,libpng)
101 ("ft" ,freetype)
102 ("jpeg" ,libjpeg)
103 ("fontconfig" ,fontconfig)))
104 (arguments
105 ;; We must use Build.PL for building because Makefile.PL fails to build
106 ;; the XS source.
107 `(#:module-build-flags (map (lambda (i)
108 (string-append "--lib_" i "_path="
109 (assoc-ref %build-inputs i)))
110 '("zlib" "png" "ft" "jpeg" "fontconfig"))
111 #:phases (alist-cons-after
112 'configure 'clear-autogenerated-files
113 (lambda _
114 ;; This file is autogenerated by its .PLS script at build
115 ;; time, but file creation fails because that file already
116 ;; exists in the distribution with non-writable
117 ;; permissions, so delete it first.
118 (delete-file "bdf_scripts/bdf2gdfont.pl"))
119 %standard-phases)))
120 (home-page "http://search.cpan.org/dist/GD")
121 (synopsis "Perl interface to the GD graphics library")
122 (description "GD.pm is an autoloadable interface module for libgd, a
123popular library for creating and manipulating PNG files. With this library
124you can create PNG images on the fly or modify existing files.")
125 (license (package-license perl))))
d8ae0acc
EB
126
127(define-public perl-gd-securityimage
128 (package
129 (name "perl-gd-securityimage")
130 (version "1.73")
131 (source
132 (origin
133 (method url-fetch)
134 (uri (string-append "mirror://cpan/authors/id/B/BU/BURAK/"
135 "GD-SecurityImage-" version ".tar.gz"))
136 (sha256
137 (base32
138 "1kaxs67rfd4w46lxgcg3pa05a596l0h1k8n4zk2gwrrar4022wpx"))))
139 (build-system perl-build-system)
140 (native-inputs
141 `(("perl-module-build" ,perl-module-build)))
142 (propagated-inputs
143 `(("perl-gd" ,perl-gd)
144 ("perl-image-magick" ,perl-image-magick)))
145 (home-page "http://search.cpan.org/dist/GD-SecurityImage")
e881752c 146 (synopsis "Security image generator")
d8ae0acc
EB
147 (description "This module provides a basic interface to create
148security (captcha) images. The final output is the actual graphic data, the
149mime type of the graphic, and the created random string. The module also has
150some \"styles\" that are used to create the background (or foreground) of the
151image.")
152 (license (package-license perl))))