70 lines
1.7 KiB
Plaintext
70 lines
1.7 KiB
Plaintext
|
#!/bin/sh
|
||
|
#
|
||
|
# icecream-config - helper script for icecream and its ebuild
|
||
|
#
|
||
|
# Copyright 2003-2010 Superlucidity Services, LLC
|
||
|
# This program licensed under the GNU GPL version 2.
|
||
|
#
|
||
|
# This script developed by Zachary T Welch at Superlucidity Services, LLC
|
||
|
# it was cloned from the distcc-config script to make ccache-config
|
||
|
# and then modified by Marcus Furlong to configure icecream too.
|
||
|
#
|
||
|
# Additional features to come; this provides a starting point
|
||
|
|
||
|
# this should be getopt'd someday (override with ICEC_QUIET=1)
|
||
|
ICECC_VERBOSE=1
|
||
|
|
||
|
icecc_echo() {
|
||
|
[ -z "${ICECC_QUIET}" -a -n "${ICECC_VERBOSE}" ] && echo "$*"
|
||
|
}
|
||
|
|
||
|
###
|
||
|
# the following functions manage the icecream symlinks
|
||
|
# they allow the user or other scripts (namely gcc-config) to
|
||
|
# automatically update icecream's links when upgrading toolchains
|
||
|
#
|
||
|
icecc_remove_link() {
|
||
|
local t="/usr/lib/icecc/bin/${1}"
|
||
|
if [ -L ${t} ]; then
|
||
|
icecc_echo "Removing ${t}..."
|
||
|
rm -f "${t}"
|
||
|
fi
|
||
|
}
|
||
|
icecc_install_link() {
|
||
|
# Search the PATH for the specified compiler
|
||
|
# then create shadow link in /usr/lib/icecc/bin to icecc
|
||
|
|
||
|
if [ -n "$(type -p ${1})" ]; then
|
||
|
# first be sure any old link is removed
|
||
|
ICECC_QUIET=1 icecc_remove_link "${1}"
|
||
|
|
||
|
# then create the new link
|
||
|
local t="/usr/lib/icecc/bin/${1}"
|
||
|
icecc_echo "Creating icecream shadow link: ${t}..."
|
||
|
ln -s /usr/bin/icecc "${t}"
|
||
|
fi
|
||
|
}
|
||
|
icecc_links() {
|
||
|
local a
|
||
|
for a in gcc cc c++ g++ ; do
|
||
|
[ -n "${2}" ] && a="${2}-${a}"
|
||
|
eval "icecc_${1}_link" "${a}"
|
||
|
done
|
||
|
}
|
||
|
|
||
|
###
|
||
|
# main routine
|
||
|
|
||
|
case "${1}" in
|
||
|
--install-links )
|
||
|
icecc_links install "${2}"
|
||
|
;;
|
||
|
--remove-links )
|
||
|
icecc_links remove "${2}"
|
||
|
;;
|
||
|
* )
|
||
|
echo "usage: ${0} {--install-links|--remove-links} [ CHOST ]"
|
||
|
;;
|
||
|
esac
|
||
|
|