2012-09-23 11:50:24 -07:00
|
|
|
|
{ stdenv, fetchurl, perl
|
|
|
|
|
, withCryptodev ? false, cryptodevHeaders }:
|
2008-04-23 00:34:20 -07:00
|
|
|
|
|
2010-03-05 15:22:36 -08:00
|
|
|
|
let
|
2014-08-08 00:46:57 -07:00
|
|
|
|
name = "openssl-1.0.1i";
|
2011-09-21 11:48:04 -07:00
|
|
|
|
|
2010-03-05 15:22:36 -08:00
|
|
|
|
opensslCrossSystem = stdenv.lib.attrByPath [ "openssl" "system" ]
|
|
|
|
|
(throw "openssl needs its platform name cross building" null)
|
|
|
|
|
stdenv.cross;
|
2010-01-20 05:49:07 -08:00
|
|
|
|
|
2014-03-11 22:25:54 -07:00
|
|
|
|
patchesCross = isCross: let
|
|
|
|
|
isDarwin = stdenv.isDarwin || (isCross && stdenv.cross.libc == "libSystem");
|
|
|
|
|
in
|
2011-11-04 11:48:25 -07:00
|
|
|
|
[ # Allow the location of the X509 certificate file (the CA
|
|
|
|
|
# bundle) to be set through the environment variable
|
|
|
|
|
# ‘OPENSSL_X509_CERT_FILE’. This is necessary because the
|
|
|
|
|
# default location ($out/ssl/cert.pem) doesn't exist, and
|
|
|
|
|
# hardcoding something like /etc/ssl/cert.pem is impure and
|
|
|
|
|
# cannot be overriden per-process. For security, the
|
|
|
|
|
# environment variable is ignored for setuid binaries.
|
|
|
|
|
./cert-file.patch
|
|
|
|
|
]
|
2012-01-05 15:46:17 -08:00
|
|
|
|
|
2012-01-23 04:59:18 -08:00
|
|
|
|
++ stdenv.lib.optionals (isCross && opensslCrossSystem == "hurd-x86")
|
2012-01-05 15:46:17 -08:00
|
|
|
|
[ ./cert-file-path-max.patch # merge with `cert-file.patch' eventually
|
|
|
|
|
./gnu.patch # submitted upstream
|
2012-01-23 04:59:18 -08:00
|
|
|
|
]
|
2012-01-05 15:46:17 -08:00
|
|
|
|
|
2012-08-13 05:05:27 -07:00
|
|
|
|
++ stdenv.lib.optionals (stdenv.system == "x86_64-kfreebsd-gnu")
|
|
|
|
|
[ ./gnu.patch
|
|
|
|
|
./kfreebsd-gnu.patch
|
|
|
|
|
]
|
|
|
|
|
|
2014-03-11 22:25:54 -07:00
|
|
|
|
++ stdenv.lib.optional isDarwin ./darwin-arch.patch;
|
2012-08-24 19:24:49 -07:00
|
|
|
|
|
2012-01-06 13:31:29 -08:00
|
|
|
|
in
|
|
|
|
|
|
|
|
|
|
stdenv.mkDerivation {
|
|
|
|
|
inherit name;
|
|
|
|
|
|
|
|
|
|
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"
|
|
|
|
|
];
|
2014-08-08 00:46:57 -07:00
|
|
|
|
sha256 = "1izwv1wzqdw8aqnvb70jcqpqp0rvkcm22w5c1dm9l1kpr939y5rw";
|
2012-01-06 13:31:29 -08:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
patches = patchesCross false;
|
2010-07-18 14:54:14 -07:00
|
|
|
|
|
2013-06-11 05:28:49 -07:00
|
|
|
|
outputs = [ "dev" "out" "man" "bin" ];
|
|
|
|
|
|
2014-08-25 15:17:03 -07:00
|
|
|
|
setOutputFlags = false; # ToDo: strange?
|
2012-08-24 19:24:49 -07:00
|
|
|
|
|
2012-09-23 11:50:24 -07:00
|
|
|
|
buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders;
|
|
|
|
|
|
2012-12-28 10:20:09 -08:00
|
|
|
|
nativeBuildInputs = [ perl ];
|
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
|
|
|
|
|
2012-11-23 08:24:35 -08:00
|
|
|
|
configureFlags = "shared --libdir=lib --openssldir=etc/ssl" +
|
2014-05-29 05:47:07 -07:00
|
|
|
|
stdenv.lib.optionalString withCryptodev " -DHAVE_CRYPTODEV -DUSE_CRYPTODEV_DIGESTS" +
|
|
|
|
|
stdenv.lib.optionalString (stdenv.system == "x86_64-cygwin") " no-asm";
|
|
|
|
|
|
|
|
|
|
preBuild = stdenv.lib.optionalString (stdenv.system == "x86_64-cygwin") ''
|
|
|
|
|
sed -i -e "s|-march=i486|-march=x86-64|g" Makefile
|
|
|
|
|
'';
|
2008-10-09 07:29:06 -07:00
|
|
|
|
|
2012-08-24 19:24:49 -07:00
|
|
|
|
makeFlags = "MANDIR=$(man)/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
|
|
|
|
|
2011-02-09 07:27:34 -08:00
|
|
|
|
postInstall =
|
|
|
|
|
''
|
|
|
|
|
# If we're building dynamic libraries, then don't install static
|
|
|
|
|
# libraries.
|
2012-12-18 09:03:26 -08:00
|
|
|
|
if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib)" ]; then
|
2011-02-09 07:27:34 -08:00
|
|
|
|
rm $out/lib/*.a
|
|
|
|
|
fi
|
2012-08-24 20:42:33 -07:00
|
|
|
|
|
|
|
|
|
mkdir -p $bin
|
|
|
|
|
mv $out/bin $bin/
|
|
|
|
|
|
2013-06-11 03:39:32 -07:00
|
|
|
|
rm -rf $out/etc/ssl/misc
|
2013-06-11 05:28:49 -07:00
|
|
|
|
|
|
|
|
|
mkdir $dev
|
|
|
|
|
mv $out/include $dev/
|
2013-06-12 07:10:54 -07:00
|
|
|
|
|
|
|
|
|
# OpenSSL installs readonly files, which otherwise we can't strip.
|
|
|
|
|
# FIXME: Can remove this after the next stdenv merge.
|
|
|
|
|
chmod -R +w $out
|
2011-02-09 07:27:34 -08:00
|
|
|
|
''; # */
|
|
|
|
|
|
2010-03-05 15:22:36 -08:00
|
|
|
|
crossAttrs = {
|
2012-01-06 13:31:29 -08:00
|
|
|
|
patches = patchesCross true;
|
|
|
|
|
|
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
|
|
|
|
|
export configureFlags="--libdir=lib --cross-compile-prefix=${stdenv.cross.config}- shared ${opensslCrossSystem}"
|
2010-03-05 15:22:36 -08:00
|
|
|
|
'';
|
2010-08-09 14:37:31 -07:00
|
|
|
|
|
2010-08-02 15:10:42 -07:00
|
|
|
|
configureScript = "./Configure";
|
2014-03-10 14:27:54 -07:00
|
|
|
|
} // stdenv.lib.optionalAttrs (opensslCrossSystem == "darwin64-x86_64-cc") {
|
|
|
|
|
CC = "gcc";
|
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
|
|
|
|
}
|