From a2f1059a3aae714f3f4613e50e3b2391d30f544f Mon Sep 17 00:00:00 2001
From: Andre Anjos <andre.anjos@idiap.ch>
Date: Thu, 19 Jan 2017 09:11:05 +0100
Subject: [PATCH] If ccache is installed, cache compilations

---
 gitlab/before_build.sh | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gitlab/before_build.sh b/gitlab/before_build.sh
index 90206d1..840ffbe 100755
--- a/gitlab/before_build.sh
+++ b/gitlab/before_build.sh
@@ -15,7 +15,17 @@ if [ ! -d ${PREFIX} ]; then
   log_info "Creating virtualenv installation at ${PREFIX}..."
   run_cmd ${BOB_PREFIX_PATH}/bin/virtualenv --system-site-packages ${PREFIX}
 else
-  log_warn "Prefix directory ${PREFIX} exists, not re-installing..."
+  log_info "Prefix directory ${PREFIX} exists, not re-installing..."
+fi
+
+# Configures CCACHE
+use_ccache=`which ccache`
+if [ -z "${use_ccache}" ]; then
+  log_warn "Cannot find ccache, compiling from scratch..."
+else
+  log_info "ccache installed at ${use_ccache}, caching compilations..."
+  run_cmd ln -s ${use_cacche} ${PREFIX}/bin/gcc
+  run_cmd ln -s ${use_cacche} ${PREFIX}/bin/g++
 fi
 
 # Source the newly created virtualenv
-- 
GitLab