diff options
Diffstat (limited to 'ccache.sh.in')
-rw-r--r-- | ccache.sh.in | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ccache.sh.in b/ccache.sh.in new file mode 100644 index 0000000..0ce4d64 --- /dev/null +++ b/ccache.sh.in @@ -0,0 +1,27 @@ +# Use ccache by default. Users who don't want that can set the CCACHE_DISABLE +# environment variable in their personal profile. + +case ":${PATH:-}:" in + *:@LIBDIR@/ccache:*) ;; + *) PATH="@LIBDIR@/ccache${PATH:+:$PATH}" ;; +esac + +# If @CACHEDIR@ is writable, use a shared cache there, except for root. +# Users who don't want that even if they have the write permission can set +# the CCACHE_DIR environment variable to another location and possibly unset +# the CCACHE_UMASK environment variables in their personal profile. + +if [ -n "${CCACHE_DIR:-}" ] ; then + if [ ! -w "$CCACHE_DIR" ] ; then + # Reset broken settings maybe inherited when switching users (#651023). + unset CCACHE_DIR + unset CCACHE_UMASK + fi +elif [ "${EUID:-}" != 0 ] ; then + if [ -w @CACHEDIR@ ] && [ -d @CACHEDIR@ ] ; then + # Set up the shared cache. + export CCACHE_DIR=@CACHEDIR@ + export CCACHE_UMASK=002 + unset CCACHE_HARDLINK + fi +fi |