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 ...@@ -8,9 +8,7 @@ if [ "$1" = "-h" ] || [ "$1" = "--help" ] ; then
exit 0 exit 0
fi fi
if [ -z "$CCACHE_DISABLE" ] ; then try_enable_ccache "$@"
enable_ccache
fi
# get number of available processors # get number of available processors
[ -n "$NPROCS" ] || NPROCS=`/usr/bin/getconf _NPROCESSORS_ONLN` [ -n "$NPROCS" ] || NPROCS=`/usr/bin/getconf _NPROCESSORS_ONLN`
......
...@@ -79,10 +79,7 @@ prepare_rpmdir ...@@ -79,10 +79,7 @@ prepare_rpmdir
test -z "$LISTNAMES" && fatal "Please run with spec(s) name" test -z "$LISTNAMES" && fatal "Please run with spec(s) name"
test -n "$LISTRPMARGS" && echog "Run $RPMBUILD with options: '$LISTRPMARGS'" test -n "$LISTRPMARGS" && echog "Run $RPMBUILD with options: '$LISTRPMARGS'"
# enable ccache using try_enable_ccache
if [ -n "$CCACHE_ENABLE" ] ; then
enable_ccache
fi
# instead cbuild req # instead cbuild req
if [ -n "$BUILDREQ" ] ; then if [ -n "$BUILDREQ" ] ; then
......
...@@ -484,20 +484,35 @@ is_ssh_target() ...@@ -484,20 +484,35 @@ is_ssh_target()
rhas "$1" ":" 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 # handled in gcc-common
export GCC_USE_CCACHE=1 export GCC_USE_CCACHE=1
# step to gcc-common
export CC=gcc CXX=g++
#export CC="ccache gcc" if [ -n "$CXX$CC" ] ; then
#export CPP="ccache gcc -E" info "CXX=$CXX CC=$CC already exists, skip setting"
#export CXX="ccache g++" return
#export CXXCPP="ccache g++ -E" 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