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 configureFlags = lib.optional (!sslSupport) "--disable-openssl";
25 preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") ''
26 MACOSX_DEPLOYMENT_TARGET=10.16
29 # libevent_openssl is moved into its own output, so that openssl isn't present
30 # in the default closure.
31 outputs = [ "out" "dev" ]
32 ++ lib.optional sslSupport "openssl"
35 propagatedBuildOutputs = [ "out" ]
36 ++ lib.optional sslSupport "openssl"
39 nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames;
41 buildInputs = lib.optional sslSupport openssl
42 ++ lib.optional stdenv.isCygwin findutils;
44 doCheck = false; # needs the net
46 postInstall = lib.optionalString sslSupport ''
47 moveToOutput "lib/libevent_openssl*" "$openssl"
48 substituteInPlace "$dev/lib/pkgconfig/libevent_openssl.pc" \
49 --replace "$out" "$openssl"
50 sed "/^libdir=/s|$out|$openssl|" -i "$openssl"/lib/libevent_openssl.la
53 enableParallelBuilding = true;
56 description = "Event notification library";
58 The libevent API provides a mechanism to execute a callback function
59 when a specific event occurs on a file descriptor or after a timeout
60 has been reached. Furthermore, libevent also support callbacks due
61 to signals or regular timeouts.
63 libevent is meant to replace the event loop found in event driven
64 network servers. An application just needs to call event_dispatch()
65 and then add or remove events dynamically without having to change
68 homepage = "https://libevent.org/";
69 license = licenses.bsd3;
70 platforms = platforms.all;