gnu: emacs-guix: Update to 0.3.1.
[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 ;;; Copyright © 2017 Efraim Flashner <efraim@flashner.co.il>
7 ;;;
8 ;;; This file is part of GNU Guix.
9 ;;;
10 ;;; GNU Guix is free software; you can redistribute it and/or modify it
11 ;;; under the terms of the GNU General Public License as published by
12 ;;; the Free Software Foundation; either version 3 of the License, or (at
13 ;;; your option) any later version.
14 ;;;
15 ;;; GNU Guix is distributed in the hope that it will be useful, but
16 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
17 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 ;;; GNU General Public License for more details.
19 ;;;
20 ;;; You should have received a copy of the GNU General Public License
21 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
22
23 (define-module (gnu packages gd)
24 #:use-module (guix packages)
25 #:use-module (guix build-system gnu)
26 #:use-module (guix build-system perl)
27 #:use-module (guix download)
28 #:use-module (gnu packages)
29 #:use-module (gnu packages perl)
30 #:use-module (gnu packages image)
31 #:use-module (gnu packages imagemagick)
32 #:use-module (gnu packages fontutils)
33 #:use-module (gnu packages compression)
34 #:use-module (gnu packages pkg-config)
35 #:use-module ((guix licenses) #:select (non-copyleft perl-license)))
36
37 (define-public gd
38 (package
39 (name "gd")
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.4")
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 "1rp4v7n1dq38b92kl7gkvpvqqkw7nvdfnz6d5kip5klkxfki6zqk"))
54 (patches (search-patches "gd-fix-gd2-read-test.patch"
55 "gd-fix-tests-on-i686.patch"
56 "gd-freetype-test-failure.patch"
57 "gd-php-73968-Fix-109-XBM-reading.patch"))))
58 (build-system gnu-build-system)
59 (arguments
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
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\\(\\)")
72 "return 0"))
73 #t)))))
74 (native-inputs
75 `(("pkg-config" ,pkg-config)))
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
87 is written in C, and \"wrappers\" are available for Perl, PHP and other
88 languages. GD creates PNG, JPEG, GIF, WebP, XPM, BMP images, among other
89 formats. GD is commonly used to generate charts, graphics, thumbnails, and
90 most anything else, on the fly. While not restricted to use on the web, the
91 most common applications of GD involve website development.")
92 (license (non-copyleft "file://COPYING"
93 "See COPYING file in the distribution."))
94 (properties '((cpe-name . "libgd")))))
95
96 (define-public perl-gd
97 (package
98 (name "perl-gd")
99 (version "2.56")
100 (source
101 (origin
102 (method url-fetch)
103 (uri (string-append "mirror://cpan/authors/id/L/LD/LDS/"
104 "GD-" version ".tar.gz"))
105 (sha256
106 (base32
107 "1ya8f9hpiax8j29vwaiwlvvgah0vkyvpzva28r8231nyk0f3s40z"))
108 (patches (search-patches
109 "perl-gd-options-passthrough-and-fontconfig.patch"))))
110 (build-system perl-build-system)
111 (native-inputs
112 `(("perl-module-build" ,perl-module-build))) ;needs Module::Build >= 0.42
113 (inputs
114 `(("gd" ,gd)
115 ("zlib" ,zlib)
116 ("png" ,libpng)
117 ("ft" ,freetype)
118 ("jpeg" ,libjpeg)
119 ("fontconfig" ,fontconfig)))
120 (arguments
121 ;; We must use Build.PL for building because Makefile.PL fails to build
122 ;; the XS source.
123 `(#:module-build-flags (map (lambda (i)
124 (string-append "--lib_" i "_path="
125 (assoc-ref %build-inputs i)))
126 '("zlib" "png" "ft" "jpeg" "fontconfig"))
127 #:tests? #f ;; Failed 1/2 test programs. 1/12 subtests failed.
128 #:phases (alist-cons-after
129 'configure 'clear-autogenerated-files
130 (lambda _
131 ;; This file is autogenerated by its .PLS script at build
132 ;; time, but file creation fails because that file already
133 ;; exists in the distribution with non-writable
134 ;; permissions, so delete it first.
135 (delete-file "bdf_scripts/bdf2gdfont.pl"))
136 %standard-phases)))
137 (home-page "http://search.cpan.org/dist/GD")
138 (synopsis "Perl interface to the GD graphics library")
139 (description "GD.pm is an autoloadable interface module for libgd, a
140 popular library for creating and manipulating PNG files. With this library
141 you can create PNG images on the fly or modify existing files.")
142 (license perl-license)))
143
144 (define-public perl-gd-securityimage
145 (package
146 (name "perl-gd-securityimage")
147 (version "1.73")
148 (source
149 (origin
150 (method url-fetch)
151 (uri (string-append "mirror://cpan/authors/id/B/BU/BURAK/"
152 "GD-SecurityImage-" version ".tar.gz"))
153 (sha256
154 (base32
155 "1kaxs67rfd4w46lxgcg3pa05a596l0h1k8n4zk2gwrrar4022wpx"))))
156 (build-system perl-build-system)
157 (native-inputs
158 `(("perl-module-build" ,perl-module-build)))
159 (propagated-inputs
160 `(("perl-gd" ,perl-gd)
161 ("perl-image-magick" ,perl-image-magick)))
162 (home-page "http://search.cpan.org/dist/GD-SecurityImage")
163 (synopsis "Security image generator")
164 (description "This module provides a basic interface to create
165 security (captcha) images. The final output is the actual graphic data, the
166 mime type of the graphic, and the created random string. The module also has
167 some \"styles\" that are used to create the background (or foreground) of the
168 image.")
169 (license perl-license)))