mirror of
https://github.com/NixOS/nixpkgs.git
synced 2026-07-22 00:20:58 +00:00
makeBinaryWrapper: fix passthru.extractCmd on darwin
On darwin, strings does not support -d. Regardless of darwin, the generated extract script has `strings` without a full nix store path, making it potentially impure. The solution is to always pull `strings` from GNU toolchain, regardless of the platform. Note: this change should have no implications for darwin bootstrap because `passthru.extractCmd` has very limited use in the tree, basically only used when building Firefox, and is not evaluated otherwise. Note: previous attempt to resolve the issue was incorrect, effectively doing nothing on Darwin, see #379014. (The `targetPackages.gnuStdenv.cc.bintools.targetPrefix` was empty.)
This commit is contained in:
@@ -24,9 +24,13 @@ makeSetupHook {
|
||||
|
||||
passthru = {
|
||||
# Extract the function call used to create a binary wrapper from its embedded docstring
|
||||
extractCmd = writeShellScript "extract-binary-wrapper-cmd" ''
|
||||
${targetPackages.gnuStdenv.cc.bintools.targetPrefix}strings -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p'
|
||||
'';
|
||||
extractCmd =
|
||||
let
|
||||
bintools = targetPackages.gnuStdenv.cc.bintools;
|
||||
in
|
||||
writeShellScript "extract-binary-wrapper-cmd" ''
|
||||
${lib.getExe' bintools "${bintools.targetPrefix}strings"} -dw "$1" | sed -n '/^makeCWrapper/,/^$/ p'
|
||||
'';
|
||||
|
||||
tests = tests.makeBinaryWrapper;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user