lol
1{ stdenv, fetchFromGitHub, perl, zlib
2, withCryptodev ? false, cryptodevHeaders
3}:
4
5with stdenv.lib;
6stdenv.mkDerivation rec {
7 name = "openssl-chacha-${version}";
8 version = "2016-01-27";
9
10 src = fetchFromGitHub {
11 owner = "PeterMosmans";
12 repo = "openssl";
13 rev = "4576ede5b08242bcd6749fc284c691ed177842b7";
14 sha256 = "1030rs4bdaysxbq0mmck1dn6g5adspzkwsrnhvv16b4ig0r4ncgj";
15 };
16
17 outputs = [ "bin" "dev" "out" "man" ];
18 setOutputFlags = false;
19
20 nativeBuildInputs = [ perl zlib ];
21 buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders;
22
23 configureScript = "./config";
24
25 configureFlags = [
26 "zlib"
27 "shared"
28 "experimental-jpake"
29 "enable-md2"
30 "enable-rc5"
31 "enable-rfc3779"
32 "enable-gost"
33 "--libdir=lib"
34 "--openssldir=etc/ssl"
35 ] ++ stdenv.lib.optionals withCryptodev [
36 "-DHAVE_CRYPTODEV"
37 "-DUSE_CRYPTODEV_DIGESTS"
38 ];
39
40 makeFlags = [
41 "MANDIR=$(man)/share/man"
42 ];
43
44 # Parallel building is broken in OpenSSL.
45 enableParallelBuilding = false;
46
47 postInstall = ''
48 # If we're building dynamic libraries, then don't install static
49 # libraries.
50 if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
51 rm "$out/lib/"*.a
52 fi
53
54 mkdir -p $bin
55 mv $out/bin $bin/
56
57 mkdir $dev
58 mv $out/include $dev/
59
60 # remove dependency on Perl at runtime
61 rm -r $out/etc/ssl/misc
62
63 rmdir $out/etc/ssl/{certs,private}
64 '';
65
66 postFixup = ''
67 # Check to make sure we don't depend on perl
68 if grep -r '${perl}' $out; then
69 echo "Found an erroneous dependency on perl ^^^" >&2
70 exit 1
71 fi
72 '';
73
74 meta = {
75 homepage = http://www.openssl.org/;
76 description = "A cryptographic library that implements the SSL and TLS protocols";
77 platforms = [ "x86_64-linux" ];
78 maintainers = [ stdenv.lib.maintainers.cstrahan ];
79 priority = 10; # resolves collision with ‘man-pages’
80 };
81}