[Buildroot] [PATCH 1/2] meson: add entry for libgcrypt-config in cross file
Jörg Krause
joerg.krause at embedded.rocks
Thu May 23 22:51:43 UTC 2019
Hi all,
thank you all for your ideas. Please take a look at my proposal
below...
On Thu, 2019-05-02 at 14:17 +0200, Arnout Vandecappelle wrote:
>
> On 01/05/2019 21:04, Peter Seiderer wrote:
> > Hello Arnout,
> >
> > On Wed, 1 May 2019 13:13:03 +0200, Arnout Vandecappelle <arnout at mind.be> wrote:
> >
> > > On 30/04/2019 13:04, Jörg Krause wrote:
> > > > Hello Peter,
> > > >
> > > > On Tue, 2019-04-30 at 10:27 +0200, Peter Seiderer wrote:
> > > [snip]
> > > > > Would have expected the trick/non-trivial thing to add more than one
> > > > > binary entry (to get the newlines for the entries right)...
> > > >
> > > > That's indeed a difficult case to solve. I didn't managed to get
> > > > multpile binary entries added to the [binaries] field, e.g.
> > > >
> > > > PKG_TARGET_BINARIES = \
> > > > libgcrypt-config = '...' \
> > > > llvm-config = '...'
> > > >
> > > > .. will not work.
> > > >
> > > > I spent some time to find a magic rule which splits the Makefile
> > > > variable into a proper newline seperated string which can be used by
> > > > sed, but I failed.
> > > >
> > > > Maybe you have an idea?
> > >
> > > Instead of sed, use the PRINTF macro and append to the file:
> > >
> > > $Q$$(if $$($$(PKG)_TARGET_BINARIES),\
> > > $$(call PRINTF,$$($$(PKG)_TARGET_BINARIES)) \
> > > >> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
> >
> > Simple appending will not work, the extra binaries must be under the '[binaries]'
> > section (maybe reordering the sections in the cross-compilation.conf.in template
> > will work)
>
> It should work if the [binaries] part is at the end, right? And if binaries is
> empty, that's OK, no?
>
> Alternatively, the [binaries] part could be included in the _TARGET_BINARIES
> (which would then have to be renamed to _CROSS_COMPILATION_CONF). So for a
> package that needs libgcrypt-config, it would be
>
> define FOO_CROSS_COMPILATION_CONF
> [binaries]
> libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
> endef
>
> > , does the printf approach fix the newline problem for more than one
> > entry?
>
> It does, but you can't use _CROSS_COMPILATION_CONF = ..., you have to use
> define, because the actual newlines have to be in the variable itself. Actually,
> you can still use = assignment, but then you need to use $(sep), i.e.:
>
> FOO_CROSS_COMPILATION_CONF = [binaries]$(sep)libgcrypt-config =
> '$(STAGING_DIR)/usr/bin/libgcrypt-config'$(sep)
>
> (which is ugly so don't do that :-)
The package using the meson infrastructure defines:
define libfoo_MESON_CROSS_CONF_BINARIES
libgcrypt-config = '$(STAGING_DIR)/usr/bin/libgcrypt-config'
llvm-config = '$(STAGING_DIR)/usr/bin/llvm-config'
endef
pkg-meson.mk is using PRINTF to a temporary file and sed is using this
file as input for appending to the [binaries section]:
$Q$$(if $$($$(PKG)_MESON_CROSS_CONF_BINARIES), \
$$(call PRINTF,$$($$(PKG)_MESON_CROSS_CONF_BINARIES))) \
> $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
sed -i "s/^[ \t]*//" $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
sed -e "s%@TARGET_CROSS@%$$(TARGET_CROSS)%g" \
...
-e "/\[binaries\]/r $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp" \
package/meson/cross-compilation.conf.in \
> $$($$(PKG)_SRCDIR)/build/cross-compilation.conf
rm -f $$($$(PKG)_SRCDIR)/build/cross-binaries.tmp
Best regards
Jörg Krause
More information about the buildroot
mailing list