build/qemu-wrap

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/build/qemu-wrap	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,24 @@
     1.4 +#!/bin/bash
     1.5 +# this script creates a wrapper shell script for an executable.  The idea is the actual executable cannot be
     1.6 +# executed natively (it was cross compiled), but we want to run tests natively.  Running this script
     1.7 +# as part of the compilation process will move the non-native executable to a new location, and replace it
     1.8 +# with a script that will run it under qemu.
     1.9 +while [[ -n $1 ]]; do
    1.10 +    case $1 in
    1.11 +        --qemu) QEMU="$2"; shift 2;;
    1.12 +        --libdir) LIBDIR="$2"; shift 2;;
    1.13 +        --ld) LD="$2"; shift 2;;
    1.14 +        *) exe="$1"; shift;;
    1.15 +    esac
    1.16 +done
    1.17 +if [[ -z $LIBDIR ]]; then
    1.18 +    echo "You need to specify a directory for the cross libraries when you configure the shell"
    1.19 +    echo "You can do this with --with-cross-lib="
    1.20 +    exit 1
    1.21 +fi
    1.22 +LD=${LD:-$LIBDIR/ld-linux.so.3}
    1.23 +mv $exe $exe.target
    1.24 +# Just hardcode the path to the executable.  It'll be pretty obvious if it is doing the wrong thing.
    1.25 +
    1.26 +echo $'#!/bin/bash\n' $QEMU -E LD_LIBRARY_PATH="${LIBDIR}" "$LD" "$(readlink -f "$exe.target")" '"$@"' >"$exe"
    1.27 +chmod +x $exe
    1.28 \ No newline at end of file

mercurial