scripts: do not include board binaries in $PATH

The wrapper for `foo-config` style scripts updated `$PATH` so it could
call the real script by name instead of full path. However this means
that calls to shell utilities like `sed` may use the board's version
instead of the build host's. This hasn't been a problem in the past
because the board and host happened to be compatible but this may not
always be true.

In other news, come on people, switch to pkg-config already.
This commit is contained in:
Michael Marineau 2015-01-01 09:39:07 -08:00
parent f64af7a67d
commit 38d89a50b1

View File

@ -40,11 +40,9 @@ if [[ -z ${CHOST} ]] || [[ -z ${SYSROOT} ]] ; then
exit 1
fi
PATH="${SYSROOT}/usr/bin:${PATH}"
# Some wrappers will dynamically figure out where they're being run from,
# and then output a full path -I/-L path based on that. So we trim any
# expanded sysroot paths that might be in the output already to avoid
# having it be -L${SYSROOT}${SYSROOT}/usr/lib.
set -o pipefail
exec ${cfg} "$@" | sed -r "s:(-[IL])(${SYSROOT})?:\1${SYSROOT}:g"
exec ${SYSROOT}/usr/bin/${cfg} "$@" | sed -r "s:(-[IL])(${SYSROOT})?:\1${SYSROOT}:g"