build/qemu-wrap
author Imanol Fernandez <mortimergoro@gmail.com>
Fri, 09 Nov 2018 11:59:28 +0000
changeset 445419 4c759f171cefc121537bfdcc2213a04effc72057
parent 113444 1a53df18c076a7388496b9d78cceb855ce793735
permissions -rwxr-xr-x
Bug 1498246 - Add GeckoView Media API r=rbarker,snorp,esawin,jchen,cvan Add GeckoView Media API which provides a way to listen to HTMLMediaElement events in a GeckoSession and control the playback externally Differential Revision: https://phabricator.services.mozilla.com/D9026

#!/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