0

Based off my last question here

Buildroot is not applying patches to my package because of the given answer to my previous question... But I would think there would be a way to add in the logic to apply the patches anyways?

Here is the section of code that gets run by build root

# Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
# used.
$(BUILD_DIR)/%/.stamp_rsynced:
    @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
    @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
    $(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
    rsync -au --chmod=u=rwX,go=rX $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
    $(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
    #GV_PATCH : do not touch stamp_rsynced to force rsync

Now right below the rsync section is the piece of code I would like to run to apply patches to my local package, I have already defined the BR2_GLOBAL_PATCH_DIR in my buildroot config and included the directory of my patch package and the patch inside. This is the patch code I would like to run after the rsync.

# Patch
#
# The RAWNAME variable is the lowercased package name, which allows to
# find the package directory (typically package/<pkgname>) and the
# prefix of the patches
#
# For BR2_GLOBAL_PATCH_DIR, only generate if it is defined
$(BUILD_DIR)/%/.stamp_patched: NAMEVER = $(RAWNAME)-$($(PKG)_VERSION)
$(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS =  $(PKGDIR)
$(BUILD_DIR)/%/.stamp_patched: PATCH_BASE_DIRS += $(addsuffix /$(RAWNAME),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)))
$(BUILD_DIR)/%/.stamp_patched:
    @$(call step_start,patch)
    @$(call MESSAGE,"Patching")
    $(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
    $(foreach p,$($(PKG)_PATCH),$(APPLY_PATCHES) $(@D) $(DL_DIR) $(notdir $(p))$(sep))
    $(Q)( \
    for D in $(PATCH_BASE_DIRS); do \
      if test -d $${D}; then \
        if test -d $${D}/$($(PKG)_VERSION); then \
          $(APPLY_PATCHES) $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \
        else \
          $(APPLY_PATCHES) $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \
        fi; \
      fi; \
    done; \
    )
    $(foreach hook,$($(PKG)_POST_PATCH_HOOKS),$(call $(hook))$(sep))
    @$(call step_end,patch)
    $(Q)touch $@

# Check that all directories specified in BR2_GLOBAL_PATCH_DIR exist.
$(foreach dir,$(call qstrip,$(BR2_GLOBAL_PATCH_DIR)),\
    $(if $(wildcard $(dir)),,\
        $(error BR2_GLOBAL_PATCH_DIR contains nonexistent directory $(dir))))

Is this possible to do?

I tried adding @$(call step_start,patch) to the first section of code after the #GV_PATCH but it didn't work.

I'm no expert on make files but I figured there is a way to call the patch code? I just don't know how.

RAZ_Muh_Taz
  • 4,059
  • 1
  • 13
  • 26

1 Answers1

0

The answer is the same as given at the end of your previous question:

# Rsync the source directory if the <pkg>_OVERRIDE_SRCDIR feature is
# used.
$(BUILD_DIR)/%/.stamp_rsynced:
        @$(call MESSAGE,"Syncing from source dir $(SRCDIR)")
        @test -d $(SRCDIR) || (echo "ERROR: $(SRCDIR) does not exist" ; exit 1)
        $(foreach hook,$($(PKG)_PRE_RSYNC_HOOKS),$(call $(hook))$(sep))
        rsync -au --chmod=u=rwX,go=rX $(RSYNC_VCS_EXCLUSIONS) $(call qstrip,$(SRCDIR))/ $(@D)
        $(foreach hook,$($(PKG)_POST_RSYNC_HOOKS),$(call $(hook))$(sep))
        #GV_PATCH : do not touch stamp_rsynced to force rsync
        # Apply patches in global patch dir, but no others
        $(APPLY_PATCHES) $(@D) $(addsuffix /$(RAWNAME),$(call qstrip,$(BR2_GLOBAL_PATCH_DIR))) \*.patch

By the way, you don't need to remove the stamp file, just use make foo-rebuild - it will also re-sync the package.

Arnout
  • 2,927
  • 16
  • 24