]>
Commit | Line | Data |
---|---|---|
8dfd59d1 | 1 | ################################################################################ |
17b66aff TP |
2 | # |
3 | # ccache | |
4 | # | |
8dfd59d1 | 5 | ################################################################################ |
17b66aff | 6 | |
b1b3f49e | 7 | CCACHE_VERSION = 3.1.11 |
f268f713 TDS |
8 | CCACHE_SITE = http://samba.org/ftp/ccache |
9 | CCACHE_SOURCE = ccache-$(CCACHE_VERSION).tar.xz | |
c5f8797b LC |
10 | CCACHE_LICENSE = GPLv3+, others |
11 | CCACHE_LICENSE_FILES = LICENSE.txt GPL-3.0.txt | |
17b66aff | 12 | |
7ea11daf TP |
13 | # Force ccache to use its internal zlib. The problem is that without |
14 | # this, ccache would link against the zlib of the build system, but we | |
15 | # might build and install a different version of zlib in $(O)/host | |
16 | # afterwards, which ccache will pick up. This might break if there is | |
17 | # a version mismatch. A solution would be to add host-zlib has a | |
18 | # dependency of ccache, but it would require tuning the zlib .mk file | |
19 | # to use HOSTCC_NOCCACHE as the compiler. Instead, we take the easy | |
20 | # path: tell ccache to use its internal copy of zlib, so that ccache | |
21 | # has zero dependency besides the C library. | |
aaffd209 | 22 | HOST_CCACHE_CONF_OPTS += ccache_cv_zlib_1_2_3=no |
7ea11daf | 23 | |
43329076 | 24 | # Patch host-ccache as follows: |
e7ab4b49 | 25 | # - Use BR_CACHE_DIR instead of CCACHE_DIR, because CCACHE_DIR |
43329076 | 26 | # is already used by autotargets for the ccache package. |
e7ab4b49 | 27 | # BR_CACHE_DIR is exported by Makefile based on config option |
43329076 TDS |
28 | # BR2_CCACHE_DIR. |
29 | # - ccache shouldn't use the compiler binary mtime to detect a change in | |
30 | # the compiler, because in the context of Buildroot, that completely | |
31 | # defeats the purpose of ccache. Of course, that leaves the user | |
32 | # responsible for purging its cache when the compiler changes. | |
d93a0b40 DM |
33 | # - Change hard-coded last-ditch default to match path in .config, to avoid |
34 | # the need to specify BR_CACHE_DIR when invoking ccache directly. | |
43329076 | 35 | define HOST_CCACHE_PATCH_CONFIGURATION |
e7ab4b49 | 36 | sed -i 's,getenv("CCACHE_DIR"),getenv("BR_CACHE_DIR"),' $(@D)/ccache.c |
f044e037 | 37 | sed -i 's,getenv("CCACHE_COMPILERCHECK"),"none",' $(@D)/ccache.c |
d93a0b40 | 38 | sed -i 's,"%s/.ccache","$(BR_CACHE_DIR)",' $(@D)/ccache.c |
17b66aff TP |
39 | endef |
40 | ||
dd79f2df | 41 | HOST_CCACHE_POST_CONFIGURE_HOOKS += HOST_CCACHE_PATCH_CONFIGURATION |
17b66aff | 42 | |
ffe3540e DM |
43 | define HOST_CCACHE_MAKE_CACHE_DIR |
44 | mkdir -p $(BR_CACHE_DIR) | |
45 | endef | |
46 | ||
dd79f2df DM |
47 | HOST_CCACHE_POST_INSTALL_HOOKS += HOST_CCACHE_MAKE_CACHE_DIR |
48 | ||
49 | # Provide capability to do initial ccache setup (e.g. increase default size) | |
50 | BR_CCACHE_INITIAL_SETUP = $(call qstrip,$(BR2_CCACHE_INITIAL_SETUP)) | |
51 | ifneq ($(BR_CCACHE_INITIAL_SETUP),) | |
52 | define HOST_CCACHE_DO_INITIAL_SETUP | |
53 | @$(call MESSAGE,"Applying initial settings") | |
54 | $(CCACHE) $(BR_CCACHE_INITIAL_SETUP) | |
55 | $(CCACHE) -s | |
56 | endef | |
57 | ||
58 | HOST_CCACHE_POST_INSTALL_HOOKS += HOST_CCACHE_DO_INITIAL_SETUP | |
59 | endif | |
ffe3540e | 60 | |
69e64c42 | 61 | $(eval $(host-autotools-package)) |
17b66aff TP |
62 | |
63 | ifeq ($(BR2_CCACHE),y) | |
64 | ccache-stats: host-ccache | |
65 | $(Q)$(CCACHE) -s | |
d1bca7c4 TJL |
66 | |
67 | ccache-options: host-ccache | |
68 | ifeq ($(CCACHE_OPTIONS),) | |
f3b44101 JG |
69 | $(Q)echo "Usage: make ccache-options CCACHE_OPTIONS=\"opts\"" |
70 | $(Q)echo "where 'opts' corresponds to one or more valid ccache options" \ | |
71 | "(see ccache help text below)" | |
72 | $(Q)echo | |
d1bca7c4 | 73 | endif |
f3b44101 | 74 | $(Q)$(CCACHE) $(CCACHE_OPTIONS) |
17b66aff | 75 | endif |