sccache: use variables for the binary & path

This commit is contained in:
Sylvestre Ledru 2023-01-15 18:49:24 +01:00
parent b9d2b57c3b
commit 06f31916f1

18
debian/rules vendored
View File

@ -445,9 +445,11 @@ SCCACHE_ENABLE=no
SCCACHE_CMAKE = SCCACHE_CMAKE =
# if sccache is installed in the chroot, use it # if sccache is installed in the chroot, use it
ifeq ($(shell test -e /opt/sccache/sccache && echo -n yes),yes) ifeq ($(shell test -e /opt/sccache/sccache && echo -n yes),yes)
SCCACHE_CMAKE = -DCMAKE_C_COMPILER_LAUNCHER=/opt/sccache/sccache -DCMAKE_CXX_COMPILER_LAUNCHER=/opt/sccache/sccache
STAGE_1_CMAKE_EXTRA += $(SCCACHE_CMAKE) STAGE_1_CMAKE_EXTRA += $(SCCACHE_CMAKE)
SCCACHE_ENABLE=yes SCCACHE_ENABLE=yes
SCCACHE_PATH=/opt/sccache/
SCCACHE_CMD=$(SCCACHE_PATH)/sccache
SCCACHE_CMAKE = -DCMAKE_C_COMPILER_LAUNCHER=$(SCCACHE_CMD) -DCMAKE_CXX_COMPILER_LAUNCHER=$(SCCACHE_CMD)
export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:/opt/sccache export LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:/opt/sccache
endif endif
@ -542,8 +544,8 @@ override_dh_ocamlclean:
override_dh_ocaml: override_dh_ocaml:
override_dh_auto_configure: preconfigure override_dh_auto_configure: preconfigure
if test -f /opt/sccache/sccache; then \ if test -f $(SCCACHE_CMD); then \
ls -al /opt/sccache/*; \ ls -al $(SCCACHE_PATH)*; \
fi fi
echo "Using gcc: " echo "Using gcc: "
$(CC) -v $(CC) -v
@ -583,9 +585,9 @@ override_dh_auto_configure: preconfigure
#- https://bit.ly/3kDNpC9 #- https://bit.ly/3kDNpC9
ifeq (${SCCACHE_ENABLE},yes) ifeq (${SCCACHE_ENABLE},yes)
# Just in case... # Just in case...
/opt/sccache/sccache --stop-server||true $(SCCACHE_CMD) --stop-server||true
# Start the sccache server with the right set of options to use GCP # Start the sccache server with the right set of options to use GCP
SCCACHE_LOG=sccache=debug SCCACHE_ERROR_LOG=/opt/sccache/sccache.log SCCACHE_GCS_KEY_PATH=/opt/sccache/secret-gcp-storage.json SCCACHE_GCS_BUCKET=apt-llvm-org-sccache SCCACHE_GCS_RW_MODE=READ_WRITE /opt/sccache/sccache --start-server SCCACHE_LOG=sccache=debug SCCACHE_ERROR_LOG=$(SCCACHE_PATH)/sccache.log SCCACHE_GCS_KEY_PATH=$(SCCACHE_PATH)/secret-gcp-storage.json SCCACHE_GCS_BUCKET=apt-llvm-org-sccache SCCACHE_GCS_RW_MODE=READ_WRITE $(SCCACHE_CMD) --start-server
endif endif
echo "Running tests: $(RUN_TEST)" echo "Running tests: $(RUN_TEST)"
echo "Using cmake: $(CMAKE_BIN)"; \ echo "Using cmake: $(CMAKE_BIN)"; \
@ -858,10 +860,10 @@ debian-wasm-build: \
sccache-stats: sccache-stats:
# If we used sccache, shows stats # If we used sccache, shows stats
if test -f /opt/sccache/sccache; then \ if test -f $(SCCACHE_CMD); then \
ls -al /opt/sccache/; \ ls -al $(SCCACHE_PATH)/; \
mkdir -p /tmp/buildd/source/; \ mkdir -p /tmp/buildd/source/; \
/opt/sccache/sccache --stats-format json --show-stats > /tmp/buildd/source/sccache-stats.json; \ $(SCCACHE_CMD) --stats-format json --show-stats > /tmp/buildd/source/sccache-stats.json; \
cat /tmp/buildd/source/sccache-stats.json; \ cat /tmp/buildd/source/sccache-stats.json; \
fi fi
touch $@ touch $@