makeBinaryWrapper: move into its own folder

The derivation is complex enough to warrant moving out of
all-packages.nix
main
Naïm Favier 2 years ago
parent 3a79190750
commit 0d6bcb513b
No known key found for this signature in database
GPG Key ID: 49B07322580B7EE2
  1. 2
      doc/stdenv/stdenv.chapter.md
  2. 20
      pkgs/build-support/setup-hooks/make-binary-wrapper/default.nix
  3. 2
      pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh
  4. 8
      pkgs/test/default.nix
  5. 25
      pkgs/top-level/all-packages.nix

@ -869,7 +869,7 @@ makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz
makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello git ]}
```
There’s many more kinds of arguments, they are documented in `nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh` for the `makeWrapper` implementation and in `nixpkgs/pkgs/build-support/setup-hooks/make-binary-wrapper.sh` for the `makeBinaryWrapper` implementation.
There’s many more kinds of arguments, they are documented in `nixpkgs/pkgs/build-support/setup-hooks/make-wrapper.sh` for the `makeWrapper` implementation and in `nixpkgs/pkgs/build-support/setup-hooks/make-binary-wrapper/make-binary-wrapper.sh` for the `makeBinaryWrapper` implementation.
`wrapProgram` is a convenience function you probably want to use most of the time, implemented by both `makeWrapper` and `makeBinaryWrapper`.

@ -0,0 +1,20 @@
{ stdenv
, lib
, makeSetupHook
, dieHook
, tests
, cc ? stdenv.cc
, sanitizers ? []
}:
makeSetupHook {
deps = [ dieHook cc ];
substitutions = {
cc = let
san = lib.escapeShellArgs (map (s: "-fsanitize=${s}") sanitizers);
in "${cc}/bin/cc ${san}";
passthru.tests = tests.makeBinaryWrapper;
};
} ./make-binary-wrapper.sh

@ -43,7 +43,7 @@ makeWrapper() {
mkdir -p "$(dirname "$wrapper")"
makeDocumentedCWrapper "$original" "$@" | \
@CC@ \
@cc@ \
-Wall -Werror -Wpedantic \
-Wno-overlength-strings \
-Os \

@ -71,7 +71,13 @@ with pkgs;
dhall = callPackage ./dhall { };
makeWrapper = callPackage ./make-wrapper {};
makeWrapper = callPackage ./make-wrapper { };
makeBinaryWrapper = callPackage ./make-binary-wrapper {
makeBinaryWrapper = pkgs.makeBinaryWrapper.override {
sanitizers = pkgs.lib.optionals (! (pkgs.stdenv.isDarwin && pkgs.stdenv.isAarch64))
[ "undefined" "address" ];
};
};
pkgs-lib = recurseIntoAttrs (import ../pkgs-lib/tests { inherit pkgs; });
}

@ -783,30 +783,7 @@ with pkgs;
}
../build-support/setup-hooks/make-wrapper.sh;
makeBinaryWrapper = let
f = { cc, sanitizers }: let
san = lib.concatMapStringsSep " " (s: "-fsanitize=${s}") sanitizers;
script = runCommand "make-binary-wrapper.sh" {} ''
substitute ${../build-support/setup-hooks/make-binary-wrapper.sh} $out \
--replace " @CC@ " " ${cc}/bin/cc ${san} "
'';
in
makeSetupHook {
deps = [ dieHook cc ];
substitutions.passthru.tests = callPackage ../test/make-binary-wrapper {
makeBinaryWrapper = makeBinaryWrapper.override {
sanitizers = (if stdenv.isDarwin && stdenv.isAarch64
then [ ]
else [ "undefined" "address" ]
);
};
};
} script;
in
lib.makeOverridable f {
cc = stdenv.cc;
sanitizers = [ ];
};
makeBinaryWrapper = callPackage ../build-support/setup-hooks/make-binary-wrapper { };
makeModulesClosure = { kernel, firmware, rootModules, allowMissing ? false }:
callPackage ../build-support/kernel/modules-closure.nix {

Loading…
Cancel
Save