1 { lib, stdenv, fetchurl, findutils, fixDarwinDylibNames
2 , sslSupport ? true, openssl
6 stdenv.mkDerivation rec {
11 url = "https://github.com/libevent/libevent/releases/download/release-${version}-stable/libevent-${version}-stable.tar.gz";
12 sha256 = "1fq30imk8zd26x8066di3kpc5zyfc5z6frr3zll685zcx4dxxrlj";
16 # Don't define BIO_get_init() for LibreSSL 3.5+
18 url = "https://github.com/libevent/libevent/commit/883630f76cbf512003b81de25cd96cb75c6cf0f9.patch";
19 sha256 = "sha256-VPJqJUAovw6V92jpqIXkIR1xYGbxIWxaHr8cePWI2SU=";
23 preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
24 MACOSX_DEPLOYMENT_TARGET=10.16
27 # libevent_openssl is moved into its own output, so that openssl isn't present
28 # in the default closure.
29 outputs = [ "out" "dev" ]
30 ++ lib.optional sslSupport "openssl"
33 propagatedBuildOutputs = [ "out" ]
34 ++ lib.optional sslSupport "openssl"
37 nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
39 buildInputs = lib.optional sslSupport openssl
40 ++ lib.optional stdenv.isCygwin findutils;
42 doCheck = false; # needs the net
44 postInstall = lib.optionalString sslSupport ''
45 moveToOutput "lib/libevent_openssl*" "$openssl"
46 substituteInPlace "$dev/lib/pkgconfig/libevent_openssl.pc" \
47 --replace "$out" "$openssl"
48 sed "/^libdir=/s|$out|$openssl|" -i "$openssl"/lib/libevent_openssl.la
51 enableParallelBuilding = true;
54 description = "Event notification library";
56 The libevent API provides a mechanism to execute a callback function
57 when a specific event occurs on a file descriptor or after a timeout
58 has been reached. Furthermore, libevent also support callbacks due
59 to signals or regular timeouts.
61 libevent is meant to replace the event loop found in event driven
62 network servers. An application just needs to call event_dispatch()
63 and then add or remove events dynamically without having to change
66 homepage = "https://libevent.org/";
67 license = licenses.bsd3;
68 platforms = platforms.all;