gcc: apply patches stored in global patches directories
v3 cover gcc: apply patches stored in global patches directories
Hi,
this is my patch v3 that applies patches in $(BR2_GLOBAL_PATCH_DIR)/gcc.
Arnout, thanks for your help!
Regards,
Chunhui
v3: - add files to HOST_GCC_COMMON_CCACHE_HASH_FILES to make sure that
the ccache hash is updated appropriately.
- fix indent.
- include Arnout's patch that fix ccache hash.
v2: - move the $(GCC_VERSION) part of the suffix to the correct place.
Arnout Vandecappelle (Essensium/Mind) (1):
gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR
Chunhui He (1):
gcc: apply patches stored in global patches directories
package/gcc/gcc.mk | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-)
Signature · 1 line
2.1.4
PATCH v3 1/2 gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR
From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>
In commit f4682cf933, a hash of the patches applied to gcc was created to make sure that ccache can properly detect when the toolchain has changed. The patches applied to gcc consist of the buildroot patches in package/gcc, but also potentially patches in BR2_GLOBAL_PATCH_DIR. However, the path to the patches in BR2_GLOBAL_PATCH_DIR was corrected incorrectly, because it misses a /. So instead of:
$(BR2_GLOBAL_PATCH_DIR)/gcc-initial/*.patch
it would look for
$(BR2_GLOBAL_PATCH_DIR)gcc-initial/*.patch
In other words, if BR2_GLOBAL_PATCH_DIR doesn't end with /, the patches in BR2_GLOBAL_PATCH_DIR are not taken into account in the ccache hash.
To fix, add the missing /
--- package/gcc/gcc.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
package/gcc/gcc.mk +2 -2
@@ -238,8 +238,8 @@ HOST_GCC_COMMON_CCACHE_HASH_FILES += $(DL_DIR)/$(GCC_SOURCE) HOST_GCC_COMMON_CCACHE_HASH_FILES += \ $(sort $(wildcard \ package/gcc/$(GCC_VERSION)/*.patch \ - $(addsuffix $((PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ - $(addsuffix $((PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))))) + $(addsuffix /$((PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ + $(addsuffix /$((PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))))) ifeq ($(BR2_xtensa),y) HOST_GCC_COMMON_CCACHE_HASH_FILES += $(HOST_GCC_XTENSA_OVERLAY_TAR) endif
Signature · 1 line
2.1.4
Thomas Petazzoni
AppliedPATCH v3 1/2 gcc: fix ccache hash of patches in BR2_GLOBAL_PATCH_DIR
Hello,
Quoted 18 lines · Chunhui He
From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>
In commit
f4682cf933, a hash of the patches applied to gcc was created to make sure that ccache can properly detect when the toolchain has changed. The patches applied to gcc consist of the buildroot patches in package/gcc, but also potentially patches inBR2_GLOBAL_PATCH_DIR. However, the path to the patches inBR2_GLOBAL_PATCH_DIRwas corrected incorrectly, because it misses a /. So instead of:$(BR2_GLOBAL_PATCH_DIR)/gcc-initial/*.patch
it would look for
$(BR2_GLOBAL_PATCH_DIR)gcc-initial/*.patch
In other words, if
BR2_GLOBAL_PATCH_DIRdoesn't end with /, the patches inBR2_GLOBAL_PATCH_DIRare not taken into account in the ccache hash.
Quoted 7 lines
To fix, add the missing /
Cc He Chunhui <[email protected]>--- package/gcc/gcc.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
Applied to master, thanks.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com
PATCH v3 2/2 gcc: apply patches stored in global patches directories
In reply to Chunhui HeWhen building host gcc, patches stored in global patches directories are skipped.
This patch fixes the unexpected behavior.
--- package/gcc/gcc.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
package/gcc/gcc.mk +12 -3
@@ -42,9 +42,15 @@ endif endif define HOST_GCC_APPLY_PATCHES - if test -d package/gcc/$(GCC_VERSION); then \ - $(APPLY_PATCHES) $(@D) package/gcc/$(GCC_VERSION) \*.patch ; \ - fi; + for D in \ + package/gcc/$(GCC_VERSION) \ + $(addsuffix /gcc/$(GCC_VERSION),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ + $(addsuffix /gcc,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ + ; do \ + if test -d $${D}; then \ + $(APPLY_PATCHES) $(@D) $${D} \*.patch || exit 1; \ + fi; \ + done; $(HOST_GCC_APPLY_POWERPC_PATCH) endef
@@ -235,9 +241,12 @@ ifeq ($(BR2_CCACHE),y) HOST_GCC_COMMON_CCACHE_HASH_FILES += $(DL_DIR)/$(GCC_SOURCE) # Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned and # unversioned patches unconditionally +# Also catch patches in $(BR2_GLOBAL_PATCH_DIR)/gcc. HOST_GCC_COMMON_CCACHE_HASH_FILES += \ $(sort $(wildcard \ package/gcc/$(GCC_VERSION)/*.patch \ + $(addsuffix /gcc/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ + $(addsuffix /gcc/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ $(addsuffix /$((PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ $(addsuffix /$((PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))))) ifeq ($(BR2_xtensa),y)
Signature · 1 line
2.1.4
PATCH v3 2/2 gcc: apply patches stored in global patches directories
Quoted 5 lines · Chunhui He
When building host gcc, patches stored in global patches directories are skipped.
This patch fixes the unexpected behavior.Signed-off-by Chunhui He <[email protected]>
Regards,
Arnout
Quoted 41 lines
--- package/gcc/gcc.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)package/gcc/gcc.mk +12
-3@@ -42,9 +42,15 @@ endif endif define HOST_GCC_APPLY_PATCHES - if test -d package/gcc/$(GCC_VERSION); then \ - $(APPLY_PATCHES) $(@D) package/gcc/$(GCC_VERSION) \*.patch ; \ - fi; + for D in \ + package/gcc/$(GCC_VERSION) \ + $(addsuffix /gcc/$(GCC_VERSION),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ + $(addsuffix /gcc,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ + ; do \ + if test -d $${D}; then \ + $(APPLY_PATCHES) $(@D) $${D} \*.patch || exit 1; \ + fi; \ + done; $(HOST_GCC_APPLY_POWERPC_PATCH) endef@@ -235,9 +241,12 @@ ifeq ($(BR2_CCACHE),y) HOST_GCC_COMMON_CCACHE_HASH_FILES += $(DL_DIR)/$(GCC_SOURCE) # Cfr. PATCH_BASE_DIRS in .stamp_patched, but we catch both versioned and # unversioned patches unconditionally +# Also catch patches in $(BR2_GLOBAL_PATCH_DIR)/gcc. HOST_GCC_COMMON_CCACHE_HASH_FILES += \ $(sort $(wildcard \ package/gcc/$(GCC_VERSION)/*.patch \ + $(addsuffix /gcc/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ + $(addsuffix /gcc/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ $(addsuffix /$((PKG)_RAWNAME)/$(GCC_VERSION)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \ $(addsuffix /$((PKG)_RAWNAME)/*.patch,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))))) ifeq ($(BR2_xtensa),y)
Signature · 6 lines
Arnout Vandecappelle arnout dot vandecappelle at essensium dot com Senior Embedded Software Architect . . . . . . +32-478-010353 (mobile) Essensium, Mind division . . . . . . . . . . . . . . http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium . . . . . BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v3 2/2 gcc: apply patches stored in global patches directories
In reply to Chunhui HeHello,
Quoted 8 lines · Chunhui He
When building host gcc, patches stored in global patches directories are skipped.
This patch fixes the unexpected behavior.Signed-off-by Chunhui He <[email protected]>--- package/gcc/gcc.mk | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-)
We had some pretty lengthy discussion today with Peter and Yann about this patch, arguing about the various possibilities to solve this problem. In the end, even though your solution is a bit of a hack, it's the one that is the easiest in terms of on-going maintenance, so I applied your patch after doing some minor modifications:
[Thomas:
- rename the loop variable from 'D' to 'patchdir'
- add some additional comments
- remove final ; at end of loop when applying the patches, since it's not needed]
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com