[Buildroot] [PATCH v2 2/3] apply-patches.sh: Use the "APPLY_PATCHES" variable to call the script

Yann E. MORIN yann.morin.1998 at free.fr
Fri Jul 25 17:40:43 UTC 2014


Fabio, All,

On 2014-07-25 18:38 +0200, Fabio Porcedda spake thusly:
> To easy up adding optional parameters when calling the
> "apply-patches.sh" add and use the "APPLY_PATCHES" variable to execute
> the script.
[--SNIP--]
> diff --git a/package/pkg-autotools.mk b/package/pkg-autotools.mk
> index bcc648d..0daf012 100644
> --- a/package/pkg-autotools.mk
> +++ b/package/pkg-autotools.mk
> @@ -196,11 +196,11 @@ define LIBTOOL_PATCH_HOOK
>  			ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' $$$$i | \
>  			sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
>  			if test $$$${ltmain_version} = '1.5'; then \
> -				support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
> +				$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \

Variables in hooks should be double-escaped:
    $$(APPLY_PATCHES)

See: http://git.buildroot.org/buildroot/tree/package/pkg-generic.mk#n277
(for pkg-generic, but valid for all pkg-* infras.)

Ditto for the five following occurences, of course.

>  			elif test $$$${ltmain_version} = "2.2"; then\
> -				support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
> +				$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
>  			elif test $$$${ltmain_version} = "2.4"; then\
> -				support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
> +				$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
>  			fi \
>  		done \
>  	fi
> @@ -230,11 +230,11 @@ define AUTORECONF_HOOK
>  			ltmain_version=`sed -n '/^[ 	]*VERSION=/{s/^[ 	]*VERSION=//;p;q;}' $$$$i | \
>  			sed -e 's/\([0-9].[0-9]*\).*/\1/' -e 's/\"//'`; \
>  			if test $$$${ltmain_version} = "1.5"; then \
> -				support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
> +				$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v1.5.patch; \
>  			elif test $$$${ltmain_version} = "2.2"; then\
> -				support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
> +				$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.2.patch; \
>  			elif test $$$${ltmain_version} = "2.4"; then\
> -				support/scripts/apply-patches.sh $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
> +				$(APPLY_PATCHES) $$$${i%/*} support/libtool buildroot-libtool-v2.4.patch; \
>  			fi \
>  		done \
>  	fi
> diff --git a/package/pkg-generic.mk b/package/pkg-generic.mk
> index fb4b849..95a95b7 100644
> --- a/package/pkg-generic.mk
> +++ b/package/pkg-generic.mk
> @@ -146,14 +146,14 @@ $(BUILD_DIR)/%/.stamp_patched:

Note: the fololowing is not in a define-block, so needs no
double-escaping, so it is good as is:

>  	@$(call step_start,patch)
>  	@$(call MESSAGE,"Patching")
>  	$(foreach hook,$($(PKG)_PRE_PATCH_HOOKS),$(call $(hook))$(sep))
> -	$(foreach p,$($(PKG)_PATCH),support/scripts/apply-patches.sh $(@D) $(DL_DIR) $(notdir $(p))$(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 \
> -	      support/scripts/apply-patches.sh $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \
> +	      $(APPLY_PATCHES) $(@D) $${D}/$($(PKG)_VERSION) \*.patch \*.patch.$(ARCH) || exit 1; \
>  	    else \
> -	      support/scripts/apply-patches.sh $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \
> +	      $(APPLY_PATCHES) $(@D) $${D} \*.patch \*.patch.$(ARCH) || exit 1; \
>  	    fi; \
>  	  fi; \
>  	done; \

Otherwise, looks good. Thanks! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'



More information about the buildroot mailing list