author Sebastian Hengst <>
Mon, 31 Oct 2016 19:59:07 +0100
changeset 320276 1aa20bcbb80e1014e4d01057f7d52269b0c2d908
parent 113451 1a53df18c076a7388496b9d78cceb855ce793735
permissions -rwxr-xr-x
Merge m-c to fx-team. r=merge a=merge

# 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;;
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
mv $exe $
# 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"
chmod +x $exe