libevent: Make OpenSSL dependency optional

This commit is contained in:
Aneesh Agrawal 2017-08-20 13:34:16 -07:00
parent 018a5ae2f4
commit 42a8ac1b71

View File

@ -1,4 +1,8 @@
{ stdenv, fetchurl, openssl, findutils }: { stdenv, fetchurl, findutils
, sslSupport? true, openssl
}:
assert sslSupport -> openssl != null;
stdenv.mkDerivation rec { stdenv.mkDerivation rec {
name = "libevent-${version}"; name = "libevent-${version}";
@ -11,13 +15,20 @@ stdenv.mkDerivation rec {
# libevent_openssl is moved into its own output, so that openssl isn't present # libevent_openssl is moved into its own output, so that openssl isn't present
# in the default closure. # in the default closure.
outputs = [ "out" "dev" "openssl" ]; outputs = [ "out" "dev" ]
++ stdenv.lib.optional sslSupport "openssl"
;
outputBin = "dev"; outputBin = "dev";
propagatedBuildOutputs = [ "out" "openssl" ]; propagatedBuildOutputs = [ "out" ]
++ stdenv.lib.optional sslSupport "openssl"
;
buildInputs = [ openssl ] ++ stdenv.lib.optional stdenv.isCygwin findutils; buildInputs = []
++ stdenv.lib.optional sslSupport openssl
++ stdenv.lib.optional stdenv.isCygwin findutils
;
postInstall = '' postInstall = stdenv.lib.optionalString sslSupport ''
moveToOutput "lib/libevent_openssl*" "$openssl" moveToOutput "lib/libevent_openssl*" "$openssl"
substituteInPlace "$dev/lib/pkgconfig/libevent_openssl.pc" \ substituteInPlace "$dev/lib/pkgconfig/libevent_openssl.pc" \
--replace "$out" "$openssl" --replace "$out" "$openssl"