makeBinaryWrapper: move into its own folder
The derivation is complex enough to warrant moving out of all-packages.nix
This commit is contained in:
parent
3a79190750
commit
0d6bcb513b
5 changed files with 30 additions and 27 deletions
|
@ -869,7 +869,7 @@ makeWrapper $out/bin/foo $wrapperfile --set FOOBAR baz
|
||||||
makeWrapper $out/bin/foo $wrapperfile --prefix PATH : ${lib.makeBinPath [ hello git ]}
|
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`.
|
`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")"
|
mkdir -p "$(dirname "$wrapper")"
|
||||||
|
|
||||||
makeDocumentedCWrapper "$original" "$@" | \
|
makeDocumentedCWrapper "$original" "$@" | \
|
||||||
@CC@ \
|
@cc@ \
|
||||||
-Wall -Werror -Wpedantic \
|
-Wall -Werror -Wpedantic \
|
||||||
-Wno-overlength-strings \
|
-Wno-overlength-strings \
|
||||||
-Os \
|
-Os \
|
|
@ -71,7 +71,13 @@ with pkgs;
|
||||||
|
|
||||||
dhall = callPackage ./dhall { };
|
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; });
|
pkgs-lib = recurseIntoAttrs (import ../pkgs-lib/tests { inherit pkgs; });
|
||||||
}
|
}
|
||||||
|
|
|
@ -783,30 +783,7 @@ with pkgs;
|
||||||
}
|
}
|
||||||
../build-support/setup-hooks/make-wrapper.sh;
|
../build-support/setup-hooks/make-wrapper.sh;
|
||||||
|
|
||||||
makeBinaryWrapper = let
|
makeBinaryWrapper = callPackage ../build-support/setup-hooks/make-binary-wrapper { };
|
||||||
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 = [ ];
|
|
||||||
};
|
|
||||||
|
|
||||||
makeModulesClosure = { kernel, firmware, rootModules, allowMissing ? false }:
|
makeModulesClosure = { kernel, firmware, rootModules, allowMissing ? false }:
|
||||||
callPackage ../build-support/kernel/modules-closure.nix {
|
callPackage ../build-support/kernel/modules-closure.nix {
|
||||||
|
|
Loading…
Reference in a new issue