[Buildroot] [PATCH 2/4] infra/pkg-meson: allow packages to pass custom compiler/linker flags

Arnout Vandecappelle arnout at mind.be
Sun Jun 30 16:12:58 UTC 2019


 Hi Yann,

On 24/06/2019 22:25, Yann E. MORIN wrote:
[snip]
> +$(2)_MESON_SED_CFLAGS = $$(if $$(strip $$($(2)_CFLAGS)),`printf '"%s"$$(comma) ' $$($(2)_CFLAGS)`)
> +$(2)_MESON_SED_LDFLAGS = $$(if $$(strip $$($(2)_LDFLAGS)),`printf '"%s"$$(comma) ' $$($(2)_LDFLAGS)`)
> +$(2)_MESON_SED_CXXFLAGS = $$(if $$(strip $$($(2)_CXXFLAGS)),`printf '"%s"$$(comma) ' $$($(2)_CXXFLAGS)`)

 This is ridiculous - why not the much simpler make construct

	-e "s%@TARGET_CFLAGS@%$$(foreach flag,$$($(2)_CFLAGS),"$$(flag)"$(comma))%g" \

 Note that this would also fix the issue from patch 1. Obviously untested,
because that's just the kind of person I am :-). If it does need to be a little
bit complicated, then I'd still prefer it to be managed by a macro rather than
defining additional variables for each kind of flag. E.g. quoted-comma-list.

 Then again, this is the way it's already done in meson.mk, so why not. Maybe
something to fix in a follow-up patch.

 If you haven't sent a v2 that applies this technique by the next time I'm
applying stuff, I'll apply it as is.

 Regards,
 Arnout


> +
>  # Configure package for target
>  #
>  #
> @@ -67,9 +75,9 @@ define $(2)_CONFIGURE_CMDS
>  	    -e "s%@TARGET_ARCH@%$$(HOST_MESON_TARGET_CPU_FAMILY)%g" \
>  	    -e "s%@TARGET_CPU@%$$(GCC_TARGET_CPU)%g" \
>  	    -e "s%@TARGET_ENDIAN@%$$(call LOWERCASE,$$(BR2_ENDIAN))%g" \
> -	    -e "s%@TARGET_CFLAGS@%$$(HOST_MESON_SED_CFLAGS)%g" \
> -	    -e "s%@TARGET_LDFLAGS@%$$(HOST_MESON_SED_LDFLAGS)%g" \
> -	    -e "s%@TARGET_CXXFLAGS@%$$(HOST_MESON_SED_CXXFLAGS)%g" \
> +	    -e "s%@TARGET_CFLAGS@%$$($(2)_MESON_SED_CFLAGS)%g" \
> +	    -e "s%@TARGET_LDFLAGS@%$$($(2)_MESON_SED_LDFLAGS)%g" \
> +	    -e "s%@TARGET_CXXFLAGS@%$$($(2)_MESON_SED_CXXFLAGS)%g" \
>  	    -e "s%@HOST_DIR@%$$(HOST_DIR)%g" \
>  	    package/meson/cross-compilation.conf.in \
>  	    > $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
> 



More information about the buildroot mailing list