1{ stdenv, fetchurl, findutils, fixDarwinDylibNames
2, sslSupport? true, openssl
3}:
4
5assert sslSupport -> openssl != null;
6
7stdenv.mkDerivation rec {
8 name = "libevent-${version}";
9 version = "2.1.8";
10
11 src = fetchurl {
12 url = "https://github.com/libevent/libevent/releases/download/release-${version}-stable/libevent-${version}-stable.tar.gz";
13 sha256 = "1hhxnxlr0fsdv7bdmzsnhdz16fxf3jg2r6vyljcl3kj6pflcap4n";
14 };
15
16 # libevent_openssl is moved into its own output, so that openssl isn't present
17 # in the default closure.
18 outputs = [ "out" "dev" ]
19 ++ stdenv.lib.optional sslSupport "openssl"
20 ;
21 outputBin = "dev";
22 propagatedBuildOutputs = [ "out" ]
23 ++ stdenv.lib.optional sslSupport "openssl"
24 ;
25
26 buildInputs = []
27 ++ stdenv.lib.optional sslSupport openssl
28 ++ stdenv.lib.optional stdenv.isCygwin findutils
29 ++ stdenv.lib.optional stdenv.isDarwin fixDarwinDylibNames
30 ;
31
32 postInstall = stdenv.lib.optionalString sslSupport ''
33 moveToOutput "lib/libevent_openssl*" "$openssl"
34 substituteInPlace "$dev/lib/pkgconfig/libevent_openssl.pc" \
35 --replace "$out" "$openssl"
36 sed "/^libdir=/s|$out|$openssl|" -i "$openssl"/lib/libevent_openssl.la
37 '';
38
39 meta = with stdenv.lib; {
40 description = "Event notification library";
41 longDescription = ''
42 The libevent API provides a mechanism to execute a callback function
43 when a specific event occurs on a file descriptor or after a timeout
44 has been reached. Furthermore, libevent also support callbacks due
45 to signals or regular timeouts.
46
47 libevent is meant to replace the event loop found in event driven
48 network servers. An application just needs to call event_dispatch()
49 and then add or remove events dynamically without having to change
50 the event loop.
51 '';
52 homepage = http://libevent.org/;
53 license = licenses.bsd3;
54 platforms = platforms.all;
55 maintainers = with maintainers; [ wkennington ];
56 };
57}