summary refs log tree commit diff
path: root/pkgs/development/libraries/openssl/default.nix
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2018-01-26 20:40:05 -0500
committerJohn Ericson <Ericson2314@yahoo.com>2018-01-26 21:22:00 -0500
commit57b01b1bcf77fc86b82f84e3c0d4904e2464a1b1 (patch)
tree0ed9bc83a911294e7259db8b942b8029b6c79bef /pkgs/development/libraries/openssl/default.nix
parent16a50f5a07bc1cffaa62acf4464405350bcd3c6e (diff)
downloadnixlib-57b01b1bcf77fc86b82f84e3c0d4904e2464a1b1.tar
nixlib-57b01b1bcf77fc86b82f84e3c0d4904e2464a1b1.tar.gz
nixlib-57b01b1bcf77fc86b82f84e3c0d4904e2464a1b1.tar.bz2
nixlib-57b01b1bcf77fc86b82f84e3c0d4904e2464a1b1.tar.lz
nixlib-57b01b1bcf77fc86b82f84e3c0d4904e2464a1b1.tar.xz
nixlib-57b01b1bcf77fc86b82f84e3c0d4904e2464a1b1.tar.zst
nixlib-57b01b1bcf77fc86b82f84e3c0d4904e2464a1b1.zip
lib, openssl: Get rid of openssl.system
We compute it on the fly, careful to avoid any mass rebuilds for now.
Diffstat (limited to 'pkgs/development/libraries/openssl/default.nix')
-rw-r--r--pkgs/development/libraries/openssl/default.nix47
1 files changed, 21 insertions, 26 deletions
diff --git a/pkgs/development/libraries/openssl/default.nix b/pkgs/development/libraries/openssl/default.nix
index 94c49af8c4f1..775e6056dffc 100644
--- a/pkgs/development/libraries/openssl/default.nix
+++ b/pkgs/development/libraries/openssl/default.nix
@@ -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";