gnu: xfburn: Update to 0.5.5.
[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")
b5d08d7c 41 ;; Note: With libgd.org now pointing to github.com, genuine old
b01a0ba8 42 ;; tarballs are no longer available. Notably, versions 2.0.x are
d517142b 43 ;; missing.
b093be23 44 (version "2.2.5")
d517142b
LC
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"))
d517142b
LC
50 (sha256
51 (base32
b093be23
MB
52 "0lfy5f241sbv8s3splm2zqiaxv7lxrcshh875xryryk7yk5jqc4c"))
53 (patches (search-patches "gd-fix-tests-on-i686.patch"
54 "gd-freetype-test-failure.patch"))))
d517142b 55 (build-system gnu-build-system)
c134959b 56 (arguments
7ed7be3c
EF
57 ;; As recommended by github.com/libgd/libgd/issues/278 to fix rounding
58 ;; issues on aarch64 and other architectures.
59 `(#:make-flags '("CFLAGS=-ffp-contract=off")
60 #:phases
c134959b
LF
61 (modify-phases %standard-phases
62 ;; This test is known to fail on i686-linux:
63 ;; https://github.com/libgd/libgd/issues/359
64 ;; TODO Replace this substitution with an upstream bug fix.
65 (add-after 'unpack 'disable-failing-test
66 (lambda _
67 (substitute* "tests/gdimagegrayscale/basic.c"
68 (("return gdNumFailures\\(\\)")
7ed7be3c
EF
69 "return 0"))
70 #t)))))
b01a0ba8
MW
71 (native-inputs
72 `(("pkg-config" ,pkg-config)))
d517142b
LC
73 (inputs
74 `(("freetype" ,freetype)
75 ("libpng" ,libpng)
76 ("zlib" ,zlib)))
77 (propagated-inputs
78 `(("fontconfig" ,fontconfig)
79 ("libjpeg" ,libjpeg)))
80 (home-page "http://www.libgd.org/")
81 (synopsis "Library for the dynamic creation of images by programmers")
82 (description
83 "GD is a library for the dynamic creation of images by programmers. GD
84is written in C, and \"wrappers\" are available for Perl, PHP and other
85languages. GD creates PNG, JPEG, GIF, WebP, XPM, BMP images, among other
86formats. GD is commonly used to generate charts, graphics, thumbnails, and
87most anything else, on the fly. While not restricted to use on the web, the
88most common applications of GD involve website development.")
166191b3 89 (license (non-copyleft "file://COPYING"
bbb5d8ae
LC
90 "See COPYING file in the distribution."))
91 (properties '((cpe-name . "libgd")))))
f7ee7a9b
EB
92
93(define-public perl-gd
94 (package
95 (name "perl-gd")
96 (version "2.56")
97 (source
98 (origin
99 (method url-fetch)
100 (uri (string-append "mirror://cpan/authors/id/L/LD/LDS/"
101 "GD-" version ".tar.gz"))
102 (sha256
103 (base32
104 "1ya8f9hpiax8j29vwaiwlvvgah0vkyvpzva28r8231nyk0f3s40z"))
fc1adab1
AK
105 (patches (search-patches
106 "perl-gd-options-passthrough-and-fontconfig.patch"))))
f7ee7a9b
EB
107 (build-system perl-build-system)
108 (native-inputs
109 `(("perl-module-build" ,perl-module-build))) ;needs Module::Build >= 0.42
110 (inputs
111 `(("gd" ,gd)
112 ("zlib" ,zlib)
113 ("png" ,libpng)
114 ("ft" ,freetype)
115 ("jpeg" ,libjpeg)
116 ("fontconfig" ,fontconfig)))
117 (arguments
118 ;; We must use Build.PL for building because Makefile.PL fails to build
119 ;; the XS source.
120 `(#:module-build-flags (map (lambda (i)
121 (string-append "--lib_" i "_path="
122 (assoc-ref %build-inputs i)))
123 '("zlib" "png" "ft" "jpeg" "fontconfig"))
2792a6b4 124 #:tests? #f ;; Failed 1/2 test programs. 1/12 subtests failed.
dc1d3cde
KK
125 #:phases
126 (modify-phases %standard-phases
127 (add-after 'configure 'clear-autogenerated-files
128 (lambda _
129 ;; This file is autogenerated by its .PLS script at build
130 ;; time, but file creation fails because that file already
131 ;; exists in the distribution with non-writable
132 ;; permissions, so delete it first.
133 (delete-file "bdf_scripts/bdf2gdfont.pl")
134 #t)))))
f7ee7a9b
EB
135 (home-page "http://search.cpan.org/dist/GD")
136 (synopsis "Perl interface to the GD graphics library")
137 (description "GD.pm is an autoloadable interface module for libgd, a
138popular library for creating and manipulating PNG files. With this library
139you can create PNG images on the fly or modify existing files.")
2f3108ad 140 (license perl-license)))
d8ae0acc
EB
141
142(define-public perl-gd-securityimage
143 (package
144 (name "perl-gd-securityimage")
145 (version "1.73")
146 (source
147 (origin
148 (method url-fetch)
149 (uri (string-append "mirror://cpan/authors/id/B/BU/BURAK/"
150 "GD-SecurityImage-" version ".tar.gz"))
151 (sha256
152 (base32
153 "1kaxs67rfd4w46lxgcg3pa05a596l0h1k8n4zk2gwrrar4022wpx"))))
154 (build-system perl-build-system)
201c0e72
LF
155 (arguments
156 '(#:phases
157 (modify-phases %standard-phases
158 (add-after 'unpack 'set-env
159 (lambda _ (setenv "PERL_USE_UNSAFE_INC" "1"))))))
d8ae0acc
EB
160 (native-inputs
161 `(("perl-module-build" ,perl-module-build)))
162 (propagated-inputs
163 `(("perl-gd" ,perl-gd)
164 ("perl-image-magick" ,perl-image-magick)))
165 (home-page "http://search.cpan.org/dist/GD-SecurityImage")
e881752c 166 (synopsis "Security image generator")
d8ae0acc
EB
167 (description "This module provides a basic interface to create
168security (captcha) images. The final output is the actual graphic data, the
169mime type of the graphic, and the created random string. The module also has
170some \"styles\" that are used to create the background (or foreground) of the
171image.")
2f3108ad 172 (license perl-license)))