Merge pull request #226108 from Artturin/opensslperldep

authored by Artturi and committed by GitHub bf0d2694 bbf9b5de

+23 -46
+11 -23
pkgs/development/libraries/openssl/default.nix
··· 1 - { lib, stdenv, fetchurl, buildPackages, perl, coreutils 1 + { lib, stdenv, fetchurl, buildPackages, perl, coreutils, writeShellScript 2 + , makeWrapper 2 3 , withCryptodev ? false, cryptodev 3 4 , withZlib ? false, zlib 4 5 , enableSSL2 ? false 5 6 , enableSSL3 ? false 6 7 , enableKTLS ? stdenv.isLinux 7 8 , static ? stdenv.hostPlatform.isStatic 8 - # Used to avoid cross compiling perl, for example, in darwin bootstrap tools. 9 - # This will cause c_rehash to refer to perl via the environment, but otherwise 10 - # will produce a perfectly functional openssl binary and library. 11 - , withPerl ? stdenv.hostPlatform == stdenv.buildPlatform 12 9 # path to openssl.cnf file. will be placed in $etc/etc/ssl/openssl.cnf to replace the default 13 10 , conf ? null 14 11 , removeReferencesTo ··· 72 69 !(stdenv.hostPlatform.useLLVM or false) && 73 70 stdenv.cc.isGNU; 74 71 75 - nativeBuildInputs = [ perl ] 72 + nativeBuildInputs = [ makeWrapper perl ] 76 73 ++ lib.optionals static [ removeReferencesTo ]; 77 74 buildInputs = lib.optional withCryptodev cryptodev 78 - # perl is included to allow the interpreter path fixup hook to set the 79 - # correct interpreter in c_rehash. 80 - ++ lib.optional withPerl perl 81 75 ++ lib.optional withZlib zlib; 82 76 83 77 # TODO(@Ericson2314): Improve with mass rebuild ··· 172 166 173 167 # 'etc' is a separate output on static builds only. 174 168 etc=$out 175 - '') + lib.optionalString (!stdenv.hostPlatform.isWindows) 176 - # Fix bin/c_rehash's perl interpreter line 177 - # 178 - # - openssl 1_0_2: embeds a reference to buildPackages.perl 179 - # - openssl 1_1: emits "#!/usr/bin/env perl" 180 - # 181 - # In the case of openssl_1_0_2, reset the invalid reference and let the 182 - # interpreter hook take care of it. 183 - # 184 - # In both cases, if withPerl = false, the intepreter line is expected be 185 - # "#!/usr/bin/env perl" 186 - '' 187 - substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl}/bin/perl "/usr/bin/env perl" 188 - '' + '' 169 + '') + '' 189 170 mkdir -p $bin 190 171 mv $out/bin $bin/bin 172 + 173 + # c_rehash is a legacy perl script with the same functionality 174 + # as `openssl rehash` 175 + # this wrapper script is created to maintain backwards compatibility without 176 + # depending on perl 177 + makeWrapper $bin/bin/openssl $bin/bin/c_rehash \ 178 + --add-flags "rehash" 191 179 192 180 mkdir $dev 193 181 mv $out/include $dev/
+12 -23
pkgs/development/libraries/quictls/default.nix
··· 1 1 { lib, stdenv, fetchurl, buildPackages, perl, coreutils, fetchFromGitHub 2 + , makeWrapper 2 3 , withCryptodev ? false, cryptodev 3 4 , enableSSL2 ? false 4 5 , enableSSL3 ? false 5 6 , static ? stdenv.hostPlatform.isStatic 6 - # Used to avoid cross compiling perl, for example, in darwin bootstrap tools. 7 - # This will cause c_rehash to refer to perl via the environment, but otherwise 8 - # will produce a perfectly functional openssl binary and library. 9 - , withPerl ? stdenv.hostPlatform == stdenv.buildPlatform 10 7 , removeReferencesTo 11 8 }: 12 9 ··· 52 49 !(stdenv.hostPlatform.useLLVM or false) && 53 50 stdenv.cc.isGNU; 54 51 55 - nativeBuildInputs = [ perl removeReferencesTo ]; 56 - buildInputs = lib.optional withCryptodev cryptodev 57 - # perl is included to allow the interpreter path fixup hook to set the 58 - # correct interpreter in c_rehash. 59 - ++ lib.optional withPerl perl; 52 + nativeBuildInputs = [ makeWrapper perl removeReferencesTo ]; 53 + buildInputs = lib.optional withCryptodev cryptodev; 60 54 61 55 # TODO(@Ericson2314): Improve with mass rebuild 62 56 configurePlatforms = []; ··· 140 134 if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then 141 135 rm "$out/lib/"*.a 142 136 fi 143 - '') + lib.optionalString (!stdenv.hostPlatform.isWindows) 144 - # Fix bin/c_rehash's perl interpreter line 145 - # 146 - # - openssl 1_0_2: embeds a reference to buildPackages.perl 147 - # - openssl 1_1: emits "#!/usr/bin/env perl" 148 - # 149 - # In the case of openssl_1_0_2, reset the invalid reference and let the 150 - # interpreter hook take care of it. 151 - # 152 - # In both cases, if withPerl = false, the intepreter line is expected be 153 - # "#!/usr/bin/env perl" 154 - '' 155 - substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl}/bin/perl "/usr/bin/env perl" 156 - '' + '' 137 + '') + '' 157 138 mkdir -p $bin 158 139 mv $out/bin $bin/bin 140 + 141 + # c_rehash is a legacy perl script with the same functionality 142 + # as `openssl rehash` 143 + # this wrapper script is created to maintain backwards compatibility without 144 + # depending on perl 145 + makeWrapper $bin/bin/openssl $bin/bin/c_rehash \ 146 + --add-flags "rehash" 147 + 159 148 mkdir $dev 160 149 mv $out/include $dev/ 161 150 # remove dependency on Perl at runtime