]> arthur.barton.de Git - OhMyZshExtensions.git/commitdiff
Add "ccache" plugin: Initialize ccache(1)
authorAlexander Barton <alex@barton.de>
Fri, 27 Mar 2015 15:07:28 +0000 (16:07 +0100)
committerAlexander Barton <alex@barton.de>
Fri, 27 Mar 2015 15:07:28 +0000 (16:07 +0100)
plugins/1_local/1_local.plugin.zsh
plugins/ccache/ccache.plugin.zsh [new file with mode: 0644]

index 27a6c3ab5e4ea8381d33ee92c4441e6bcc935ba3..537f294eadf3b362f163b8a3048bf7a79bb6781c 100644 (file)
@@ -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 (file)
index 0000000..d4d5850
--- /dev/null
@@ -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