gnu: python-pandas: Fix build on 32-bit.
[jackhill/guix/guix.git] / gnu / packages / gd.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2016 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Eric Bavier <bavier@member.fsf.org>
5 ;;; Copyright © 2016, 2017 Leo Famulari <leo@famulari.name>
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)
25 #:use-module (guix build-system perl)
26 #:use-module (guix download)
27 #:use-module (gnu packages)
28 #:use-module (gnu packages perl)
29 #:use-module (gnu packages image)
30 #:use-module (gnu packages imagemagick)
31 #:use-module (gnu packages fontutils)
32 #:use-module (gnu packages compression)
33 #:use-module (gnu packages pkg-config)
34 #:use-module ((guix licenses) #:select (non-copyleft)))
35
36 (define-public gd
37 (package
38 (name "gd")
39 (replacement gd-2.2.4)
40
41 ;; Note: With libgd.org now pointing to github.com, genuine old
42 ;; tarballs are no longer available. Notably, versions 2.0.x are
43 ;; missing.
44 (version "2.2.3")
45
46 (source (origin
47 (method url-fetch)
48 (uri (string-append
49 "https://github.com/libgd/libgd/releases/download/gd-"
50 version "/libgd-" version ".tar.xz"))
51 (sha256
52 (base32
53 "0g3xz8jpz1pl2zzmssglrpa9nxiaa7rmcmvgpbrjz8k9cyynqsvl"))
54 (patches (search-patches "gd-CVE-2016-7568.patch"
55 "gd-CVE-2016-8670.patch"
56 "gd-fix-gd2-read-test.patch"
57 "gd-fix-tests-on-i686.patch"))))
58 (build-system gnu-build-system)
59 (native-inputs
60 `(("pkg-config" ,pkg-config)))
61 (inputs
62 `(("freetype" ,freetype)
63 ("libpng" ,libpng)
64 ("zlib" ,zlib)))
65 (propagated-inputs
66 `(("fontconfig" ,fontconfig)
67 ("libjpeg" ,libjpeg)))
68 (home-page "http://www.libgd.org/")
69 (synopsis "Library for the dynamic creation of images by programmers")
70 (description
71 "GD is a library for the dynamic creation of images by programmers. GD
72 is written in C, and \"wrappers\" are available for Perl, PHP and other
73 languages. GD creates PNG, JPEG, GIF, WebP, XPM, BMP images, among other
74 formats. GD is commonly used to generate charts, graphics, thumbnails, and
75 most anything else, on the fly. While not restricted to use on the web, the
76 most common applications of GD involve website development.")
77 (license (non-copyleft "file://COPYING"
78 "See COPYING file in the distribution."))
79 (properties '((cpe-name . "libgd")))))
80
81 (define gd-2.2.4
82 (package
83 (inherit gd)
84 (version "2.2.4")
85 (source
86 (origin
87 (method url-fetch)
88 (uri (string-append "https://github.com/libgd/libgd/releases/download/"
89 "gd-" version "/libgd-" version ".tar.xz"))
90 (patches (search-patches "gd-fix-gd2-read-test.patch"
91 "gd-fix-tests-on-i686.patch"))
92 (sha256
93 (base32
94 "1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk"))))
95 (arguments
96 `(#:phases
97 (modify-phases %standard-phases
98 ;; This test is known to fail on i686-linux:
99 ;; https://github.com/libgd/libgd/issues/359
100 ;; TODO Replace this substitution with an upstream bug fix.
101 (add-after 'unpack 'disable-failing-test
102 (lambda _
103 (substitute* "tests/gdimagegrayscale/basic.c"
104 (("return gdNumFailures\\(\\)")
105 "return 0")))))))))
106
107 (define-public perl-gd
108 (package
109 (name "perl-gd")
110 (version "2.56")
111 (source
112 (origin
113 (method url-fetch)
114 (uri (string-append "mirror://cpan/authors/id/L/LD/LDS/"
115 "GD-" version ".tar.gz"))
116 (sha256
117 (base32
118 "1ya8f9hpiax8j29vwaiwlvvgah0vkyvpzva28r8231nyk0f3s40z"))
119 (patches (search-patches
120 "perl-gd-options-passthrough-and-fontconfig.patch"))))
121 (build-system perl-build-system)
122 (native-inputs
123 `(("perl-module-build" ,perl-module-build))) ;needs Module::Build >= 0.42
124 (inputs
125 `(("gd" ,gd)
126 ("zlib" ,zlib)
127 ("png" ,libpng)
128 ("ft" ,freetype)
129 ("jpeg" ,libjpeg)
130 ("fontconfig" ,fontconfig)))
131 (arguments
132 ;; We must use Build.PL for building because Makefile.PL fails to build
133 ;; the XS source.
134 `(#:module-build-flags (map (lambda (i)
135 (string-append "--lib_" i "_path="
136 (assoc-ref %build-inputs i)))
137 '("zlib" "png" "ft" "jpeg" "fontconfig"))
138 #:tests? #f ;; Failed 1/2 test programs. 1/12 subtests failed.
139 #:phases (alist-cons-after
140 'configure 'clear-autogenerated-files
141 (lambda _
142 ;; This file is autogenerated by its .PLS script at build
143 ;; time, but file creation fails because that file already
144 ;; exists in the distribution with non-writable
145 ;; permissions, so delete it first.
146 (delete-file "bdf_scripts/bdf2gdfont.pl"))
147 %standard-phases)))
148 (home-page "http://search.cpan.org/dist/GD")
149 (synopsis "Perl interface to the GD graphics library")
150 (description "GD.pm is an autoloadable interface module for libgd, a
151 popular library for creating and manipulating PNG files. With this library
152 you can create PNG images on the fly or modify existing files.")
153 (license (package-license perl))))
154
155 (define-public perl-gd-securityimage
156 (package
157 (name "perl-gd-securityimage")
158 (version "1.73")
159 (source
160 (origin
161 (method url-fetch)
162 (uri (string-append "mirror://cpan/authors/id/B/BU/BURAK/"
163 "GD-SecurityImage-" version ".tar.gz"))
164 (sha256
165 (base32
166 "1kaxs67rfd4w46lxgcg3pa05a596l0h1k8n4zk2gwrrar4022wpx"))))
167 (build-system perl-build-system)
168 (native-inputs
169 `(("perl-module-build" ,perl-module-build)))
170 (propagated-inputs
171 `(("perl-gd" ,perl-gd)
172 ("perl-image-magick" ,perl-image-magick)))
173 (home-page "http://search.cpan.org/dist/GD-SecurityImage")
174 (synopsis "Security image generator")
175 (description "This module provides a basic interface to create
176 security (captcha) images. The final output is the actual graphic data, the
177 mime type of the graphic, and the created random string. The module also has
178 some \"styles\" that are used to create the background (or foreground) of the
179 image.")
180 (license (package-license perl))))