blob: ce49ce718907d5592352b373f89827d0d2e59f27 (
plain) (
blame)
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
|
#!/bin/sh
#
# Author: Emanuel Haupt <ehaupt@FreeBSD.org>
#
# $FreeBSD$
#
CCACHE_COMPILERS="%%CCACHE_COMPILERS%% ${EXTRA_COMPILERS}"
CCLINKDIR="%%CCLINKDIR%%"
PREFIX="%%PREFIX%%"
usage() {
cat << "EOUSAGE"
Usage: ccache-update-links [hv]
ccache-update-links maintains symlinks needed by ccache to work with additional
compilers.
-h, --help this help
-v verbose
EOUSAGE
}
case "$1"
in
-h|--help)
usage
;;
esac
# create compiler links
for comp in ${CCACHE_COMPILERS}
do
if command -v "${comp}" >/dev/null; then
if [ ! -L "${PREFIX}/${CCLINKDIR}/${comp}" ]; then
[ "$1" = "-v" ] && echo "create symlink for ${comp}"
ln -sf ${PREFIX}/bin/ccache ${PREFIX}/${CCLINKDIR}/${comp}
fi
if [ ! -L "${PREFIX}/${CCLINKDIR}/world/${comp}" ]; then
[ "$1" = "-v" ] && echo "create symlink for ${comp} (world)"
ln -sf ccache ${PREFIX}/${CCLINKDIR}/world/${comp}
fi
else
if [ -L "${PREFIX}/${CCLINKDIR}/${comp}" ]; then
[ "$1" = "-v" ] && echo "remove symlink for ${comp}"
rm -f ${PREFIX}/${CCLINKDIR}/${comp}
fi
if [ -L "${PREFIX}/${CCLINKDIR}/world/${comp}" ]; then
[ "$1" = "-v" ] && echo "remove symlink for ${comp} (world)"
rm -f ${PREFIX}/${CCLINKDIR}/world/${comp}
fi
fi
done
|