mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-26 08:53:21 +00:00
24 lines
488 B
Nix
24 lines
488 B
Nix
{ 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
|
|
''
|