From e557699b996b906202ecdf2fa2e29f62a3cfd88a Mon Sep 17 00:00:00 2001
From: Mohammad Akhlaghi <mohammad@akhlaghi.org>
Date: Thu, 10 Jan 2019 12:26:51 +0000
Subject: ccache ignored and disabled

ccache is a super annoying program in the context of the reproduction
pipeline. On systems that use it, the `gcc' and `g++' that are found in
PATH are actually calls to `ccache' (so it can manage their call)!

Two steps have been taken to ignore and disable ccache (if it isn't ignored
properly!): 1) when making symbolic links to compilers, if a directory
containing `ccache' is present in the PATH, it is first removed, then we
look for the low-level programs that we won't be building. 2) The
`CCACHE_DISABLE' environment variable is set to 1 where necessary (with the
other environment variables).
---
 reproduce/src/make/dependencies-basic.mk | 15 +++++++++++++--
 reproduce/src/make/dependencies.mk       |  1 +
 reproduce/src/make/initialize.mk         |  3 ++-
 3 files changed, 16 insertions(+), 3 deletions(-)

(limited to 'reproduce')

diff --git a/reproduce/src/make/dependencies-basic.mk b/reproduce/src/make/dependencies-basic.mk
index 8625cf6..9ae52a0 100644
--- a/reproduce/src/make/dependencies-basic.mk
+++ b/reproduce/src/make/dependencies-basic.mk
@@ -56,6 +56,7 @@ syspath         := $(PATH)
 
 # As we build more programs, we want to use our own pipeline's built
 # programs and libraries, not the host's.
+export CCACHE_DISABLE    := 1
 export PATH              := $(ibdir):$(PATH)
 export PKG_CONFIG_PATH   := $(ildir)/pkgconfig
 export PKG_CONFIG_LIBDIR := $(ildir)/pkgconfig
@@ -187,8 +188,18 @@ $(tarballs): $(tdir)/%:
 # For the time being, we aren't building a local C compiler, but we'll use
 # any C compiler that the system already has and just make a symbolic link
 # to it.
-makelink = export PATH=$(syspath); a=$$(which $(1) 2> /dev/null); \
-	   if [ -f $(ibdir)/$(1) ]; then rm $(ibdir)/$(1); fi;    \
+#
+# ccache: ccache acts like a wrapper over the C compiler and is made to
+# avoid/speed-up compiling of identical files in a system (it is commonly
+# used on large servers). It actually makes `gcc' or `g++' a symbolic link
+# to itself so it can control them internally. So, for our purpose here, it
+# is very annoying and can cause many complications. We thus remove any
+# part of PATH of that has `ccache' in it before making symbolic links to
+# the programs we are not building ourselves.
+makelink = export PATH=$$(echo $(syspath)| tr : '\n' |grep -v ccache  \
+	                       | paste -s -d:);                       \
+	   a=$$(which $(1) 2> /dev/null);                             \
+	   if [ -f $(ibdir)/$(1) ]; then rm $(ibdir)/$(1); fi;        \
 	   if [ x$$a != x ]; then ln -s $$a $(ibdir)/$(1); fi
 $(ibdir) $(ildir):; mkdir $@
 $(ibdir)/low-level-links: | $(ibdir) $(ildir)
diff --git a/reproduce/src/make/dependencies.mk b/reproduce/src/make/dependencies.mk
index f79918e..806d605 100644
--- a/reproduce/src/make/dependencies.mk
+++ b/reproduce/src/make/dependencies.mk
@@ -63,6 +63,7 @@ all: $(ddir)/texlive-versions.tex \
 #       user's environment.
 .ONESHELL:
 .SHELLFLAGS              := --noprofile --norc -ec
+export CCACHE_DISABLE    := 1
 export PATH              := $(ibdir)
 export LD_RUN_PATH       := $(ildir)
 export LD_LIBRARY_PATH   := $(ildir)
diff --git a/reproduce/src/make/initialize.mk b/reproduce/src/make/initialize.mk
index 32a65b2..a6ad00b 100644
--- a/reproduce/src/make/initialize.mk
+++ b/reproduce/src/make/initialize.mk
@@ -73,7 +73,8 @@ curdir   := $(shell echo $$(pwd))
 # environment variables, we are setting it to prefer the software we have
 # build here.
 .ONESHELL:
-.SHELLFLAGS            = -ec
+.SHELLFLAGS             = -ec
+export CCACHE_DISABLE  := 1
 export PATH            := $(installdir)/bin
 export LD_LIBRARY_PATH := $(installdir)/lib
 export LDFLAGS         := -L$(installdir)/lib
-- 
cgit v1.2.1