Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Danomi Manchego <danomimanchego123@gmail.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v3 2/2] ccache: provide capability to do initial ccache setup
Date: Wed, 30 Apr 2014 22:05:07 -0400	[thread overview]
Message-ID: <1398909907-1847-2-git-send-email-danomimanchego123@gmail.com> (raw)
In-Reply-To: <1398909907-1847-1-git-send-email-danomimanchego123@gmail.com>

For example, if your project is known to require more space than the
default max cache size, then you might want to increase the cache size
to a suitable amount using the -M (--max-size) option.

The string you specify here is passed verbatim to ccache.  Refer to
ccache documentation for more details.

These initial settings are applied after ccache has been compiled.

Signed-off-by: Danomi Manchego <danomimanchego123@gmail.com>

---

Changes v2 -> v3:
* Change based on suggestions from Thomas De Schampheleire
  * Config.in: use 'if BR2_CCACHE' around ccache options instead of individual 'depends on BR2_CCACHE' conditions
  * Config.in: reword description of new otption
  * ccache.mk: correct typo in variable name
  * ccache.mk: adjust message text

Changes v1 -> v2:
* Refresh against latest
* Also, remove needless line-breaks in existing hooks
---
 Config.in                |   21 +++++++++++++++++++--
 package/ccache/ccache.mk |   18 ++++++++++++++----
 2 files changed, 33 insertions(+), 6 deletions(-)

diff --git a/Config.in b/Config.in
index 5823274..d4ea100 100644
--- a/Config.in
+++ b/Config.in
@@ -256,7 +256,7 @@ config BR2_CCACHE
 	help
 	  This option will enable the use of ccache, a compiler
 	  cache. It will cache the result of previous builds to speed
-	  up future builds. The cache is stored in
+	  up future builds. By default, the cache is stored in
 	  $HOME/.buildroot-ccache.
 
 	  Note that Buildroot does not try to invalidate the cache
@@ -266,13 +266,30 @@ config BR2_CCACHE
 	  ccache cache by removing the $HOME/.buildroot-ccache
 	  directory.
 
+if BR2_CCACHE
+
 config BR2_CCACHE_DIR
 	string "Compiler cache location"
-	depends on BR2_CCACHE
 	default "$(HOME)/.buildroot-ccache"
 	help
 	  Where ccache should store cached files.
 
+config BR2_CCACHE_INITIAL_SETUP
+	string "Compiler cache initial setup"
+	help
+	  Initial ccache settings to apply, such as --max-files or --max-size.
+
+	  For example, if your project is known to require more space than the
+	  default max cache size, then you might want to increase the cache size
+	  to a suitable amount using the -M (--max-size) option.
+
+	  The string you specify here is passed verbatim to ccache.  Refer to
+	  ccache documentation for more details.
+
+	  These initial settings are applied after ccache has been compiled.
+
+endif
+
 config BR2_DEPRECATED
 	bool "Show packages that are deprecated or obsolete"
 	help
diff --git a/package/ccache/ccache.mk b/package/ccache/ccache.mk
index df92c5e..f1ec162 100644
--- a/package/ccache/ccache.mk
+++ b/package/ccache/ccache.mk
@@ -38,15 +38,25 @@ define HOST_CCACHE_PATCH_CONFIGURATION
 	sed -i 's,"%s/.ccache","$(BR_CACHE_DIR)",' $(@D)/ccache.c
 endef
 
-HOST_CCACHE_POST_CONFIGURE_HOOKS += \
-	HOST_CCACHE_PATCH_CONFIGURATION
+HOST_CCACHE_POST_CONFIGURE_HOOKS += HOST_CCACHE_PATCH_CONFIGURATION
 
 define HOST_CCACHE_MAKE_CACHE_DIR
 	mkdir -p $(BR_CACHE_DIR)
 endef
 
-HOST_CCACHE_POST_INSTALL_HOOKS += \
-	HOST_CCACHE_MAKE_CACHE_DIR
+HOST_CCACHE_POST_INSTALL_HOOKS += HOST_CCACHE_MAKE_CACHE_DIR
+
+# Provide capability to do initial ccache setup (e.g. increase default size)
+BR_CCACHE_INITIAL_SETUP = $(call qstrip,$(BR2_CCACHE_INITIAL_SETUP))
+ifneq ($(BR_CCACHE_INITIAL_SETUP),)
+define HOST_CCACHE_DO_INITIAL_SETUP
+	@$(call MESSAGE,"Applying initial settings")
+	$(CCACHE) $(BR_CCACHE_INITIAL_SETUP)
+	$(CCACHE) -s
+endef
+
+HOST_CCACHE_POST_INSTALL_HOOKS += HOST_CCACHE_DO_INITIAL_SETUP
+endif
 
 $(eval $(host-autotools-package))
 
-- 
1.7.9.5

  reply	other threads:[~2014-05-01  2:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-01  2:05 [Buildroot] [PATCH v3 1/2] ccache: change default cache directory path to match config setting Danomi Manchego
2014-05-01  2:05 ` Danomi Manchego [this message]
2014-05-02  8:29   ` [Buildroot] [PATCH v3 2/2] ccache: provide capability to do initial ccache setup Thomas De Schampheleire
2014-06-14 18:01   ` Thomas Petazzoni
2014-05-01  5:52 ` [Buildroot] [PATCH v3 1/2] ccache: change default cache directory path to match config setting Thomas De Schampheleire
2014-05-01 13:40   ` Danomi Manchego
2014-05-01 14:01     ` Thomas De Schampheleire
2014-06-14 17:58 ` Thomas Petazzoni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1398909907-1847-2-git-send-email-danomimanchego123@gmail.com \
    --to=danomimanchego123@gmail.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox