Maintain a separate ccache directory for each target.
authorMark Wooding <mdw@distorted.org.uk>
Sat, 21 Sep 2019 19:08:07 +0000 (20:08 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sat, 21 Sep 2019 19:08:07 +0000 (20:08 +0100)
Otherwise they interfere with each other.  How did I not notice this
before?

Makefile
bin/buildwrap
etc/ccache.conf [new file with mode: 0644]

index 3a3d48a..07f2d3c 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -583,6 +583,17 @@ $(CHECK_SCHROOT_SCRIPTS): check-script/%:
 .PHONY: $(addprefix check-script/,$(SCHROOT_SCRIPTS))
 
 ###--------------------------------------------------------------------------
+### Ccache setup.
+
+CCACHE_CONFIGS          = $(foreach r,$(ALL_CHROOTS), \
+       /var/lib/sbuild/build/.ccache/$(LVPREFIX)$r/ccache.conf)
+all:: $(CCACHE_CONFIGS)
+$(CCACHE_CONFIGS): /var/lib/sbuild/build/.ccache/$(LVPREFIX)%/ccache.conf: \
+               etc/ccache.conf
+       $(V_AT)mkdir -p $(dir $@)
+       $(call v_tag,COPY)cp $< $@.new && mv $@.new $@
+
+###--------------------------------------------------------------------------
 ### `/usr/local/' structure.
 
 LOCAL_COMMON_DIRS       = share/ src/
index e367b1b..5b9068d 100755 (executable)
@@ -26,7 +26,7 @@
 
 ## Set up compiler caching.  This makes a big difference to build times.
 PATH=/usr/lib/ccache:$PATH; export PATH
-CCACHE_DIR=/build/.ccache; export CCACHE_DIR
+CCACHE_DIR=/build/.ccache/$SCHROOT_CHROOT_NAME; export CCACHE_DIR
 unset CCACHE_HARDLINK
 CCACHE_COMPRESS=t; export CCACHE_COMPRESS
 CCACHE_UMASK=002; export CCACHE_UMASK
diff --git a/etc/ccache.conf b/etc/ccache.conf
new file mode 100644 (file)
index 0000000..a76ac41
--- /dev/null
@@ -0,0 +1,3 @@
+### -*-conf-*-
+
+max_size = 256Mi