···11-{ lib, stdenv, fetchurl, buildPackages, perl, coreutils
11+{ lib, stdenv, fetchurl, buildPackages, perl, coreutils, writeShellScript
22+, makeWrapper
23, withCryptodev ? false, cryptodev
34, withZlib ? false, zlib
45, enableSSL2 ? false
56, enableSSL3 ? false
67, enableKTLS ? stdenv.isLinux
78, static ? stdenv.hostPlatform.isStatic
88-# Used to avoid cross compiling perl, for example, in darwin bootstrap tools.
99-# This will cause c_rehash to refer to perl via the environment, but otherwise
1010-# will produce a perfectly functional openssl binary and library.
1111-, withPerl ? stdenv.hostPlatform == stdenv.buildPlatform
129# path to openssl.cnf file. will be placed in $etc/etc/ssl/openssl.cnf to replace the default
1310, conf ? null
1411, removeReferencesTo
···7269 !(stdenv.hostPlatform.useLLVM or false) &&
7370 stdenv.cc.isGNU;
74717575- nativeBuildInputs = [ perl ]
7272+ nativeBuildInputs = [ makeWrapper perl ]
7673 ++ lib.optionals static [ removeReferencesTo ];
7774 buildInputs = lib.optional withCryptodev cryptodev
7878- # perl is included to allow the interpreter path fixup hook to set the
7979- # correct interpreter in c_rehash.
8080- ++ lib.optional withPerl perl
8175 ++ lib.optional withZlib zlib;
82768377 # TODO(@Ericson2314): Improve with mass rebuild
···172166173167 # 'etc' is a separate output on static builds only.
174168 etc=$out
175175- '') + lib.optionalString (!stdenv.hostPlatform.isWindows)
176176- # Fix bin/c_rehash's perl interpreter line
177177- #
178178- # - openssl 1_0_2: embeds a reference to buildPackages.perl
179179- # - openssl 1_1: emits "#!/usr/bin/env perl"
180180- #
181181- # In the case of openssl_1_0_2, reset the invalid reference and let the
182182- # interpreter hook take care of it.
183183- #
184184- # In both cases, if withPerl = false, the intepreter line is expected be
185185- # "#!/usr/bin/env perl"
186186- ''
187187- substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl}/bin/perl "/usr/bin/env perl"
188188- '' + ''
169169+ '') + ''
189170 mkdir -p $bin
190171 mv $out/bin $bin/bin
172172+173173+ # c_rehash is a legacy perl script with the same functionality
174174+ # as `openssl rehash`
175175+ # this wrapper script is created to maintain backwards compatibility without
176176+ # depending on perl
177177+ makeWrapper $bin/bin/openssl $bin/bin/c_rehash \
178178+ --add-flags "rehash"
191179192180 mkdir $dev
193181 mv $out/include $dev/
+12-23
pkgs/development/libraries/quictls/default.nix
···11{ lib, stdenv, fetchurl, buildPackages, perl, coreutils, fetchFromGitHub
22+, makeWrapper
23, withCryptodev ? false, cryptodev
34, enableSSL2 ? false
45, enableSSL3 ? false
56, static ? stdenv.hostPlatform.isStatic
66-# Used to avoid cross compiling perl, for example, in darwin bootstrap tools.
77-# This will cause c_rehash to refer to perl via the environment, but otherwise
88-# will produce a perfectly functional openssl binary and library.
99-, withPerl ? stdenv.hostPlatform == stdenv.buildPlatform
107, removeReferencesTo
118}:
129···5249 !(stdenv.hostPlatform.useLLVM or false) &&
5350 stdenv.cc.isGNU;
54515555- nativeBuildInputs = [ perl removeReferencesTo ];
5656- buildInputs = lib.optional withCryptodev cryptodev
5757- # perl is included to allow the interpreter path fixup hook to set the
5858- # correct interpreter in c_rehash.
5959- ++ lib.optional withPerl perl;
5252+ nativeBuildInputs = [ makeWrapper perl removeReferencesTo ];
5353+ buildInputs = lib.optional withCryptodev cryptodev;
60546155 # TODO(@Ericson2314): Improve with mass rebuild
6256 configurePlatforms = [];
···140134 if [ -n "$(echo $out/lib/*.so $out/lib/*.dylib $out/lib/*.dll)" ]; then
141135 rm "$out/lib/"*.a
142136 fi
143143- '') + lib.optionalString (!stdenv.hostPlatform.isWindows)
144144- # Fix bin/c_rehash's perl interpreter line
145145- #
146146- # - openssl 1_0_2: embeds a reference to buildPackages.perl
147147- # - openssl 1_1: emits "#!/usr/bin/env perl"
148148- #
149149- # In the case of openssl_1_0_2, reset the invalid reference and let the
150150- # interpreter hook take care of it.
151151- #
152152- # In both cases, if withPerl = false, the intepreter line is expected be
153153- # "#!/usr/bin/env perl"
154154- ''
155155- substituteInPlace $out/bin/c_rehash --replace ${buildPackages.perl}/bin/perl "/usr/bin/env perl"
156156- '' + ''
137137+ '') + ''
157138 mkdir -p $bin
158139 mv $out/bin $bin/bin
140140+141141+ # c_rehash is a legacy perl script with the same functionality
142142+ # as `openssl rehash`
143143+ # this wrapper script is created to maintain backwards compatibility without
144144+ # depending on perl
145145+ makeWrapper $bin/bin/openssl $bin/bin/c_rehash \
146146+ --add-flags "rehash"
147147+159148 mkdir $dev
160149 mv $out/include $dev/
161150 # remove dependency on Perl at runtime