From 033822974829d01a3501f52b3f5ae9ab5a58c6c0 Mon Sep 17 00:00:00 2001 From: Alexander Barton Date: Fri, 27 Mar 2015 16:07:28 +0100 Subject: [PATCH] Add "ccache" plugin: Initialize ccache(1) --- plugins/1_local/1_local.plugin.zsh | 5 +---- plugins/ccache/ccache.plugin.zsh | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 4 deletions(-) create mode 100644 plugins/ccache/ccache.plugin.zsh diff --git a/plugins/1_local/1_local.plugin.zsh b/plugins/1_local/1_local.plugin.zsh index 27a6c3a..537f294 100644 --- a/plugins/1_local/1_local.plugin.zsh +++ b/plugins/1_local/1_local.plugin.zsh @@ -1,5 +1,5 @@ # 1_local.plugin.zsh -# 2015-03-17, alex@barton.de +# 2015-03-27, alex@barton.de [ -d "/usr/local/home" -a ! -d "/usr/local/home/$LOGNAME" ] \ && mkdir "/usr/local/home/$LOGNAME" >/dev/null 2>&1 @@ -10,6 +10,3 @@ # Setup XDG cache directory export XDG_CACHE_HOME="$LOCAL_HOME/.cache" - -# Setup environment for ccache, if installed -type ccache >/dev/null && export CCACHE_DIR="$XDG_CACHE_HOME/ccache" diff --git a/plugins/ccache/ccache.plugin.zsh b/plugins/ccache/ccache.plugin.zsh new file mode 100644 index 0000000..d4d5850 --- /dev/null +++ b/plugins/ccache/ccache.plugin.zsh @@ -0,0 +1,21 @@ +# ccache.plugin.zsh +# 2015-03-27, alex@barton.de + +if type ccache >/dev/null; then + # Setup environment for ccache, if installed + export CCACHE_DIR="$XDG_CACHE_HOME/ccache" + + # Search for directory with wrapper commands and prepend it to "PATH" + for d in \ + /usr/local/opt/ccache/libexec \ + /usr/local/lib/ccache \ + /opt/ccache/libexec \ + /usr/libexec/ccache \ + /usr/lib/ccache \ + ; do + if [ -d "$d" ]; then + PATH="$d:$PATH" + break + fi + done +fi -- 2.39.2