2015-05-29 07:52:29 +00:00
|
|
|
|
{ stdenv, fetchurl, perl
|
|
|
|
|
, withCryptodev ? false, cryptodevHeaders }:
|
|
|
|
|
|
2015-06-23 03:00:02 +00:00
|
|
|
|
with stdenv.lib;
|
2015-05-29 07:52:29 +00:00
|
|
|
|
let
|
2015-06-23 03:00:02 +00:00
|
|
|
|
opensslCrossSystem = attrByPath [ "openssl" "system" ]
|
2015-05-29 07:52:29 +00:00
|
|
|
|
(throw "openssl needs its platform name cross building" null)
|
|
|
|
|
stdenv.cross;
|
|
|
|
|
in
|
2015-06-23 03:00:02 +00:00
|
|
|
|
stdenv.mkDerivation rec {
|
2015-07-09 13:17:14 +00:00
|
|
|
|
name = "openssl-1.0.2d";
|
2015-05-29 07:52:29 +00:00
|
|
|
|
|
|
|
|
|
src = fetchurl {
|
|
|
|
|
urls = [
|
|
|
|
|
"http://www.openssl.org/source/${name}.tar.gz"
|
|
|
|
|
"http://openssl.linux-mirror.org/source/${name}.tar.gz"
|
|
|
|
|
];
|
2015-07-09 13:17:14 +00:00
|
|
|
|
sha1 = "d01d17b44663e8ffa6a33a5a30053779d9593c3d";
|
2015-05-29 07:52:29 +00:00
|
|
|
|
};
|
|
|
|
|
|
2015-06-23 03:00:02 +00:00
|
|
|
|
patches = optional stdenv.isCygwin ./1.0.1-cygwin64.patch;
|
2015-05-29 07:52:29 +00:00
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ perl ];
|
2015-06-23 03:00:02 +00:00
|
|
|
|
buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders;
|
2015-05-29 07:52:29 +00:00
|
|
|
|
|
|
|
|
|
# On x86_64-darwin, "./config" misdetects the system as
|
|
|
|
|
# "darwin-i386-cc". So specify the system type explicitly.
|
|
|
|
|
configureScript =
|
|
|
|
|
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";
|
|
|
|
|
|
2015-06-23 03:00:02 +00:00
|
|
|
|
configureFlags = [
|
|
|
|
|
"shared"
|
|
|
|
|
"--libdir=lib"
|
|
|
|
|
"--openssldir=etc/ssl"
|
|
|
|
|
] ++ stdenv.lib.optionals withCryptodev [
|
|
|
|
|
"-DHAVE_CRYPTODEV"
|
|
|
|
|
"-DUSE_CRYPTODEV_DIGESTS"
|
|
|
|
|
];
|
2015-05-29 07:52:29 +00:00
|
|
|
|
|
2015-06-23 03:00:02 +00:00
|
|
|
|
makeFlags = [
|
|
|
|
|
"MANDIR=$(out)/share/man"
|
|
|
|
|
];
|
2015-05-29 07:52:29 +00:00
|
|
|
|
|
|
|
|
|
# Parallel building is broken in OpenSSL.
|
|
|
|
|
enableParallelBuilding = false;
|
|
|
|
|
|
2015-06-23 03:00:02 +00: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
|
|
|
|
|
'';
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
'';
|
2015-05-29 07:52:29 +00:00
|
|
|
|
|
|
|
|
|
crossAttrs = {
|
2015-10-30 14:38:07 +00:00
|
|
|
|
# upstream patch: https://rt.openssl.org/Ticket/Display.html?id=2558
|
|
|
|
|
postPatch = ''
|
|
|
|
|
sed -i -e 's/[$][(]CROSS_COMPILE[)]windres/$(WINDRES)/' Makefile.shared
|
|
|
|
|
'';
|
2015-05-29 07:52:29 +00:00
|
|
|
|
preConfigure=''
|
|
|
|
|
# It's configure does not like --build or --host
|
2015-06-23 03:00:02 +00:00
|
|
|
|
export configureFlags="${concatStringsSep " " (configureFlags ++ [ opensslCrossSystem ])}"
|
2015-10-30 14:38:07 +00: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
|
2015-05-29 07:52:29 +00:00
|
|
|
|
'';
|
|
|
|
|
configureScript = "./Configure";
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
meta = {
|
|
|
|
|
homepage = http://www.openssl.org/;
|
|
|
|
|
description = "A cryptographic library that implements the SSL and TLS protocols";
|
|
|
|
|
platforms = stdenv.lib.platforms.all;
|
|
|
|
|
maintainers = [ stdenv.lib.maintainers.simons ];
|
|
|
|
|
priority = 10; # resolves collision with ‘man-pages’
|
|
|
|
|
};
|
|
|
|
|
}
|