move xbmkpath to XBMK_CACHE/
When doing ./mk release, the build system would create symlinks inside xbmkpath/ relative to the current work tree, which will differ from what's in PATH. Since XBMK_CACHE is already set globally, from the main work tree and the release-build work tree, that means we can know reliably that PATH is always correct if we put xbmkpath/ inside XBMK_CACHE. Signed-off-by: Leah Rowe <leah@libreboot.org>master
parent
b0a2384032
commit
466ada423d
|
@ -87,20 +87,6 @@ fi
|
|||
id -u 1>/dev/null 2>/dev/null || $err "suid check failed (id -u)"
|
||||
[ "$(id -u)" != "0" ] || $err "this command as root is not permitted"
|
||||
|
||||
[ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || unset TMPDIR
|
||||
[ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR"
|
||||
|
||||
if [ -z "${TMPDIR+x}" ]; then
|
||||
[ -f "lock" ] && $err "$PWD/lock exists. Is a build running?"
|
||||
export TMPDIR="/tmp"
|
||||
export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
|
||||
touch lock || $err "cannot create 'lock' file"
|
||||
rm -Rf xbmkpath || $err "cannot remove xbmkpath"
|
||||
mkdir -p xbmkpath || $err "cannot create xbmkpath"
|
||||
export PATH="$PWD/xbmkpath:$PATH" || $err "Can't create xbmkpath"
|
||||
xbmk_parent="y"
|
||||
fi
|
||||
|
||||
# XBMK_CACHE is a directory, for caching downloads and git repositories
|
||||
[ -z "${XBMK_CACHE+x}" ] && export XBMK_CACHE="$PWD/cache"
|
||||
[ -z "$XBMK_CACHE" ] && export XBMK_CACHE="$PWD/cache"
|
||||
|
@ -109,6 +95,21 @@ fi
|
|||
[ -L "$XBMK_CACHE" ] && export XBMK_CACHE="$PWD/cache"
|
||||
[ -f "$XBMK_CACHE" ] && $err "cachedir '$XBMK_CACHE' exists but it's a file"
|
||||
|
||||
# unify all temporary files/directories in a single TMPDIR
|
||||
[ -z "${TMPDIR+x}" ] || [ "${TMPDIR%_*}" = "/tmp/xbmk" ] || unset TMPDIR
|
||||
[ -n "${TMPDIR+x}" ] && export TMPDIR="$TMPDIR"
|
||||
if [ -z "${TMPDIR+x}" ]; then
|
||||
[ -f "lock" ] && $err "$PWD/lock exists. Is a build running?"
|
||||
export TMPDIR="/tmp"
|
||||
export TMPDIR="$(mktemp -d -t xbmk_XXXXXXXX)"
|
||||
touch lock || $err "cannot create 'lock' file"
|
||||
rm -Rf "$XBMK_CACHE/xbmkpath" || $err "cannot remove xbmkpath"
|
||||
mkdir -p "$XBMK_CACHE/xbmkpath" || $err "cannot create xbmkpath"
|
||||
export PATH="$XBMK_CACHE/xbmkpath:$PATH" || \
|
||||
$err "Can't create xbmkpath"
|
||||
xbmk_parent="y"
|
||||
fi
|
||||
|
||||
# if "y": a coreboot target won't be built if target.cfg says release="n"
|
||||
# (this is used to exclude certain build targets from releases)
|
||||
[ -z "${XBMK_RELEASE+x}" ] && export XBMK_RELEASE="n"
|
||||
|
|
|
@ -216,7 +216,8 @@ check_cross_compiler()
|
|||
$err "!mkxgcc $project/$xtree '$xfix' '$xgccargs'"
|
||||
|
||||
# we only want to mess with hostcc to build xgcc
|
||||
rm -f xbmkpath/* || $err "Cannot clear xbmkpath/"; :
|
||||
rm -f "$XBMK_CACHE/xbmkpath/"* || \
|
||||
$err "Cannot clear xbmkpath/"; :
|
||||
done; return 0
|
||||
}
|
||||
|
||||
|
@ -253,8 +254,8 @@ check_gnu_path()
|
|||
[ "$gnatfull" = "$gccfull" ] || return 1
|
||||
|
||||
(
|
||||
rm -f xbmkpath/* || $err "Cannot clear xbmkpath/"
|
||||
x_ cd xbmkpath
|
||||
rm -f "$XBMK_CACHE/xbmkpath/"* || $err "Cannot clear xbmkpath/"
|
||||
cd "$XBMK_CACHE/xbmkpath" || $err "Can't cd to xbmkpath/"
|
||||
for _gnubin in "$_gnudir/$2"*"-$_gnuver"; do
|
||||
[ -e "$_gnubin" ] || continue; _gnuutil="${_gnubin##*/}"
|
||||
x_ ln -s "$_gnubin" "${_gnuutil%"-$_gnuver"}"
|
||||
|
|
Loading…
Reference in New Issue