2012-09-23 11:50:24 -07:00
|
|
|
|
{ stdenv, fetchurl, perl
|
2016-02-01 01:18:31 -08:00
|
|
|
|
, withCryptodev ? false, cryptodevHeaders
|
2016-02-03 04:45:05 -08:00
|
|
|
|
}:
|
2008-04-23 00:34:20 -07:00
|
|
|
|
|
2015-06-20 14:26:47 -07:00
|
|
|
|
with stdenv.lib;
|
2010-03-05 15:22:36 -08:00
|
|
|
|
let
|
2015-06-20 14:26:47 -07:00
|
|
|
|
opensslCrossSystem = attrByPath [ "openssl" "system" ]
|
2010-03-05 15:22:36 -08:00
|
|
|
|
(throw "openssl needs its platform name cross building" null)
|
|
|
|
|
stdenv.cross;
|
2012-01-06 13:31:29 -08:00
|
|
|
|
in
|
2015-06-20 14:26:47 -07:00
|
|
|
|
stdenv.mkDerivation rec {
|
2016-01-28 09:56:04 -08:00
|
|
|
|
name = "openssl-1.0.1r";
|
2012-01-06 13:31:29 -08:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
2012-02-26 09:22:50 -08:00
|
|
|
|
urls = [
|
|
|
|
|
"http://www.openssl.org/source/${name}.tar.gz"
|
|
|
|
|
"http://openssl.linux-mirror.org/source/${name}.tar.gz"
|
|
|
|
|
];
|
2016-01-28 09:56:04 -08:00
|
|
|
|
sha256 = "0iik7a3b0mrfrxzngdf7ywfscg9inbw77y0jp2ccw0gdap9xhjvq";
|
2012-01-06 13:31:29 -08:00
|
|
|
|
};
|
|
|
|
|
|
2015-07-26 15:25:53 -07:00
|
|
|
|
outputs = [ "out" "man" ];
|
|
|
|
|
|
2016-02-03 04:45:05 -08:00
|
|
|
|
patches =
|
|
|
|
|
[ ./use-etc-ssl-certs.patch ]
|
|
|
|
|
++ optional stdenv.isCygwin ./1.0.1-cygwin64.patch
|
2015-06-20 14:26:47 -07:00
|
|
|
|
++ optional (stdenv.isDarwin || (stdenv ? cross && stdenv.cross.libc == "libSystem")) ./darwin-arch.patch;
|
2012-09-23 11:50:24 -07:00
|
|
|
|
|
2012-12-28 10:20:09 -08:00
|
|
|
|
nativeBuildInputs = [ perl ];
|
2015-06-20 14:26:47 -07:00
|
|
|
|
buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders;
|
2011-09-21 11:45:52 -07:00
|
|
|
|
|
2010-07-25 02:09:32 -07:00
|
|
|
|
# On x86_64-darwin, "./config" misdetects the system as
|
|
|
|
|
# "darwin-i386-cc". So specify the system type explicitly.
|
|
|
|
|
configureScript =
|
2013-02-20 01:18:26 -08:00
|
|
|
|
if stdenv.system == "x86_64-darwin" then "./Configure darwin64-x86_64-cc"
|
|
|
|
|
else if stdenv.system == "x86_64-solaris" then "./Configure solaris64-x86_64-gcc"
|
|
|
|
|
else "./config";
|
2011-09-21 11:45:52 -07:00
|
|
|
|
|
2015-06-20 14:26:47 -07:00
|
|
|
|
configureFlags = [
|
|
|
|
|
"shared"
|
|
|
|
|
"--libdir=lib"
|
|
|
|
|
"--openssldir=etc/ssl"
|
|
|
|
|
] ++ stdenv.lib.optionals withCryptodev [
|
|
|
|
|
"-DHAVE_CRYPTODEV"
|
|
|
|
|
"-DUSE_CRYPTODEV_DIGESTS"
|
|
|
|
|
];
|
2014-05-29 05:47:07 -07:00
|
|
|
|
|
2015-06-20 14:26:47 -07:00
|
|
|
|
makeFlags = [
|
|
|
|
|
"MANDIR=$(out)/share/man"
|
|
|
|
|
];
|
2011-11-04 11:48:25 -07:00
|
|
|
|
|
2012-11-23 08:24:35 -08:00
|
|
|
|
# Parallel building is broken in OpenSSL.
|
2014-08-08 00:46:57 -07:00
|
|
|
|
enableParallelBuilding = false;
|
2012-11-23 08:24:35 -08:00
|
|
|
|
|
2015-06-20 14:26:47 -07:00
|
|
|
|
postInstall = ''
|
|
|
|
|
# If we're building dynamic libraries, then don't install static
|
|
|
|
|
# libraries.
|
|
|
|
|
if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
|
|
|
|
|
rm "$out/lib/"*.a
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# remove dependency on Perl at runtime
|
|
|
|
|
rm -r $out/etc/ssl/misc $out/bin/c_rehash
|
2016-02-01 01:18:31 -08:00
|
|
|
|
|
2016-02-03 04:45:05 -08:00
|
|
|
|
rmdir $out/etc/ssl/certs
|
2015-06-20 14:26:47 -07:00
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
postFixup = ''
|
|
|
|
|
# Check to make sure we don't depend on perl
|
|
|
|
|
if grep -r '${perl}' $out; then
|
|
|
|
|
echo "Found an erroneous dependency on perl ^^^" >&2
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
'';
|
2011-02-09 07:27:34 -08:00
|
|
|
|
|
2016-02-03 04:45:05 -08:00
|
|
|
|
setupHook = builtins.toFile "openssl-setup-hook"
|
|
|
|
|
''
|
|
|
|
|
export SSL_CERT_FILE=/no-cert-file.crt
|
|
|
|
|
'';
|
|
|
|
|
|
2010-03-05 15:22:36 -08:00
|
|
|
|
crossAttrs = {
|
2015-10-30 07:38:07 -07:00
|
|
|
|
# upstream patch: https://rt.openssl.org/Ticket/Display.html?id=2558
|
|
|
|
|
postPatch = ''
|
|
|
|
|
sed -i -e 's/[$][(]CROSS_COMPILE[)]windres/$(WINDRES)/' Makefile.shared
|
|
|
|
|
'';
|
2010-07-23 08:05:20 -07:00
|
|
|
|
preConfigure=''
|
2010-08-02 15:10:42 -07:00
|
|
|
|
# It's configure does not like --build or --host
|
2015-06-20 14:26:47 -07:00
|
|
|
|
export configureFlags="${concatStringsSep " " (configureFlags ++ [ opensslCrossSystem ])}"
|
2015-10-30 07:38:07 -07:00
|
|
|
|
# WINDRES and RANLIB need to be prefixed when cross compiling;
|
|
|
|
|
# the openssl configure script doesn't do that for us
|
|
|
|
|
export WINDRES=${stdenv.cross.config}-windres
|
|
|
|
|
export RANLIB=${stdenv.cross.config}-ranlib
|
2010-03-05 15:22:36 -08:00
|
|
|
|
'';
|
2010-08-02 15:10:42 -07:00
|
|
|
|
configureScript = "./Configure";
|
2010-03-05 15:22:36 -08:00
|
|
|
|
};
|
|
|
|
|
|
2008-10-09 07:29:06 -07:00
|
|
|
|
meta = {
|
|
|
|
|
homepage = http://www.openssl.org/;
|
|
|
|
|
description = "A cryptographic library that implements the SSL and TLS protocols";
|
2011-09-21 11:45:52 -07:00
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
|
|
|
|
maintainers = [ stdenv.lib.maintainers.simons ];
|
2012-01-04 11:48:08 -08:00
|
|
|
|
priority = 10; # resolves collision with ‘man-pages’
|
2008-10-09 07:29:06 -07:00
|
|
|
|
};
|
2010-07-18 14:54:14 -07:00
|
|
|
|
}
|