|
|
|
@ -1,5 +1,5 @@ |
|
|
|
|
{ stdenv, fetchurl, buildPackages, perl |
|
|
|
|
, hostPlatform |
|
|
|
|
, buildPlatform, hostPlatform |
|
|
|
|
, fetchpatch |
|
|
|
|
, withCryptodev ? false, cryptodevHeaders |
|
|
|
|
, enableSSL2 ? false |
|
|
|
@ -8,10 +8,6 @@ |
|
|
|
|
with stdenv.lib; |
|
|
|
|
|
|
|
|
|
let |
|
|
|
|
|
|
|
|
|
opensslCrossSystem = hostPlatform.openssl.system or |
|
|
|
|
(throw "openssl needs its platform name cross building"); |
|
|
|
|
|
|
|
|
|
common = args@{ version, sha256, patches ? [] }: stdenv.mkDerivation rec { |
|
|
|
|
name = "openssl-${version}"; |
|
|
|
|
|
|
|
|
@ -24,23 +20,34 @@ let |
|
|
|
|
(args.patches or []) |
|
|
|
|
++ [ ./nix-ssl-cert-file.patch ] |
|
|
|
|
++ optional (versionOlder version "1.1.0") |
|
|
|
|
(if stdenv.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch) |
|
|
|
|
(if hostPlatform.isDarwin then ./use-etc-ssl-certs-darwin.patch else ./use-etc-ssl-certs.patch) |
|
|
|
|
++ optional (versionOlder version "1.0.2" && hostPlatform.isDarwin) |
|
|
|
|
./darwin-arch.patch; |
|
|
|
|
|
|
|
|
|
outputs = [ "bin" "dev" "out" "man" ]; |
|
|
|
|
setOutputFlags = false; |
|
|
|
|
separateDebugInfo = stdenv.isLinux; |
|
|
|
|
separateDebugInfo = hostPlatform.isLinux; |
|
|
|
|
|
|
|
|
|
nativeBuildInputs = [ perl ]; |
|
|
|
|
buildInputs = stdenv.lib.optional withCryptodev cryptodevHeaders; |
|
|
|
|
|
|
|
|
|
# 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"; |
|
|
|
|
# TODO(@Ericson2314): Improve with mass rebuild |
|
|
|
|
configureScript = { |
|
|
|
|
"x86_64-darwin" = "./Configure darwin64-x86_64-cc"; |
|
|
|
|
"x86_64-solaris" = "./Configure solaris64-x86_64-gcc"; |
|
|
|
|
}.${hostPlatform.system} or ( |
|
|
|
|
if hostPlatform == buildPlatform |
|
|
|
|
then "./config" |
|
|
|
|
else if hostPlatform.isMinGW |
|
|
|
|
then "./Configure mingw${toString hostPlatform.parsed.cpu.bits}" |
|
|
|
|
else if hostPlatform.isLinux |
|
|
|
|
then "./Configure linux-generic${toString hostPlatform.parsed.cpu.bits}" |
|
|
|
|
else |
|
|
|
|
throw "Not sure what configuration to use for ${hostPlatform.config}" |
|
|
|
|
); |
|
|
|
|
|
|
|
|
|
# TODO(@Ericson2314): Make unconditional on mass rebuild |
|
|
|
|
${if buildPlatform != hostPlatform then "configurePlatforms" else null} = []; |
|
|
|
|
|
|
|
|
|
configureFlags = [ |
|
|
|
|
"shared" |
|
|
|
@ -50,7 +57,7 @@ let |
|
|
|
|
"-DHAVE_CRYPTODEV" |
|
|
|
|
"-DUSE_CRYPTODEV_DIGESTS" |
|
|
|
|
] ++ stdenv.lib.optional enableSSL2 "enable-ssl2" |
|
|
|
|
++ stdenv.lib.optional (versionAtLeast version "1.1.0" && stdenv.isAarch64) "no-afalgeng"; |
|
|
|
|
++ stdenv.lib.optional (versionAtLeast version "1.1.0" && hostPlatform.isAarch64) "no-afalgeng"; |
|
|
|
|
|
|
|
|
|
makeFlags = [ "MANDIR=$(man)/share/man" ]; |
|
|
|
|
|
|
|
|
@ -84,18 +91,6 @@ let |
|
|
|
|
fi |
|
|
|
|
''; |
|
|
|
|
|
|
|
|
|
crossAttrs = { |
|
|
|
|
# upstream patch: https://rt.openssl.org/Ticket/Display.html?id=2558 |
|
|
|
|
postPatch = '' |
|
|
|
|
sed -i -e 's/[$][(]CROSS_COMPILE[)]windres/$(WINDRES)/' Makefile.shared |
|
|
|
|
''; |
|
|
|
|
preConfigure='' |
|
|
|
|
# It's configure does not like --build or --host |
|
|
|
|
export configureFlags="${concatStringsSep " " (configureFlags ++ [ opensslCrossSystem ])}" |
|
|
|
|
''; |
|
|
|
|
configureScript = "./Configure"; |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
meta = { |
|
|
|
|
homepage = https://www.openssl.org/; |
|
|
|
|
description = "A cryptographic library that implements the SSL and TLS protocols"; |
|
|
|
|