Added colorgcc plugin.

This commit is contained in:
Alexis Lahouze 2013-10-01 11:33:49 +02:00
parent a7c7d36e48
commit 3380f641d1

View File

@ -0,0 +1,51 @@
#!/bin/zsh
# This file is part of xals' zsh utils.
#
# xals' zsh utils is free software: you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation, either version 3 of the
# License, or (at your option) any later version.
#
# xals' zsh utils is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with xals' zsh utils. If not, see
# <http://www.gnu.org/licenses/>.
function _colorgcc_plugin_gen_colorgccrc() {
local _colorgcc_plugin_colorgccrc
zstyle -s :xals:plugins:colorgcc colorgccrc _colorgcc_plugin_colorgccrc
cat > ${_colorgcc_plugin_colorgccrc:="${HOME}/.colorgccrc"} << EOF
g++: ${_colorgcc_plugin_gcc_path}/g++
gcc: ${_colorgcc_plugin_gcc_path}/gcc
c++: ${_colorgcc_plugin_gcc_path}/g++
cc: ${_colorgcc_plugin_gcc_path}/gcc
g77: /usr/bin/g77
f77: /usr/bin/g77
gcj: /usr/bin/gcj
EOF
}
if [ -x "/usr/lib/colorgcc/bin" ]; then
local -x _colorgcc_plugin_gcc_path
if [ -x "/usr/lib/ccache/bin" ]; then
# Keep compatibility with ccache
export CCACHE_PATH="/usr/bin"
_colorgcc_plugin_gcc_path="/usr/lib/ccache/bin"
else
# Prepend colorgcc path
export PATH="/usr/lib/colorgcc/bin:$PATH"
_colorgcc_plugin_gcc_path="/usr/bin"
fi
_colorgcc_plugin_gen_colorgccrc
fi