3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/test/make-binary-wrapper/cross.nix

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

24 lines
488 B
Nix
Raw Normal View History

{ stdenv
, runCommand
, makeBinaryWrapper
, binutils
, expectedArch ? stdenv.hostPlatform.parsed.cpu.name
}:
runCommand "make-binary-wrapper-test-cross" {
nativeBuildInputs = [
makeBinaryWrapper
binutils
];
inherit expectedArch;
} ''
touch prog
chmod +x prog
makeWrapper prog $out
read -r _ arch < <($READELF --file-header $out | grep Machine:)
if [[ ''${arch,,} != *"''${expectedArch,,}"* ]]; then
echo "expected $expectedArch, got $arch"
exit 1
fi
''