fixup! [M120] Bring up autofill
[platform/framework/web/chromium-efl.git] / tizen_src / build / ccache_env.sh
1
2 SCRIPTDIR=$(cd $(dirname ${BASH_SOURCE[0]}); pwd -P)
3 source ${SCRIPTDIR}/common.sh
4
5 function usage() {
6   echo "Usage:"
7   echo "source build/ccache_env.sh desktop|mobile|tv"
8 }
9
10 if ! type ccache &> /dev/null; then
11   echo "WARNING: ccache option used but ccache is not installed"
12   return 0
13 fi
14
15 if [ "$1" == "tizen" -o  "$1" == "desktop" -o "$1" == "crosscompile" ]; then
16   OUTPUT_BASE_FOLDER=out.${1}.$(getHostArch)
17   export CCACHE_CPP2=yes
18   export CCACHE_SLOPPINESS=time_macros
19   export CCACHE_BASEDIR=${TOPDIR}
20
21   if [ "$USER" == "abuild" ]; then
22     #/.ccache directory in gbs sysroot is not removed by -C option
23     #unlike /var/tmp and /tmp directories
24     #so having /.ccache as out ccache dir will make possible to use
25     #ccache also with bot incremental and non-incremental builds
26     export PATH=/var/lib/build/ccache/bin:$PATH
27     export CCACHE_DIR=/.ccache/${OUTPUT_BASE_FOLDER}
28   fi
29
30   export CCACHE_COMPILERCHECK=content
31   CCACHESIZE=$(ccache -s | grep max | grep -oE "[0-9]+" | head -1)
32   if [ $CCACHESIZE == "1" ]; then
33      ccache -M 10
34   fi
35
36   if [ "$1" == "desktop" -o "$1" == "crosscompile" ]; then
37     ccacheInPath=$(echo $PATH | grep -c /usr/lib/ccache)
38     if [ "$ccacheInPath" == "0" ]; then
39       export PATH=/usr/lib/ccache:$PATH
40     fi
41   fi
42 else
43   echo "Warning! You need to pick correct profile when you include ccache_env.sh"
44   echo "ccache will not be configured"
45   usage
46 fi