profiles: tell ccache to rewrite paths relative to $S

There are a number of ways the absolute path to a source file can make
it into the compiler output, some of which can prevent cached results
from being used when compiling related code in different locations.
The default source directory $S contains the package version so paths
need to be relative to it in order to work between package versions.
This commit is contained in:
Michael Marineau 2015-08-07 17:03:32 -07:00
parent d426251f88
commit e290b05988

View File

@ -99,3 +99,10 @@ SYSROOT_WRAPPERS_BIN="/usr/lib/sysroot-wrappers/bin"
if [[ "$PATH" != *"$SYSROOT_WRAPPERS_BIN"* ]]; then
export PATH="$SYSROOT_WRAPPERS_BIN:$PATH"
fi
# Improve the chance that ccache is valid across versions by making all
# paths under $S relative to $S, avoiding encoding the package version
# contained in the path into __FILE__ expansions and debug info.
if [[ -z "${CCACHE_BASEDIR}" ]] && [[ -d "${S}" ]]; then
export CCACHE_BASEDIR="${S}"
fi