lib, openssl: Get rid of openssl.system

We compute it on the fly, careful to avoid any mass rebuilds for now.
This commit is contained in:
John Ericson 2018-01-26 20:40:05 -05:00 committed by John Ericson
parent 16a50f5a07
commit 57b01b1bcf
3 changed files with 22 additions and 36 deletions

View File

@ -15,7 +15,6 @@ rec {
float = "soft";
libc = "glibc";
platform = platforms.sheevaplug;
openssl.system = "linux-generic32";
};
raspberryPi = rec {
@ -25,7 +24,6 @@ rec {
fpu = "vfp";
libc = "glibc";
platform = platforms.raspberrypi;
openssl.system = "linux-generic32";
};
armv7l-hf-multiplatform = rec {
@ -35,7 +33,6 @@ rec {
fpu = "vfpv3-d16";
libc = "glibc";
platform = platforms.armv7l-hf-multiplatform;
openssl.system = "linux-generic32";
};
aarch64-multiplatform = rec {
@ -54,12 +51,8 @@ rec {
arch = "armv5tel";
config = "armv5tel-unknown-linux-gnueabi";
float = "soft";
platform = platforms.pogoplug4;
libc = "glibc";
openssl.system = "linux-generic32";
platform = platforms.pogoplug4;
};
fuloongminipc = rec {
@ -68,7 +61,6 @@ rec {
float = "hard";
libc = "glibc";
platform = platforms.fuloong2f_n32;
openssl.system = "linux-generic32";
};
#

View File

@ -21,7 +21,6 @@ let
crossSystem = {
libc = "msvcrt";
platform = {};
openssl.system = "mingw64";
inherit arch;
config = "${arch}-w64-mingw32";
};

View File

@ -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";