Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 28 lines 705 B view raw
1{ stdenv 2, runCommand 3, makeBinaryWrapper 4, binutils 5, lib 6, expectedArch ? stdenv.hostPlatform.parsed.cpu.name 7}: 8 9 10runCommand "make-binary-wrapper-test-cross" { 11 nativeBuildInputs = [ 12 makeBinaryWrapper 13 binutils 14 ]; 15 # For x86_64-linux the machine field is 16 # Advanced Micro Devices X86-64 17 # and uses a dash instead of a underscore unlike x86_64-linux in hostPlatform.parsed.cpu.name 18 expectedArch = lib.replaceStrings ["_"] ["-"] expectedArch; 19} '' 20 touch prog 21 chmod +x prog 22 makeWrapper prog $out 23 read -r _ arch < <($READELF --file-header $out | grep Machine:) 24 if [[ ''${arch,,} != *"''${expectedArch,,}"* ]]; then 25 echo "expected $expectedArch, got $arch" 26 exit 1 27 fi 28''