diff options
author | Alyssa Ross <hi@alyssa.is> | 2021-04-09 18:28:16 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2021-04-12 18:46:15 +0000 |
commit | fd2e737e0678ee7d8081baef05b305146a2c0034 (patch) | |
tree | ac3e9b27576a0382335532d126f9a66d486bc638 /nixpkgs/pkgs/development/libraries/openssl | |
parent | cc207d720b6aa836e256c1ee9842bc739e630a8a (diff) | |
parent | 9e377a6ce42dccd9b624ae4ce8f978dc892ba0e2 (diff) | |
download | nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.gz nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.bz2 nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.lz nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.xz nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.tar.zst nixlib-fd2e737e0678ee7d8081baef05b305146a2c0034.zip |
Merge remote-tracking branch 'nixpkgs/nixos-unstable'
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/openssl')
-rw-r--r-- | nixpkgs/pkgs/development/libraries/openssl/default.nix | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/nixpkgs/pkgs/development/libraries/openssl/default.nix b/nixpkgs/pkgs/development/libraries/openssl/default.nix index 49ac7954169f..fda0c71655a6 100644 --- a/nixpkgs/pkgs/development/libraries/openssl/default.nix +++ b/nixpkgs/pkgs/development/libraries/openssl/default.nix @@ -3,8 +3,17 @@ , enableSSL2 ? false , enableSSL3 ? false , static ? stdenv.hostPlatform.isStatic +# Used to avoid cross compiling perl, for example, in darwin bootstrap tools. +# This will cause c_rehash to refer to perl via the environment, but otherwise +# will produce a perfectly functional openssl binary and library. +, withPerl ? true }: +assert ( + lib.assertMsg (!withPerl -> stdenv.hostPlatform != stdenv.buildPlatform) + "withPerl should not be disabled unless cross compiling" +); + # Note: this package is used for bootstrapping fetchurl, and thus # cannot use fetchpatch! All mutable patches (generated by GitHub or # cgit) that are needed here should be included directly in Nixpkgs as @@ -46,7 +55,10 @@ let separateDebugInfo = !(stdenv.hostPlatform.useLLVM or false) && stdenv.cc.isGNU; nativeBuildInputs = [ perl ]; - buildInputs = lib.optional withCryptodev cryptodev; + buildInputs = lib.optional withCryptodev cryptodev + # perl is included to allow the interpreter path fixup hook to set the + # correct interpreter in c_rehash. + ++ lib.optional withPerl perl; # TODO(@Ericson2314): Improve with mass rebuild configurePlatforms = []; @@ -108,12 +120,20 @@ let rm "$out/lib/"*.a fi - '' + - '' mkdir -p $bin '' + lib.optionalString (!stdenv.hostPlatform.isWindows) + # Fix bin/c_rehash's perl interpreter line + # + # - openssl 1_0_2: embeds a reference to buildPackages.perl + # - openssl 1_1: emits "#!/usr/bin/env perl" + # + # In the case of openssl_1_0_2, reset the invalid reference and let the + # interpreter hook take care of it. + # + # In both cases, if withPerl = false, the intepreter line is expected be + # "#!/usr/bin/env perl" '' - substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl} ${perl} + substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl}/bin/perl "/usr/bin/env perl" '' + '' mv $out/bin $bin/ |