Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
1{ 2 lib, 3 stdenv, 4 fetchurl, 5 findutils, 6 fixDarwinDylibNames, 7 updateAutotoolsGnuConfigScriptsHook, 8 sslSupport ? true, 9 openssl, 10 fetchpatch, 11 12 static ? stdenv.hostPlatform.isStatic, 13}: 14 15stdenv.mkDerivation rec { 16 pname = "libevent"; 17 version = "2.1.12"; 18 19 src = fetchurl { 20 url = "https://github.com/libevent/libevent/releases/download/release-${version}-stable/libevent-${version}-stable.tar.gz"; 21 sha256 = "1fq30imk8zd26x8066di3kpc5zyfc5z6frr3zll685zcx4dxxrlj"; 22 }; 23 24 patches = [ 25 # Don't define BIO_get_init() for LibreSSL 3.5+ 26 (fetchpatch { 27 url = "https://github.com/libevent/libevent/commit/883630f76cbf512003b81de25cd96cb75c6cf0f9.patch"; 28 sha256 = "sha256-VPJqJUAovw6V92jpqIXkIR1xYGbxIWxaHr8cePWI2SU="; 29 }) 30 ]; 31 32 configureFlags = lib.flatten [ 33 (lib.optional (!sslSupport) "--disable-openssl") 34 (lib.optionals static [ 35 "--disable-shared" 36 "--with-pic" 37 ]) 38 ]; 39 40 preConfigure = lib.optionalString (lib.versionAtLeast stdenv.hostPlatform.darwinMinVersion "11") '' 41 MACOSX_DEPLOYMENT_TARGET=10.16 42 ''; 43 44 # libevent_openssl is moved into its own output, so that openssl isn't present 45 # in the default closure. 46 outputs = [ 47 "out" 48 "dev" 49 ] 50 ++ lib.optional sslSupport "openssl"; 51 outputBin = "dev"; 52 propagatedBuildOutputs = [ "out" ] ++ lib.optional sslSupport "openssl"; 53 54 nativeBuildInputs = [ 55 updateAutotoolsGnuConfigScriptsHook 56 ] 57 ++ lib.optional stdenv.hostPlatform.isDarwin fixDarwinDylibNames; 58 59 buildInputs = 60 lib.optional sslSupport openssl ++ lib.optional stdenv.hostPlatform.isCygwin findutils; 61 62 doCheck = false; # needs the net 63 64 postInstall = lib.optionalString sslSupport '' 65 moveToOutput "lib/libevent_openssl*" "$openssl" 66 substituteInPlace "$dev/lib/pkgconfig/libevent_openssl.pc" \ 67 --replace "$out" "$openssl" 68 sed "/^libdir=/s|$out|$openssl|" -i "$openssl"/lib/libevent_openssl.la 69 ''; 70 71 enableParallelBuilding = true; 72 73 meta = with lib; { 74 description = "Event notification library"; 75 mainProgram = "event_rpcgen.py"; 76 longDescription = '' 77 The libevent API provides a mechanism to execute a callback function 78 when a specific event occurs on a file descriptor or after a timeout 79 has been reached. Furthermore, libevent also support callbacks due 80 to signals or regular timeouts. 81 82 libevent is meant to replace the event loop found in event driven 83 network servers. An application just needs to call event_dispatch() 84 and then add or remove events dynamically without having to change 85 the event loop. 86 ''; 87 homepage = "https://libevent.org/"; 88 license = licenses.bsd3; 89 platforms = platforms.all; 90 }; 91}