gnu: nnn: Don't use NAME in source URI.
[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>
d5d7d26d 8;;; Copyright © 2018 Tobias Geerinckx-Rice <me@tobias.gr>
d517142b
LC
9;;;
10;;; This file is part of GNU Guix.
11;;;
12;;; GNU Guix is free software; you can redistribute it and/or modify it
13;;; under the terms of the GNU General Public License as published by
14;;; the Free Software Foundation; either version 3 of the License, or (at
15;;; your option) any later version.
16;;;
17;;; GNU Guix is distributed in the hope that it will be useful, but
18;;; WITHOUT ANY WARRANTY; without even the implied warranty of
19;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20;;; GNU General Public License for more details.
21;;;
22;;; You should have received a copy of the GNU General Public License
23;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
24
25(define-module (gnu packages gd)
26 #:use-module (guix packages)
27 #:use-module (guix build-system gnu)
f7ee7a9b 28 #:use-module (guix build-system perl)
d517142b 29 #:use-module (guix download)
fdbd19ea 30 #:use-module (gnu packages)
f7ee7a9b 31 #:use-module (gnu packages perl)
e55354b8 32 #:use-module (gnu packages image)
d8ae0acc 33 #:use-module (gnu packages imagemagick)
d517142b
LC
34 #:use-module (gnu packages fontutils)
35 #:use-module (gnu packages compression)
b01a0ba8 36 #:use-module (gnu packages pkg-config)
2f3108ad 37 #:use-module ((guix licenses) #:select (non-copyleft perl-license)))
d517142b
LC
38
39(define-public gd
40 (package
41 (name "gd")
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.
b093be23 45 (version "2.2.5")
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
b093be23 53 "0lfy5f241sbv8s3splm2zqiaxv7lxrcshh875xryryk7yk5jqc4c"))
68a08dfb
MB
54
55 (patches (search-patches "gd-CVE-2018-5711.patch"
56 "gd-CVE-2018-1000222.patch"
57 "gd-fix-tests-on-i686.patch"
b093be23 58 "gd-freetype-test-failure.patch"))))
d517142b 59 (build-system gnu-build-system)
c134959b 60 (arguments
7ed7be3c
EF
61 ;; As recommended by github.com/libgd/libgd/issues/278 to fix rounding
62 ;; issues on aarch64 and other architectures.
63 `(#:make-flags '("CFLAGS=-ffp-contract=off")
64 #:phases
c134959b
LF
65 (modify-phases %standard-phases
66 ;; This test is known to fail on i686-linux:
67 ;; https://github.com/libgd/libgd/issues/359
68 ;; TODO Replace this substitution with an upstream bug fix.
69 (add-after 'unpack 'disable-failing-test
70 (lambda _
71 (substitute* "tests/gdimagegrayscale/basic.c"
72 (("return gdNumFailures\\(\\)")
7ed7be3c
EF
73 "return 0"))
74 #t)))))
b01a0ba8
MW
75 (native-inputs
76 `(("pkg-config" ,pkg-config)))
d517142b
LC
77 (inputs
78 `(("freetype" ,freetype)
79 ("libpng" ,libpng)
80 ("zlib" ,zlib)))
81 (propagated-inputs
82 `(("fontconfig" ,fontconfig)
83 ("libjpeg" ,libjpeg)))
84 (home-page "http://www.libgd.org/")
85 (synopsis "Library for the dynamic creation of images by programmers")
86 (description
87 "GD is a library for the dynamic creation of images by programmers. GD
88is written in C, and \"wrappers\" are available for Perl, PHP and other
89languages. GD creates PNG, JPEG, GIF, WebP, XPM, BMP images, among other
90formats. GD is commonly used to generate charts, graphics, thumbnails, and
91most anything else, on the fly. While not restricted to use on the web, the
92most common applications of GD involve website development.")
166191b3 93 (license (non-copyleft "file://COPYING"
bbb5d8ae
LC
94 "See COPYING file in the distribution."))
95 (properties '((cpe-name . "libgd")))))
f7ee7a9b
EB
96
97(define-public perl-gd
98 (package
99 (name "perl-gd")
ad3306f6 100 (version "2.69")
f7ee7a9b
EB
101 (source
102 (origin
103 (method url-fetch)
d5d7d26d 104 (uri (string-append "mirror://cpan/authors/id/R/RU/RURBAN/"
f7ee7a9b
EB
105 "GD-" version ".tar.gz"))
106 (sha256
107 (base32
ad3306f6 108 "0palmq7l42fibqxhrabnjm7di4q8kciq9323902d717x3i4jvc6x"))))
f7ee7a9b 109 (build-system perl-build-system)
f7ee7a9b 110 (inputs
d5d7d26d
TGR
111 `(("fontconfig" ,fontconfig)
112 ("freetype" ,freetype)
113 ("gd" ,gd)
114 ("libpng" ,libpng)
115 ("libjpeg" ,libjpeg)
116 ("zlib" ,zlib)))
f7ee7a9b 117 (arguments
d5d7d26d
TGR
118 `(#:make-maker-flags
119 (list (string-append "--lib_jpeg_path="
120 (assoc-ref %build-inputs "libjpeg")))))
9aba9b12 121 (home-page "https://metacpan.org/release/GD")
f7ee7a9b
EB
122 (synopsis "Perl interface to the GD graphics library")
123 (description "GD.pm is an autoloadable interface module for libgd, a
124popular library for creating and manipulating PNG files. With this library
125you can create PNG images on the fly or modify existing files.")
2f3108ad 126 (license perl-license)))
d8ae0acc
EB
127
128(define-public perl-gd-securityimage
129 (package
130 (name "perl-gd-securityimage")
131 (version "1.73")
132 (source
133 (origin
134 (method url-fetch)
135 (uri (string-append "mirror://cpan/authors/id/B/BU/BURAK/"
136 "GD-SecurityImage-" version ".tar.gz"))
137 (sha256
138 (base32
139 "1kaxs67rfd4w46lxgcg3pa05a596l0h1k8n4zk2gwrrar4022wpx"))))
140 (build-system perl-build-system)
201c0e72
LF
141 (arguments
142 '(#:phases
143 (modify-phases %standard-phases
144 (add-after 'unpack 'set-env
4851af9e 145 (lambda _ (setenv "PERL_USE_UNSAFE_INC" "1") #t)))))
d8ae0acc
EB
146 (native-inputs
147 `(("perl-module-build" ,perl-module-build)))
148 (propagated-inputs
149 `(("perl-gd" ,perl-gd)
150 ("perl-image-magick" ,perl-image-magick)))
9aba9b12 151 (home-page "https://metacpan.org/release/GD-SecurityImage")
e881752c 152 (synopsis "Security image generator")
d8ae0acc
EB
153 (description "This module provides a basic interface to create
154security (captcha) images. The final output is the actual graphic data, the
155mime type of the graphic, and the created random string. The module also has
156some \"styles\" that are used to create the background (or foreground) of the
157image.")
2f3108ad 158 (license perl-license)))