Commit 0ff41e72 authored by Vitaly Lipatov's avatar Vitaly Lipatov

make ccache optional

parent f7d2bcfc
......@@ -8,9 +8,7 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
exit 0
fi
if [ -z "$CCACHE_DISABLE" ] ; then
enable_ccache
fi
try_enable_ccache "$@"
# get number of available processors
[ -n "$NPROCS" ] || NPROCS=`/usr/bin/getconf _NPROCESSORS_ONLN`
......
......@@ -79,10 +79,7 @@ prepare_rpmdir
test -z "$LISTNAMES" && fatal "Please run with spec(s) name"
test -n "$LISTRPMARGS" && echog "Run $RPMBUILD with options: '$LISTRPMARGS'"
# enable ccache using
if [ -n "$CCACHE_ENABLE" ] ; then
enable_ccache
fi
try_enable_ccache
# instead cbuild req
if [ -n "$BUILDREQ" ] ; then
......
......@@ -484,20 +484,35 @@ is_ssh_target()
rhas "$1" ":"
}
enable_ccache()
try_enable_ccache()
{
which ccache >/dev/null || fatal "Install ccache package before using"
if [ -n "$CCACHE_DISABLE" ] ; then
info "ccache disabled by CCACHE_DISABLE var"
return
fi
if ! which ccache >/dev/null ; then
info "No ccache (from ccache package)"
return
fi
# TODO: add support for clang
# TODO: check for work with scan-build (clang-analizer)
# handled in gcc-common
export GCC_USE_CCACHE=1
# step to gcc-common
export CC=gcc CXX=g++
#export CC="ccache gcc"
#export CPP="ccache gcc -E"
#export CXX="ccache g++"
#export CXXCPP="ccache g++ -E"
if [ -n "$CXX$CC" ] ; then
info "CXX=$CXX CC=$CC already exists, skip setting"
return
fi
if rhas "$*" "C[CX].?=" ; then
info "ran with CXX= or CC= in args '$*', skip setting"
return
fi
# step to gcc-common
export CC=gcc CXX=g++
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment