gnu: libevent@2.0: Add fix from upstream.
[jackhill/guix/guix.git] / gnu / packages / libevent.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2013, 2014, 2015, 2016 Ludovic Courtès <ludo@gnu.org>
3 ;;; Copyright © 2015, 2017 Mark H Weaver <mhw@netris.org>
4 ;;; Copyright © 2015 Eric Dvorsak <eric@dvorsak.fr>
5 ;;; Copyright © 2016 David Thompson <davet@gnu.org>
6 ;;; Copyright © 2017 Marius Bakke <mbakke@fastmail.com>
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 libevent)
24 #:use-module (gnu packages)
25 #:use-module (guix licenses)
26 #:use-module (guix packages)
27 #:use-module (guix download)
28 #:use-module (guix build-system gnu)
29 #:use-module (guix build-system perl)
30 #:use-module (gnu packages autotools)
31 #:use-module (gnu packages base)
32 #:use-module (gnu packages perl)
33 #:use-module (gnu packages pkg-config)
34 #:use-module (gnu packages python)
35 #:use-module (gnu packages tls))
36
37 (define-public libevent
38 (package
39 (name "libevent")
40 (version "2.1.8")
41 (source (origin
42 (method url-fetch)
43 (uri (string-append
44 "https://github.com/libevent/libevent/releases/download/release-"
45 version "-stable/libevent-" version "-stable.tar.gz"))
46 (sha256
47 (base32
48 "1hhxnxlr0fsdv7bdmzsnhdz16fxf3jg2r6vyljcl3kj6pflcap4n"))
49 (patches (search-patches "libevent-2.1-dns-tests.patch"
50 ;; XXX: Try removing this for > 2.1.8.
51 ;; https://github.com/libevent/libevent/issues/452
52 "libevent-2.1-skip-failing-test.patch"))))
53 (build-system gnu-build-system)
54 (inputs
55 `(("python" ,python-2))) ; for 'event_rpcgen.py'
56 (native-inputs
57 `(("which" ,which)))
58 (home-page "http://libevent.org/")
59 (synopsis "Event notification library")
60 (description
61 "The libevent API provides a mechanism to execute a callback
62 function when a specific event occurs on a file descriptor or after a
63 timeout has been reached. Furthermore, libevent also support callbacks
64 due to signals or regular timeouts.
65
66 libevent is meant to replace the event loop found in event driven
67 network servers. An application just needs to call event_dispatch() and
68 then add or remove events dynamically without having to change the event
69 loop.")
70 (license bsd-3)))
71
72 (define-public libevent-2.0
73 (package
74 (inherit libevent)
75 (version "2.0.22")
76 (source (origin
77 (method url-fetch)
78 (uri (string-append
79 "https://github.com/libevent/libevent/releases/download/release-"
80 version "-stable/libevent-" version "-stable.tar.gz"))
81 (sha256
82 (base32
83 "18qz9qfwrkakmazdlwxvjmw8p76g70n3faikwvdwznns1agw9hki"))
84 (patches
85 (search-patches
86 "libevent-dns-tests.patch"
87 "libevent-2.0-evdns-fix-remote-stack-overread.patch"
88 "libevent-2.0-evutil-fix-buffer-overflow.patch"
89 "libevent-2.0-evdns-fix-searching-empty-hostnames.patch"
90 "libevent-2.0-evbuffer-add-use-last-with-datap.patch"))))))
91
92 (define-public libev
93 (package
94 (name "libev")
95 (version "4.24")
96 (source (origin
97 (method url-fetch)
98 (uri (string-append "http://dist.schmorp.de/libev/Attic/libev-"
99 version
100 ".tar.gz"))
101 (sha256
102 (base32
103 "08gqsza1czx0nf62nkk183jb0946yzjsymaacxbzdgcs8z9r6dcp"))))
104 (build-system gnu-build-system)
105 (home-page "http://software.schmorp.de/pkg/libev.html")
106 (synopsis "Event loop loosely modelled after libevent")
107 (description
108 "libev is a full-featured and high-performance event loop that
109 is loosely modelled after libevent, but without its limitations and
110 bugs. It is used in GNU Virtual Private Ethernet, rxvt-unicode,
111 auditd, the Deliantra MORPG Server and Client, and many other
112 programs.")
113 (license
114 (list bsd-2 gpl2+))))
115
116 (define-public libuv
117 (package
118 (name "libuv")
119 (version "1.11.0")
120 (source (origin
121 (method url-fetch)
122 (uri (string-append "https://github.com/libuv/libuv/archive/v"
123 version ".tar.gz"))
124 (file-name (string-append name "-" version ".tar.gz"))
125 (sha256
126 (base32
127 "0yhw86011l2dg2prms0d86szygrix4pxpgnyzs7iljy2xk3fxivf"))))
128 (build-system gnu-build-system)
129 (arguments
130 '(#:phases (alist-cons-after
131 'unpack 'autogen
132 (lambda _
133 ;; Fashionable people don't run 'make dist' these days, so
134 ;; we need to do that ourselves.
135 (zero? (system* "sh" "autogen.sh")))
136 %standard-phases)
137
138 ;; XXX: Some tests want /dev/tty, attempt to make connections, etc.
139 #:tests? #f))
140 (native-inputs `(("autoconf" ,(autoconf-wrapper))
141 ("automake" ,automake)
142 ("libtool" ,libtool)
143
144 ;; libuv.pc is installed only when pkg-config is found.
145 ("pkg-config" ,pkg-config)))
146 (home-page "https://github.com/libuv/libuv")
147 (synopsis "Library for asynchronous I/O")
148 (description
149 "libuv is a multi-platform support library with a focus on asynchronous
150 I/O. Among other things, it supports event loops via epoll, kqueue, and
151 similar IOCP, and event ports, asynchronous TCP/UDP sockets, asynchronous DNS
152 resolution, asynchronous file system operations, and threading primitives.")
153
154 ;; A few files fall under other non-copyleft licenses; see 'LICENSE' for
155 ;; details.
156 (license x11)))
157
158 (define-public perl-anyevent
159 (package
160 (name "perl-anyevent")
161 (version "7.13")
162 (source (origin
163 (method url-fetch)
164 (uri (string-append "mirror://cpan/authors/id/M/ML/MLEHMANN/"
165 "AnyEvent-" version ".tar.gz"))
166 (sha256
167 (base32
168 "1b84ilkbrfbzqapv25x8z6gva92skbrf2srybdabb1wnxx6ky454"))))
169 (build-system perl-build-system)
170 (native-inputs
171 `(("perl-canary-stability" ,perl-canary-stability)))
172 (propagated-inputs
173 `(("perl-async-interrupt" ,perl-async-interrupt)
174 ("perl-ev" ,perl-ev)
175 ("perl-guard" ,perl-guard)
176 ("perl-json" ,perl-json)
177 ("perl-json-xs" ,perl-json-xs)
178 ("perl-net-ssleay" ,perl-net-ssleay)
179 ("perl-task-weaken" ,perl-task-weaken)))
180 (home-page "http://search.cpan.org/dist/AnyEvent")
181 (synopsis
182 "API for I/O, timer, signal, child process and completion events")
183 (description
184 "This module allows using a variety of events without forcing module
185 authors to pick a specific event loop, and without noticable overhead.
186 Currently supported event loops are EV, Event, Glib/Gtk2, Tk, Qt,
187 @code{Event::Lib}, Irssi, @code{IO::Async} and POE (and thus also WxWidgets
188 and Prima). It also comes with a very fast Pure Perl event loop that does
189 not rely on XS.")
190 (license (package-license perl))))
191
192 (define-public perl-ev
193 (package
194 (name "perl-ev")
195 (version "4.22")
196 (source (origin
197 (method url-fetch)
198 (uri (string-append "mirror://cpan/authors/id/M/ML/MLEHMANN/EV-"
199 version ".tar.gz"))
200 (sha256
201 (base32
202 "14d9115q8f2ca2q3vbcalm55zqsbx8xjq5aj098laj9f9rrzirra"))
203 (modules '((guix build utils)))
204 (snippet
205 '(begin
206 ;; Drop bundled libev.
207 (delete-file-recursively "libev")
208 #t))))
209 (build-system perl-build-system)
210 (arguments
211 '(#:phases
212 (modify-phases %standard-phases
213 (add-after 'unpack 'unpack-libev
214 ;; This package requires the libev *sources* in order
215 ;; to build. Unpack system libev here...
216 (lambda* (#:key inputs #:allow-other-keys)
217 (mkdir "./libev")
218 (zero? (system* "tar" "-xf" (assoc-ref inputs "libev-source")
219 "-C" "./libev" "--strip-components=1")))))))
220 (native-inputs
221 `(("libev-source" ,(package-source libev))
222 ("perl-canary-stability" ,perl-canary-stability)))
223 (propagated-inputs
224 `(("perl-common-sense" ,perl-common-sense)))
225 (home-page "http://search.cpan.org/dist/EV")
226 (synopsis "Perl interface to libev")
227 (description
228 "This module provides an interface to @code{libev}, a high performance
229 full-featured event loop. It can be used through the @code{AnyEvent} module
230 and still be faster than other event loops currently supported in Perl.")
231 (license (package-license perl))))