Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at 24.05-beta 73 lines 2.5 kB view raw
1{ lib, stdenv, fetchurl, findutils, fixDarwinDylibNames 2, sslSupport ? true, openssl 3, fetchpatch 4}: 5 6stdenv.mkDerivation rec { 7 pname = "libevent"; 8 version = "2.1.12"; 9 10 src = fetchurl { 11 url = "https://github.com/libevent/libevent/releases/download/release-${version}-stable/libevent-${version}-stable.tar.gz"; 12 sha256 = "1fq30imk8zd26x8066di3kpc5zyfc5z6frr3zll685zcx4dxxrlj"; 13 }; 14 15 patches = [ 16 # Don't define BIO_get_init() for LibreSSL 3.5+ 17 (fetchpatch { 18 url = "https://github.com/libevent/libevent/commit/883630f76cbf512003b81de25cd96cb75c6cf0f9.patch"; 19 sha256 = "sha256-VPJqJUAovw6V92jpqIXkIR1xYGbxIWxaHr8cePWI2SU="; 20 }) 21 ]; 22 23 configureFlags = lib.optional (!sslSupport) "--disable-openssl"; 24 25 preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") '' 26 MACOSX_DEPLOYMENT_TARGET=10.16 27 ''; 28 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" 33 ; 34 outputBin = "dev"; 35 propagatedBuildOutputs = [ "out" ] 36 ++ lib.optional sslSupport "openssl" 37 ; 38 39 nativeBuildInputs = lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; 40 41 buildInputs = lib.optional sslSupport openssl 42 ++ lib.optional stdenv.isCygwin findutils; 43 44 doCheck = false; # needs the net 45 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 51 ''; 52 53 enableParallelBuilding = true; 54 55 meta = with lib; { 56 description = "Event notification library"; 57 mainProgram = "event_rpcgen.py"; 58 longDescription = '' 59 The libevent API provides a mechanism to execute a callback function 60 when a specific event occurs on a file descriptor or after a timeout 61 has been reached. Furthermore, libevent also support callbacks due 62 to signals or regular timeouts. 63 64 libevent is meant to replace the event loop found in event driven 65 network servers. An application just needs to call event_dispatch() 66 and then add or remove events dynamically without having to change 67 the event loop. 68 ''; 69 homepage = "https://libevent.org/"; 70 license = licenses.bsd3; 71 platforms = platforms.all; 72 }; 73}