3a4df29a92
GitOrigin-RevId: 3d7435c638baffaa826b85459df0fff47f12317d
23 lines
488 B
Nix
23 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
|
|
''
|