blob: 35f9614db73b74eea9c3491ceba199bc4f5b219f (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
#!/bin/bash
#
# distcc-config - helper script for distcc and distccd
#
# Copyright 2003 Superlucidity Services, LLC
# This program licensed under the GNU GPL version 2.
#
# This script developed by Zachary T Welch at Superlucidity Services, LLC
# based on ideas from irc discussion and the clear need for this support
#
# Additional features to come; this provides a starting point
# this should be getopt'd someday
DCCC_VERBOSE=1
dccc_echo() {
[ -n "${DCCC_VERBOSE}" ] && echo "$*"
}
###
# the following functions manage the distcc symlinks
# they allow the user or other scripts (namely gcc-config) to
# automatically update distcc's links when upgrading toolchains
#
dccc_remove_link() {
local t="/usr/lib/distcc/bin/${1}"
if [ -L ${t} ]; then
dccc_echo "Removing ${t}..."
rm -f "${t}"
fi
}
dccc_install_link() {
# Search the PATH for the specified compiler
# then create shadow link in /usr/lib/distcc/bin to distcc
if [ -n "$(type -p ${1})" ]; then
# first be sure any old link is removed
DCCC_VERBOSE="" dccc_remove_link "${1}"
# then create the new link
local t="/usr/lib/distcc/bin/${1}"
dccc_echo "Creating distcc shadow link: ${t}..."
ln -s /usr/bin/distcc "${t}"
fi
}
dccc_links() {
local a
for a in gcc cc c++ g++ ; do
[ -n "${2}" ] && a="${2}-${a}"
eval "dccc_${1}_link" "${a}"
done
}
###
# main routine
case "${1}" in
--install-links )
dccc_links install "${2}"
;;
--remove-links )
dccc_links remove "${2}"
;;
* )
echo "usage: ${0} {--install-links|--remove-links} [ CHOST ]"
;;
esac
|