Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH] ccache: make default host-ccache cache dir fit for multi-user setups
@ 2017-07-06 10:48 Peter Korsgaard
  2017-07-06 19:21 ` Thomas Petazzoni
                   ` (3 more replies)
  0 siblings, 4 replies; 11+ messages in thread
From: Peter Korsgaard @ 2017-07-06 10:48 UTC (permalink / raw)
  To: buildroot

While building I noticed:

>>> host-ccache 3.3.4 Building
conf.c: In function 'conf_create':
conf.c:314:2: warning: too many arguments for format [-Wformat-extra-args]
  conf->cache_dir = format("/home/peko/.buildroot-ccache", get_home_directory());
  ^

As host-ccache gets installed into $(HOST_DIR) and is part of the SDK,
hardcoding the build user homedir isn't really nice for the relocatable
SDK feature (or simply for a SDK used by multiple users).

As the warning shows, CCache replaces "%s" with the current user home
directory, so rewrite BR_CACHE_DIR to use this feature if it begins with
$HOME.

Signed-off-by: Peter Korsgaard <peter@korsgaard.com>
---
 package/ccache/ccache.mk | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/package/ccache/ccache.mk b/package/ccache/ccache.mk
index 97d66bb45b..afbec44fac 100644
--- a/package/ccache/ccache.mk
+++ b/package/ccache/ccache.mk
@@ -28,9 +28,13 @@ HOST_CCACHE_CONF_OPTS += --with-bundled-zlib
 #    BR2_CCACHE_DIR.
 #  - Change hard-coded last-ditch default to match path in .config, to avoid
 #    the need to specify BR_CACHE_DIR when invoking ccache directly.
+#    CCache replaces "%s" with the home directory of the current user,
+#    So rewrite BR_CACHE_DIR to take that into consideration for SDK purpose
+HOST_CCACHE_DEFAULT_CCACHE_DIR = $(patsubst $(HOME)/%,\%s/%,$(BR_CACHE_DIR))
+
 define HOST_CCACHE_PATCH_CONFIGURATION
 	sed -i 's,getenv("CCACHE_DIR"),getenv("BR_CACHE_DIR"),' $(@D)/ccache.c
-	sed -i 's,"%s/.ccache","$(BR_CACHE_DIR)",' $(@D)/conf.c
+	sed -i 's,"%s/.ccache","$(HOST_CCACHE_DEFAULT_CCACHE_DIR)",' $(@D)/conf.c
 endef
 
 HOST_CCACHE_POST_PATCH_HOOKS += HOST_CCACHE_PATCH_CONFIGURATION
-- 
2.11.0

^ permalink raw reply related	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2017-07-19 13:49 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-06 10:48 [Buildroot] [PATCH] ccache: make default host-ccache cache dir fit for multi-user setups Peter Korsgaard
2017-07-06 19:21 ` Thomas Petazzoni
2017-07-06 22:28   ` Peter Korsgaard
2017-07-07  7:28     ` Thomas Petazzoni
2017-07-07  9:48       ` Peter Korsgaard
2017-07-07 15:18         ` Arnout Vandecappelle
2017-07-07 15:26           ` Peter Korsgaard
2017-07-06 23:18 ` Arnout Vandecappelle
2017-07-07  6:50   ` Peter Korsgaard
2017-07-08 18:55 ` Peter Korsgaard
2017-07-19 13:49 ` Peter Korsgaard

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox