mirror of
https://git.freebsd.org/ports.git
synced 2025-05-04 23:47:37 -04:00
ccache is a compiler cache. It acts as a caching pre-processor to C/C++ compilers, using the -E compiler switch and a hash to detect when a compilation can be satisfied from cache. This often results in a 5 to 10 times speedup in common compilations. PR: 234971 Approved by: bdrewery Author: Oleg Sidorkin <osidorkin@gmail.com>
72 lines
1.6 KiB
Bash
72 lines
1.6 KiB
Bash
#!/bin/sh
|
|
#
|
|
# Author: Emanuel Haupt <ehaupt@FreeBSD.org>
|
|
#
|
|
# $FreeBSD: head/devel/ccache/files/ccache-update-links.sh.in 435560 2017-03-06 17:50:14Z bdrewery $
|
|
#
|
|
|
|
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
|
|
|
|
strip_path() {
|
|
local IFS=":"
|
|
local path
|
|
set -- ${PATH}
|
|
while [ $# -gt 0 ]; do
|
|
if ! [ "${1}" = "${PREFIX}/libexec/ccache" ]; then
|
|
path="${path}${path:+:}${1}"
|
|
fi
|
|
shift
|
|
done
|
|
echo "${path}"
|
|
}
|
|
|
|
# Remove ccache wrappers from PATH
|
|
PATH=$(strip_path)
|
|
|
|
# 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
|