Revision b3a246da02a4114ec55d15793154cf38d7a39be7 authored by Jordan Lund on 19 February 2016, 22:53:34 UTC, committed by Jordan Lund on 19 February 2016, 22:53:34 UTC
MozReview-Commit-ID: 5otLdixBeX

--HG--
extra : source : e0a91fd6584f4d06a8fae84e5ae2c3a96c17fdb0
extra : intermediate-source : 941a62368cb7664124838d8797bc34138819db9c
1 parent 4d6a902
Raw File
qemu-wrap
#!/bin/bash
# this script creates a wrapper shell script for an executable.  The idea is the actual executable cannot be
# executed natively (it was cross compiled), but we want to run tests natively.  Running this script
# as part of the compilation process will move the non-native executable to a new location, and replace it
# with a script that will run it under qemu.
while [[ -n $1 ]]; do
    case $1 in
        --qemu) QEMU="$2"; shift 2;;
        --libdir) LIBDIR="$2"; shift 2;;
        --ld) LD="$2"; shift 2;;
        *) exe="$1"; shift;;
    esac
done
if [[ -z $LIBDIR ]]; then
    echo "You need to specify a directory for the cross libraries when you configure the shell"
    echo "You can do this with --with-cross-lib="
    exit 1
fi
LD=${LD:-$LIBDIR/ld-linux.so.3}
mv $exe $exe.target
# Just hardcode the path to the executable.  It'll be pretty obvious if it is doing the wrong thing.

echo $'#!/bin/bash\n' $QEMU -E LD_LIBRARY_PATH="${LIBDIR}" "$LD" "$(readlink -f "$exe.target")" '"$@"' >"$exe"
chmod +x $exe
back to top