All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/1] package/pkg-meson: h files only into sysroot
@ 2024-11-19 20:59 Vincent Jardin
  2024-11-21 13:49 ` Brandon Maier
  0 siblings, 1 reply; 33+ messages in thread
From: Vincent Jardin @ 2024-11-19 20:59 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Vincent Jardin

Many packages built with Buildroot and meson currently install header
files into both:
  - the target’s /usr/include, and
  - the sysroot’s /usr/include.

Ensure that header files are installed exclusively in the staging
(sysroot) target during the build process.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Robin Jarry <robin@jarry.cc>
---
 package/pkg-meson.mk | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index bc805b799c..d7b8d456b8 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -220,7 +220,7 @@ endif
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
 	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build
 endef
 endif
 
@@ -231,7 +231,7 @@ endif
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build --tags=runtime,devel
 endef
 endif
 
@@ -242,7 +242,7 @@ endif
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build --tags=runtime
 endef
 endif
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/pkg-meson: h files only into sysroot
  2024-11-19 20:59 [Buildroot] [PATCH 1/1] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2024-11-21 13:49 ` Brandon Maier
  2024-11-22  0:20   ` Vincent Jardin
  0 siblings, 1 reply; 33+ messages in thread
From: Brandon Maier @ 2024-11-21 13:49 UTC (permalink / raw)
  To: Vincent Jardin; +Cc: buildroot, Eric Le Bihan, Robin Jarry

Hi Vincent,

On Tue, Nov 19, 2024 at 3:00 PM Vincent Jardin <vjardin@free.fr> wrote:
>
> Many packages built with Buildroot and meson currently install header
> files into both:
>   - the target’s /usr/include, and
>   - the sysroot’s /usr/include.
>
> Ensure that header files are installed exclusively in the staging
> (sysroot) target during the build process.
>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> Suggested-by: Robin Jarry <robin@jarry.cc>
> ---
>  package/pkg-meson.mk | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index bc805b799c..d7b8d456b8 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -220,7 +220,7 @@ endif
>  ifndef $(2)_INSTALL_CMDS
>  define $(2)_INSTALL_CMDS
>         $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
> -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +               $$(MESON) install -C $$($$(PKG)_SRCDIR)/build
>  endef
>  endif
>
> @@ -231,7 +231,7 @@ endif
>  ifndef $(2)_INSTALL_STAGING_CMDS
>  define $(2)_INSTALL_STAGING_CMDS
>         $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
> -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +               $$(MESON) install -C $$($$(PKG)_SRCDIR)/build --tags=runtime,devel

When the `--tags` argument is used, Meson will not install files that
are untagged.
This could cause things like Meson `custom_target()` files to stop
being installed.

See last paragraph of: https://mesonbuild.com/Installing.html#installation-tags

We should be careful that this doesn't cause any existing Meson
packages to break.
We may want a way for a package to install without tags, or to install
with other tags.
Perhaps a new variable like $(PKG)_MESON_INSTALL_STAGING_TAGS.

Thanks!
Brandon

>  endef
>  endif
>
> @@ -242,7 +242,7 @@ endif
>  ifndef $(2)_INSTALL_TARGET_CMDS
>  define $(2)_INSTALL_TARGET_CMDS
>         $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
> -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +               $$(MESON) install -C $$($$(PKG)_SRCDIR)/build --tags=runtime
>  endef
>  endif
>
> --
> 2.34.1
>
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/pkg-meson: h files only into sysroot
  2024-11-21 13:49 ` Brandon Maier
@ 2024-11-22  0:20   ` Vincent Jardin
  2024-11-26 14:17     ` Brandon Maier
  0 siblings, 1 reply; 33+ messages in thread
From: Vincent Jardin @ 2024-11-22  0:20 UTC (permalink / raw)
  To: Brandon Maier; +Cc: Robin Jarry, buildroot

Hi Brandon,

On Thu, Nov 21, 2024 at 07:49:15AM UTC, Brandon Maier wrote:
> >  define $(2)_INSTALL_STAGING_CMDS
> >         $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
> > -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> > +               $$(MESON) install -C $$($$(PKG)_SRCDIR)/build --tags=runtime,devel
> 
> Perhaps a new variable like $(PKG)_MESON_INSTALL_STAGING_TAGS.

I guess I get your point, just to confirm and then I'll submit an
update: do you suggess,

  - if there is a $(PKG)_INSTALL_STAGING = YES 
      and
    a $(PKG)_MESON_INSTALL_STAGING_TAGS = YES
      then, we should use the meson's tags ?

or

  - if there is a $(PKG)_MESON_INSTALL_STAGING_TAGS = YES
    whatever the $(PKG)_INSTALL_STAGING = YES/NO/not set 
      then, we should use the meson's tags ?

I am just concerned about two conflicting interpertations. Are there any
other cases from Buildroot that could inspire to apply the same logic ?

best regards,
  Vincent
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/pkg-meson: h files only into sysroot
  2024-11-22  0:20   ` Vincent Jardin
@ 2024-11-26 14:17     ` Brandon Maier
  2024-11-26 18:10       ` Vincent Jardin
  0 siblings, 1 reply; 33+ messages in thread
From: Brandon Maier @ 2024-11-26 14:17 UTC (permalink / raw)
  To: Vincent Jardin; +Cc: Robin Jarry, buildroot

Hi Vincent

On Thu, Nov 21, 2024 at 6:20 PM Vincent Jardin <vjardin@free.fr> wrote:
>
> Hi Brandon,
>
> On Thu, Nov 21, 2024 at 07:49:15AM UTC, Brandon Maier wrote:
> > >  define $(2)_INSTALL_STAGING_CMDS
> > >         $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
> > > -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> > > +               $$(MESON) install -C $$($$(PKG)_SRCDIR)/build --tags=runtime,devel
> >
> > Perhaps a new variable like $(PKG)_MESON_INSTALL_STAGING_TAGS.
>
> I guess I get your point, just to confirm and then I'll submit an
> update: do you suggess,
>
>   - if there is a $(PKG)_INSTALL_STAGING = YES
>       and
>     a $(PKG)_MESON_INSTALL_STAGING_TAGS = YES
>       then, we should use the meson's tags ?

This one, my naming was a bit off though. It would make more sense to
drop the "STAGING" from the name, i.e. `$(PKG)_MESON_INSTALL_TAGS`. So
that it can apply to both STAGING and TARGET.

Then you end up with something like

  $(2)_MESON_INSTALL_TAGS ?= YES
  ...
  define $(2)_INSTALL_STAGING_CMDS
         $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
                 $$(MESON) install -C \
                  $$($$(PKG)_SRCDIR)/build $(if $(filter
YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime,devel)
  endef

And a similar change for INSTALL_TARGET_CMDS

>
> or
>
>   - if there is a $(PKG)_MESON_INSTALL_STAGING_TAGS = YES
>     whatever the $(PKG)_INSTALL_STAGING = YES/NO/not set
>       then, we should use the meson's tags ?
>
> I am just concerned about two conflicting interpertations. Are there any
> other cases from Buildroot that could inspire to apply the same logic ?

I based my snippet above on package/pkg-kconfig.mk "_KCONFIG_SUPPORTS_DEFCONFIG"

Sorry for the delayed reply Vincent, thank you for looking into this!

- Brandon

>
> best regards,
>   Vincent
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/pkg-meson: h files only into sysroot
  2024-11-26 14:17     ` Brandon Maier
@ 2024-11-26 18:10       ` Vincent Jardin
  2024-11-26 19:57         ` Brandon Maier
  0 siblings, 1 reply; 33+ messages in thread
From: Vincent Jardin @ 2024-11-26 18:10 UTC (permalink / raw)
  To: Brandon Maier; +Cc: Robin Jarry, buildroot


[-- Attachment #1.1: Type: text/plain, Size: 2253 bytes --]

Hi Brandon,

Le 26 novembre 2024 15:17:44 Brandon Maier <brandon.maier@gmail.com> a écrit :

> Hi Vincent
>
> On Thu, Nov 21, 2024 at 6:20 PM Vincent Jardin <vjardin@free.fr> wrote:
>>
>> Hi Brandon,
>>
>> On Thu, Nov 21, 2024 at 07:49:15AM UTC, Brandon Maier wrote:
>>>> define $(2)_INSTALL_STAGING_CMDS
>>>>    $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
>>>> -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
>>>> +               $$(MESON) install -C $$($$(PKG)_SRCDIR)/build 
>>>> --tags=runtime,devel
>>>
>>> Perhaps a new variable like $(PKG)_MESON_INSTALL_STAGING_TAGS.
>>
>> I guess I get your point, just to confirm and then I'll submit an
>> update: do you suggess,
>>
>> - if there is a $(PKG)_INSTALL_STAGING = YES
>> and
>> a $(PKG)_MESON_INSTALL_STAGING_TAGS = YES
>> then, we should use the meson's tags ?
>
> This one, my naming was a bit off though. It would make more sense to
> drop the "STAGING" from the name, i.e. `$(PKG)_MESON_INSTALL_TAGS`. So
> that it can apply to both STAGING and TARGET.
>
> Then you end up with something like
>
>  $(2)_MESON_INSTALL_TAGS ?= YES
>  ...
>  define $(2)_INSTALL_STAGING_CMDS
>         $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
>                 $$(MESON) install -C \
>                  $$($$(PKG)_SRCDIR)/build $(if $(filter
> YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime,devel)
>  endef
>
> And a similar change for INSTALL_TARGET_CMDS
>
>>
>> or
>>
>> - if there is a $(PKG)_MESON_INSTALL_STAGING_TAGS = YES
>> whatever the $(PKG)_INSTALL_STAGING = YES/NO/not set
>> then, we should use the meson's tags ?
>>
>> I am just concerned about two conflicting interpertations. Are there any
>> other cases from Buildroot that could inspire to apply the same logic ?
>
> I based my snippet above on package/pkg-kconfig.mk 
> "_KCONFIG_SUPPORTS_DEFCONFIG"
>
> Sorry for the delayed reply Vincent, thank you for looking into this!

OK I'll submit an update.

Regarding the documentation, should the update of 
https://buildroot.org/downloads/manual/adding-packages-meson.txt be part of 
a same commit or should it be another change set ?

Best regards,
   Vincent

>
>
> - Brandon
>
>>
>> best regards,
>> Vincent


[-- Attachment #1.2: Type: text/html, Size: 5451 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH 1/1] package/pkg-meson: h files only into sysroot
  2024-11-26 18:10       ` Vincent Jardin
@ 2024-11-26 19:57         ` Brandon Maier
  2024-11-27  1:29           ` [Buildroot] [PATCH v2 0/2] meson install with optional tags Vincent Jardin
  0 siblings, 1 reply; 33+ messages in thread
From: Brandon Maier @ 2024-11-26 19:57 UTC (permalink / raw)
  To: Vincent Jardin; +Cc: Robin Jarry, buildroot

On Tue, Nov 26, 2024 at 12:10 PM Vincent Jardin <vjardin@free.fr> wrote:
...
>
> Regarding the documentation, should the update of https://buildroot.org/downloads/manual/adding-packages-meson.txt be part of a same commit or should it be another change set ?

I believe the preferred way is to do your changes to pkg-meson.mk in
the first commit. Then have a second commit that updates the
documentation. Sending those both in the same patch series.

>
> Best regards,
>    Vincent
>
>>
>> - Brandon
>>
>>>
>>> best regards,
>>> Vincent
>
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v2 0/2] meson install with optional tags
  2024-11-26 19:57         ` Brandon Maier
@ 2024-11-27  1:29           ` Vincent Jardin
  2024-11-27  1:30             ` [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
  2024-11-27  1:30             ` [Buildroot] [PATCH v2 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  0 siblings, 2 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-11-27  1:29 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

v2:
  - generic argument for both target and staging installation
  - update the documentation

v1:
  - use meson instead of ninja in order to support tags
  - add a install tags argument

Vincent Jardin (2):
  package/pkg-meson: h files only into sysroot
  doc/manual/adding-packages-meson.adoc: tags

 docs/manual/adding-packages-meson.adoc |  5 +++++
 package/pkg-meson.mk                   | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot
  2024-11-27  1:29           ` [Buildroot] [PATCH v2 0/2] meson install with optional tags Vincent Jardin
@ 2024-11-27  1:30             ` Vincent Jardin
  2024-11-29 23:42               ` Brandon Maier
  2024-11-27  1:30             ` [Buildroot] [PATCH v2 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  1 sibling, 1 reply; 33+ messages in thread
From: Vincent Jardin @ 2024-11-27  1:30 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Many packages built with Buildroot and meson currently install header
files into both:
  - the target’s /usr/include, and
  - the sysroot’s /usr/include.

When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
installed exclusively in the staging (sysroot) target during the
build process.

The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
changing to this new behaviour for the time being.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Robin Jarry <robin@jarry.cc>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 package/pkg-meson.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index bc805b799c..aa2ad5389a 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -220,10 +220,13 @@ endif
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
 	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build
 endef
 endif
 
+# Default values for Staging installation and Target installation
+$(2)_MESON_INSTALL_TAGS ?= NO
+
 #
 # Staging installation step. Only define it if not already defined by
 # the package .mk file.
@@ -231,7 +234,8 @@ endif
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime,devel)
 endef
 endif
 
@@ -242,7 +246,8 @@ endif
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime)
 endef
 endif
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v2 2/2] doc/manual/adding-packages-meson.adoc: tags
  2024-11-27  1:29           ` [Buildroot] [PATCH v2 0/2] meson install with optional tags Vincent Jardin
  2024-11-27  1:30             ` [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2024-11-27  1:30             ` Vincent Jardin
  1 sibling, 0 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-11-27  1:30 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
the footprint of the target since only the runtime will be installed.
All the other development header files or libraries will be installed
into the staging folder.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 docs/manual/adding-packages-meson.adoc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/docs/manual/adding-packages-meson.adoc b/docs/manual/adding-packages-meson.adoc
index 01891e03cc..b7c987ddd1 100644
--- a/docs/manual/adding-packages-meson.adoc
+++ b/docs/manual/adding-packages-meson.adoc
@@ -124,6 +124,11 @@ will therefore only use a few of them.
   +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
   +pkg_config_libdir+.
 
+* +FOO_MESON_INSTALL_TAGS+, can be set to +YES+ to enable meson's `--runtime` and
+  `--devel` installation modes for the target and staging folders, respectively.
+  This configuration is necessary to prevent meson from installing development
+  artifacts into the target folder.
+
 * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
   +ninja+, meson companion tool in charge of the build operations. By default,
   empty.
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot
  2024-11-27  1:30             ` [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2024-11-29 23:42               ` Brandon Maier
  2024-12-02 15:39                 ` Vincent Jardin
  0 siblings, 1 reply; 33+ messages in thread
From: Brandon Maier @ 2024-11-29 23:42 UTC (permalink / raw)
  To: Vincent Jardin, buildroot; +Cc: Eric Le Bihan, Robin Jarry

Hi Vincent,

On Tue Nov 26, 2024 at 7:30 PM CST, Vincent Jardin wrote:
> Many packages built with Buildroot and meson currently install header
> files into both:
>   - the target’s /usr/include, and
>   - the sysroot’s /usr/include.
>
> When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
> installed exclusively in the staging (sysroot) target during the
> build process.
>
> The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
> changing to this new behaviour for the time being.

This setting has diminished value if it is default off. Have you done a
side-by-side build to see how many packages this breaks?

>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> Suggested-by: Robin Jarry <robin@jarry.cc>
> Suggested-by: Brandon Maier <brandon.maier@gmail.com>
> ---
>  package/pkg-meson.mk | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index bc805b799c..aa2ad5389a 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -220,10 +220,13 @@ endif
>  ifndef $(2)_INSTALL_CMDS
>  define $(2)_INSTALL_CMDS
>  	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
> -		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build
>  endef
>  endif
>
> +# Default values for Staging installation and Target installation
> +$(2)_MESON_INSTALL_TAGS ?= NO
> +
>  #
>  # Staging installation step. Only define it if not already defined by
>  # the package .mk file.
> @@ -231,7 +234,8 @@ endif
>  ifndef $(2)_INSTALL_STAGING_CMDS
>  define $(2)_INSTALL_STAGING_CMDS
>  	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
> -		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +		$$(MESON) install -C \
> +		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime,devel)

The comma in "--tag=runetime,devel" is treated as the Makefile separator
for "$(if x, y, z)". Use "--tag=runtime$(comma)devel" instead which
substitutes a literal comma.

The single "$" need to be "$$" so they are properly escaped. (Except
"$(comma)")

Thanks,
Brandon

>  endef
>  endif
>
> @@ -242,7 +246,8 @@ endif
>  ifndef $(2)_INSTALL_TARGET_CMDS
>  define $(2)_INSTALL_TARGET_CMDS
>  	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
> -		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +		$$(MESON) install -C \
> +		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime)
>  endef
>  endif
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot
  2024-11-29 23:42               ` Brandon Maier
@ 2024-12-02 15:39                 ` Vincent Jardin
  2024-12-02 15:46                   ` [Buildroot] [PATCH v3 0/2] meson install with optional tags Vincent Jardin
                                     ` (2 more replies)
  0 siblings, 3 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-02 15:39 UTC (permalink / raw)
  To: Brandon Maier; +Cc: buildroot, Eric Le Bihan, Robin Jarry

Hi Brandon,

On Fri, Nov 29, 2024 at 05:42:59PM UTC, Brandon Maier wrote:
> Hi Vincent,
> 
> On Tue Nov 26, 2024 at 7:30 PM CST, Vincent Jardin wrote:
> > Many packages built with Buildroot and meson currently install header
> > files into both:
> >   - the target’s /usr/include, and
> >   - the sysroot’s /usr/include.
> >
> > When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
> > installed exclusively in the staging (sysroot) target during the
> > build process.
> >
> > The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
> > changing to this new behaviour for the time being.
> 
> This setting has diminished value if it is default off. Have you done a
> side-by-side build to see how many packages this breaks?

No, I did not: my assumption was to start easy without breaking/changing
any behaviour. Then, we can start turning it to "YES" by default later
on.

So, for the time being, the meson based packages that are known to be
"ok" can start using the tags. I plan to do so for grout, libecoli and DPDK.

Side question: how do you handle a side-by-side build with Buildroot ?

> > +		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime,devel)
> 
> The comma in "--tag=runetime,devel" is treated as the Makefile separator
> for "$(if x, y, z)". Use "--tag=runtime$(comma)devel" instead which
> substitutes a literal comma.

OK, thanks for catching it !, it'll be included with my next update.
I did not analyze why I did not catch it...

> 
> The single "$" need to be "$$" so they are properly escaped. (Except
> "$(comma)")

OK

Thanks Brandon, best regards,
  Vincent
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v3 0/2] meson install with optional tags
  2024-12-02 15:39                 ` Vincent Jardin
@ 2024-12-02 15:46                   ` Vincent Jardin
  2024-12-02 15:46                     ` [Buildroot] [PATCH v3 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
  2024-12-02 15:46                     ` [Buildroot] [PATCH v3 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  2024-12-03 14:00                   ` [Buildroot] [PATCH v4 0/2] meson install with optional tags Vincent Jardin
  2024-12-06 13:47                   ` [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot Brandon Maier
  2 siblings, 2 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-02 15:46 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

v3:
  - do not use , but $(comma), see support/misc/utils.mk

v2:
  - generic argument for both target and staging installation
  - update the documentation

v1:
  - use meson instead of ninja in order to support tags
  - add a install tags argument

Vincent Jardin (2):
  package/pkg-meson: h files only into sysroot
  doc/manual/adding-packages-meson.adoc: tags

 docs/manual/adding-packages-meson.adoc |  5 +++++
 package/pkg-meson.mk                   | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v3 1/2] package/pkg-meson: h files only into sysroot
  2024-12-02 15:46                   ` [Buildroot] [PATCH v3 0/2] meson install with optional tags Vincent Jardin
@ 2024-12-02 15:46                     ` Vincent Jardin
  2024-12-02 15:46                     ` [Buildroot] [PATCH v3 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  1 sibling, 0 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-02 15:46 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Many packages built with Buildroot and meson currently install header
files into both:
  - the target’s /usr/include, and
  - the sysroot’s /usr/include.

When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
installed exclusively in the staging (sysroot) target during the
build process.

The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
changing to this new behaviour for the time being.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Robin Jarry <robin@jarry.cc>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 package/pkg-meson.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index bc805b799c..6fdd52ceb1 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -220,10 +220,13 @@ endif
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
 	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build
 endef
 endif
 
+# Default values for Staging installation and Target installation
+$(2)_MESON_INSTALL_TAGS ?= NO
+
 #
 # Staging installation step. Only define it if not already defined by
 # the package .mk file.
@@ -231,7 +234,8 @@ endif
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)
 endef
 endif
 
@@ -242,7 +246,8 @@ endif
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime)
 endef
 endif
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v3 2/2] doc/manual/adding-packages-meson.adoc: tags
  2024-12-02 15:46                   ` [Buildroot] [PATCH v3 0/2] meson install with optional tags Vincent Jardin
  2024-12-02 15:46                     ` [Buildroot] [PATCH v3 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2024-12-02 15:46                     ` Vincent Jardin
  1 sibling, 0 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-02 15:46 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
the footprint of the target since only the runtime will be installed.
All the other development header files or libraries will be installed
into the staging folder.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 docs/manual/adding-packages-meson.adoc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/docs/manual/adding-packages-meson.adoc b/docs/manual/adding-packages-meson.adoc
index 01891e03cc..b7c987ddd1 100644
--- a/docs/manual/adding-packages-meson.adoc
+++ b/docs/manual/adding-packages-meson.adoc
@@ -124,6 +124,11 @@ will therefore only use a few of them.
   +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
   +pkg_config_libdir+.
 
+* +FOO_MESON_INSTALL_TAGS+, can be set to +YES+ to enable meson's `--runtime` and
+  `--devel` installation modes for the target and staging folders, respectively.
+  This configuration is necessary to prevent meson from installing development
+  artifacts into the target folder.
+
 * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
   +ninja+, meson companion tool in charge of the build operations. By default,
   empty.
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v4 0/2] meson install with optional tags
  2024-12-02 15:39                 ` Vincent Jardin
  2024-12-02 15:46                   ` [Buildroot] [PATCH v3 0/2] meson install with optional tags Vincent Jardin
@ 2024-12-03 14:00                   ` Vincent Jardin
  2024-12-03 14:00                     ` [Buildroot] [PATCH v4 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
  2024-12-03 14:00                     ` [Buildroot] [PATCH v4 " Vincent Jardin
  2024-12-06 13:47                   ` [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot Brandon Maier
  2 siblings, 2 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-03 14:00 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

v4:
  - fix $ eval, former v3 was mis-tested

v3:
  - do not use , but $(comma), see support/misc/utils.mk

v2:
  - generic argument for both target and staging installation
  - update the documentation

v1:
  - use meson instead of ninja in order to support tags
  - add a install tags argument

Vincent Jardin (2):
  package/pkg-meson: h files only into sysroot
  doc/manual/adding-packages-meson.adoc: tags

 docs/manual/adding-packages-meson.adoc |  5 +++++
 package/pkg-meson.mk                   | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v4 1/2] package/pkg-meson: h files only into sysroot
  2024-12-03 14:00                   ` [Buildroot] [PATCH v4 0/2] meson install with optional tags Vincent Jardin
@ 2024-12-03 14:00                     ` Vincent Jardin
  2024-12-06 13:45                       ` Brandon Maier
  2024-12-03 14:00                     ` [Buildroot] [PATCH v4 " Vincent Jardin
  1 sibling, 1 reply; 33+ messages in thread
From: Vincent Jardin @ 2024-12-03 14:00 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Many packages built with Buildroot and meson currently install header
files into both:
  - the target’s /usr/include, and
  - the sysroot’s /usr/include.

When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
installed exclusively in the staging (sysroot) target during the
build process.

The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
changing to this new behaviour for the time being.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Robin Jarry <robin@jarry.cc>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 package/pkg-meson.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index bc805b799c..4568f8690e 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -220,10 +220,13 @@ endif
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
 	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build
 endef
 endif
 
+# Default values for Staging installation and Target installation
+$(2)_MESON_INSTALL_TAGS ?= NO
+
 #
 # Staging installation step. Only define it if not already defined by
 # the package .mk file.
@@ -231,7 +234,8 @@ endif
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)
 endef
 endif
 
@@ -242,7 +246,8 @@ endif
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime)
 endef
 endif
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v4 2/2] doc/manual/adding-packages-meson.adoc: tags
  2024-12-03 14:00                   ` [Buildroot] [PATCH v4 0/2] meson install with optional tags Vincent Jardin
  2024-12-03 14:00                     ` [Buildroot] [PATCH v4 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2024-12-03 14:00                     ` Vincent Jardin
  1 sibling, 0 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-03 14:00 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
the footprint of the target since only the runtime will be installed.
All the other development header files or libraries will be installed
into the staging folder.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 docs/manual/adding-packages-meson.adoc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/docs/manual/adding-packages-meson.adoc b/docs/manual/adding-packages-meson.adoc
index 01891e03cc..b7c987ddd1 100644
--- a/docs/manual/adding-packages-meson.adoc
+++ b/docs/manual/adding-packages-meson.adoc
@@ -124,6 +124,11 @@ will therefore only use a few of them.
   +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
   +pkg_config_libdir+.
 
+* +FOO_MESON_INSTALL_TAGS+, can be set to +YES+ to enable meson's `--runtime` and
+  `--devel` installation modes for the target and staging folders, respectively.
+  This configuration is necessary to prevent meson from installing development
+  artifacts into the target folder.
+
 * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
   +ninja+, meson companion tool in charge of the build operations. By default,
   empty.
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v4 1/2] package/pkg-meson: h files only into sysroot
  2024-12-03 14:00                     ` [Buildroot] [PATCH v4 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2024-12-06 13:45                       ` Brandon Maier
  2024-12-06 21:30                         ` [Buildroot] [PATCH v5 0/2] meson install with optional tags Vincent Jardin
  0 siblings, 1 reply; 33+ messages in thread
From: Brandon Maier @ 2024-12-06 13:45 UTC (permalink / raw)
  To: Vincent Jardin; +Cc: buildroot, Eric Le Bihan, Robin Jarry

Hi Vincent,

Sorry for resend, forgot to Reply-All

On Tue, Dec 3, 2024 at 8:00 AM Vincent Jardin <vjardin@free.fr> wrote:
>
> Many packages built with Buildroot and meson currently install header
> files into both:
>   - the target’s /usr/include, and
>   - the sysroot’s /usr/include.
>
> When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
> installed exclusively in the staging (sysroot) target during the
> build process.
>
> The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
> changing to this new behaviour for the time being.
>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> Suggested-by: Robin Jarry <robin@jarry.cc>
> Suggested-by: Brandon Maier <brandon.maier@gmail.com>
> ---
>  package/pkg-meson.mk | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index bc805b799c..4568f8690e 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -220,10 +220,13 @@ endif
>  ifndef $(2)_INSTALL_CMDS
>  define $(2)_INSTALL_CMDS
>         $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
> -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +               $$(MESON) install -C $$($$(PKG)_SRCDIR)/build
>  endef
>  endif
>
> +# Default values for Staging installation and Target installation
> +$(2)_MESON_INSTALL_TAGS ?= NO
> +
>  #
>  # Staging installation step. Only define it if not already defined by
>  # the package .mk file.
> @@ -231,7 +234,8 @@ endif
>  ifndef $(2)_INSTALL_STAGING_CMDS
>  define $(2)_INSTALL_STAGING_CMDS
>         $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
> -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +               $$(MESON) install -C \
> +                 $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)

It looks like "$" didn't get changed to "$$". Also this is using
"$(2)" now instead of "$$(PKG)" like before.

For example:

> $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)

Thanks,
Brandon

>  endef
>  endif
>
> @@ -242,7 +246,8 @@ endif
>  ifndef $(2)_INSTALL_TARGET_CMDS
>  define $(2)_INSTALL_TARGET_CMDS
>         $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
> -               $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +               $$(MESON) install -C \
> +                 $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime)
>  endef
>  endif
>
> --
> 2.34.1
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot
  2024-12-02 15:39                 ` Vincent Jardin
  2024-12-02 15:46                   ` [Buildroot] [PATCH v3 0/2] meson install with optional tags Vincent Jardin
  2024-12-03 14:00                   ` [Buildroot] [PATCH v4 0/2] meson install with optional tags Vincent Jardin
@ 2024-12-06 13:47                   ` Brandon Maier
  2024-12-06 21:51                     ` Vincent Jardin
  2 siblings, 1 reply; 33+ messages in thread
From: Brandon Maier @ 2024-12-06 13:47 UTC (permalink / raw)
  To: Vincent Jardin; +Cc: buildroot, Eric Le Bihan, Robin Jarry

Hi Vincent,

Sorry for resend, forgot to Reply-All

On Mon, Dec 2, 2024 at 9:39 AM Vincent Jardin <vjardin@free.fr> wrote:
>
> Hi Brandon,
>
> On Fri, Nov 29, 2024 at 05:42:59PM UTC, Brandon Maier wrote:
> > Hi Vincent,
> >
> > On Tue Nov 26, 2024 at 7:30 PM CST, Vincent Jardin wrote:
> > > Many packages built with Buildroot and meson currently install header
> > > files into both:
> > >   - the target’s /usr/include, and
> > >   - the sysroot’s /usr/include.
> > >
> > > When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
> > > installed exclusively in the staging (sysroot) target during the
> > > build process.
> > >
> > > The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
> > > changing to this new behaviour for the time being.
> >
> > This setting has diminished value if it is default off. Have you done a
> > side-by-side build to see how many packages this breaks?
>
> No, I did not: my assumption was to start easy without breaking/changing
> any behaviour. Then, we can start turning it to "YES" by default later
> on.
>
> So, for the time being, the meson based packages that are known to be
> "ok" can start using the tags. I plan to do so for grout, libecoli and DPDK.

Alright, my main concern was that this feature would be added but not get
used if it isn't default. If you've identified some packages for this
then you could include them with this patch series.

>
> Side question: how do you handle a side-by-side build with Buildroot ?

If you want to diff the files being installed before and after. I
would git-clone
two copies of Buildroot, one without your changes and one with your changes.
Create a .config with the Meson packages enabled you want and enable
BR2_PER_PACKAGE_DIRECTORIES (PER_PACKAGE isolates the
target/host/staging directories and makes testing installation changes easier).
Build each of them. Then you can diff the installed files list that
get generated in the package build directories (output/build/my-package/.file
s-list.txt, .files-list-host.txt, and .files-list-staging.txt)

For example

> cat buildroot-1/output/build/*/.files-list.txt | sort >buildroot-1-files.txt
> cat buildroot-2/output/build/*/.files-list.txt | sort >buildroot-2-files.txt
> diff buildroot-1-files.txt buildroot-2-files.txt

And repeat for -host.txt and -staging.txt

Thanks!
Brandon

>
> > > +             $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(PKG)_MESON_INSTALL_TAGS)),--tags=runtime,devel)
> >
> > The comma in "--tag=runetime,devel" is treated as the Makefile separator
> > for "$(if x, y, z)". Use "--tag=runtime$(comma)devel" instead which
> > substitutes a literal comma.
>
> OK, thanks for catching it !, it'll be included with my next update.
> I did not analyze why I did not catch it...
>
> >
> > The single "$" need to be "$$" so they are properly escaped. (Except
> > "$(comma)")
>
> OK
>
> Thanks Brandon, best regards,
>   Vincent
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v5 0/2] meson install with optional tags
  2024-12-06 13:45                       ` Brandon Maier
@ 2024-12-06 21:30                         ` Vincent Jardin
  2024-12-06 21:30                           ` [Buildroot] [PATCH v5 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
  2024-12-06 21:30                           ` [Buildroot] [PATCH v5 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  0 siblings, 2 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-06 21:30 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

v5:
  - per Brandon's advise, replace $(2) by $(PKG)

v4:
  - fix $ eval, former v3 was mis-tested

v3:
  - do not use , but $(comma), see support/misc/utils.mk

v2:
  - generic argument for both target and staging installation
  - update the documentation

v1:
  - use meson instead of ninja in order to support tags
  - add a install tags argument

Vincent Jardin (2):
  package/pkg-meson: h files only into sysroot
  doc/manual/adding-packages-meson.adoc: tags

 docs/manual/adding-packages-meson.adoc |  5 +++++
 package/pkg-meson.mk                   | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.34.1

Vincent Jardin (2):
  package/pkg-meson: h files only into sysroot
  doc/manual/adding-packages-meson.adoc: tags

 docs/manual/adding-packages-meson.adoc |  5 +++++
 package/pkg-meson.mk                   | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v5 1/2] package/pkg-meson: h files only into sysroot
  2024-12-06 21:30                         ` [Buildroot] [PATCH v5 0/2] meson install with optional tags Vincent Jardin
@ 2024-12-06 21:30                           ` Vincent Jardin
  2024-12-06 21:30                           ` [Buildroot] [PATCH v5 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  1 sibling, 0 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-06 21:30 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Many packages built with Buildroot and meson currently install header
files into both:
  - the target’s /usr/include, and
  - the sysroot’s /usr/include.

When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
installed exclusively in the staging (sysroot) target during the
build process.

The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
changing to this new behaviour for the time being.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Robin Jarry <robin@jarry.cc>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 package/pkg-meson.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index bc805b799c..4568f8690e 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -220,10 +220,13 @@ endif
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
 	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build
 endef
 endif
 
+# Default values for Staging installation and Target installation
+$(2)_MESON_INSTALL_TAGS ?= NO
+
 #
 # Staging installation step. Only define it if not already defined by
 # the package .mk file.
@@ -231,7 +234,8 @@ endif
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)
 endef
 endif
 
@@ -242,7 +246,8 @@ endif
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime)
 endef
 endif
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v5 2/2] doc/manual/adding-packages-meson.adoc: tags
  2024-12-06 21:30                         ` [Buildroot] [PATCH v5 0/2] meson install with optional tags Vincent Jardin
  2024-12-06 21:30                           ` [Buildroot] [PATCH v5 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2024-12-06 21:30                           ` Vincent Jardin
  2024-12-10  0:08                             ` Brandon Maier
  1 sibling, 1 reply; 33+ messages in thread
From: Vincent Jardin @ 2024-12-06 21:30 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
the footprint of the target since only the runtime will be installed.
All the other development header files or libraries will be installed
into the staging folder.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 docs/manual/adding-packages-meson.adoc | 5 +++++
 package/pkg-meson.mk                   | 4 ++--
 2 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/docs/manual/adding-packages-meson.adoc b/docs/manual/adding-packages-meson.adoc
index 01891e03cc..b7c987ddd1 100644
--- a/docs/manual/adding-packages-meson.adoc
+++ b/docs/manual/adding-packages-meson.adoc
@@ -124,6 +124,11 @@ will therefore only use a few of them.
   +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
   +pkg_config_libdir+.
 
+* +FOO_MESON_INSTALL_TAGS+, can be set to +YES+ to enable meson's `--runtime` and
+  `--devel` installation modes for the target and staging folders, respectively.
+  This configuration is necessary to prevent meson from installing development
+  artifacts into the target folder.
+
 * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
   +ninja+, meson companion tool in charge of the build operations. By default,
   empty.
diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index 4568f8690e..a4e77cde42 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -235,7 +235,7 @@ ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
 		$$(MESON) install -C \
-		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)
+		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)
 endef
 endif
 
@@ -247,7 +247,7 @@ ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
 		$$(MESON) install -C \
-		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime)
+		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime)
 endef
 endif
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot
  2024-12-06 13:47                   ` [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot Brandon Maier
@ 2024-12-06 21:51                     ` Vincent Jardin
  0 siblings, 0 replies; 33+ messages in thread
From: Vincent Jardin @ 2024-12-06 21:51 UTC (permalink / raw)
  To: Brandon Maier; +Cc: buildroot, Eric Le Bihan, Robin Jarry

Hi Brandon,

On Fri, Dec 06, 2024 at 07:47:06AM UTC, Brandon Maier wrote:
> > "ok" can start using the tags. I plan to do so for grout, libecoli and DPDK.
> 
> Alright, my main concern was that this feature would be added but not get
> used if it isn't default. If you've identified some packages for this
> then you could include them with this patch series.

I'd prefer to provide first this capability and then later to start
patching the related packages.

> > Side question: how do you handle a side-by-side build with Buildroot ?
> 
> If you want to diff the files being installed before and after. I
> would git-clone
> two copies of Buildroot, one without your changes and one with your changes.
> Create a .config with the Meson packages enabled you want and enable
> BR2_PER_PACKAGE_DIRECTORIES (PER_PACKAGE isolates the
> target/host/staging directories and makes testing installation changes easier).
> Build each of them. Then you can diff the installed files list that
> get generated in the package build directories (output/build/my-package/.file
> s-list.txt, .files-list-host.txt, and .files-list-staging.txt)
> 
> For example
> 
> > cat buildroot-1/output/build/*/.files-list.txt | sort >buildroot-1-files.txt
> > cat buildroot-2/output/build/*/.files-list.txt | sort >buildroot-2-files.txt
> > diff buildroot-1-files.txt buildroot-2-files.txt
> 
> And repeat for -host.txt and -staging.txt

Big thanks, it is very instructive. I'll try it next week.

Best regards,
  Vincent
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v5 2/2] doc/manual/adding-packages-meson.adoc: tags
  2024-12-06 21:30                           ` [Buildroot] [PATCH v5 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
@ 2024-12-10  0:08                             ` Brandon Maier
  2025-01-02 16:46                               ` [Buildroot] [PATCH v6 0/2] meson install with optional tags Vincent Jardin
  2025-01-02 16:50                               ` [Buildroot] [PATCH v5 " Vincent Jardin
  0 siblings, 2 replies; 33+ messages in thread
From: Brandon Maier @ 2024-12-10  0:08 UTC (permalink / raw)
  To: Vincent Jardin, buildroot; +Cc: Eric Le Bihan, Robin Jarry

Hi Vincent,

On Fri Dec 6, 2024 at 3:30 PM CST, Vincent Jardin wrote:
> Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
> the footprint of the target since only the runtime will be installed.
> All the other development header files or libraries will be installed
> into the staging folder.
>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> Suggested-by: Brandon Maier <brandon.maier@gmail.com>
> ---
>  docs/manual/adding-packages-meson.adoc | 5 +++++
>  package/pkg-meson.mk                   | 4 ++--
>  2 files changed, 7 insertions(+), 2 deletions(-)
>
> diff --git a/docs/manual/adding-packages-meson.adoc b/docs/manual/adding-packages-meson.adoc
> index 01891e03cc..b7c987ddd1 100644
> --- a/docs/manual/adding-packages-meson.adoc
> +++ b/docs/manual/adding-packages-meson.adoc
> @@ -124,6 +124,11 @@ will therefore only use a few of them.
>    +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
>    +pkg_config_libdir+.
>
> +* +FOO_MESON_INSTALL_TAGS+, can be set to +YES+ to enable meson's `--runtime` and
> +  `--devel` installation modes for the target and staging folders, respectively.
> +  This configuration is necessary to prevent meson from installing development
> +  artifacts into the target folder.
> +
>  * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
>    +ninja+, meson companion tool in charge of the build operations. By default,
>    empty.
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 4568f8690e..a4e77cde42 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -235,7 +235,7 @@ ifndef $(2)_INSTALL_STAGING_CMDS
>  define $(2)_INSTALL_STAGING_CMDS
>  	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
>  		$$(MESON) install -C \
> -		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)
> +		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)

It looks like these changes accidentally got applied to the
wrong patch.

>  endef
>  endif
>
> @@ -247,7 +247,7 @@ ifndef $(2)_INSTALL_TARGET_CMDS
>  define $(2)_INSTALL_TARGET_CMDS
>  	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
>  		$$(MESON) install -C \
> -		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime)
> +		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime)
>  endef
>  endif
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v6 0/2] meson install with optional tags
  2024-12-10  0:08                             ` Brandon Maier
@ 2025-01-02 16:46                               ` Vincent Jardin
  2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
  2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  2025-01-02 16:50                               ` [Buildroot] [PATCH v5 " Vincent Jardin
  1 sibling, 2 replies; 33+ messages in thread
From: Vincent Jardin @ 2025-01-02 16:46 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

v6:
  - per Brandon's comment, fix git accidental update
  - tested with libecoli package

v5:
  - per Brandon's advise, replace $(2) by $(PKG)

v4:
  - fix $ eval, former v3 was mis-tested

v3:
  - do not use , but $(comma), see support/misc/utils.mk

v2:
  - generic argument for both target and staging installation
  - update the documentation

v1:
  - use meson instead of ninja in order to support tags
  - add a install tags argument


Vincent Jardin (2):
  package/pkg-meson: h files only into sysroot
  doc/manual/adding-packages-meson.adoc: tags

 docs/manual/adding-packages-meson.adoc |  5 +++++
 package/pkg-meson.mk                   | 11 ++++++++---
 2 files changed, 13 insertions(+), 3 deletions(-)

-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v6 1/2] package/pkg-meson: h files only into sysroot
  2025-01-02 16:46                               ` [Buildroot] [PATCH v6 0/2] meson install with optional tags Vincent Jardin
@ 2025-01-02 16:46                                 ` Vincent Jardin
  2025-01-10  0:08                                   ` Brandon Maier
  2025-01-26 11:14                                   ` Thomas Petazzoni via buildroot
  2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  1 sibling, 2 replies; 33+ messages in thread
From: Vincent Jardin @ 2025-01-02 16:46 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Many packages built with Buildroot and meson currently install header
files into both:
  - the target’s /usr/include, and
  - the sysroot’s /usr/include.

When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
installed exclusively in the staging (sysroot) target during the
build process.

The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
changing to this new behaviour for the time being.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Robin Jarry <robin@jarry.cc>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 package/pkg-meson.mk | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
index bc805b799c..c08371aa10 100644
--- a/package/pkg-meson.mk
+++ b/package/pkg-meson.mk
@@ -220,10 +220,13 @@ endif
 ifndef $(2)_INSTALL_CMDS
 define $(2)_INSTALL_CMDS
 	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build
 endef
 endif
 
+# Default values for Staging installation and Target installation
+$(2)_MESON_INSTALL_TAGS ?= NO
+
 #
 # Staging installation step. Only define it if not already defined by
 # the package .mk file.
@@ -231,7 +234,8 @@ endif
 ifndef $(2)_INSTALL_STAGING_CMDS
 define $(2)_INSTALL_STAGING_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime$$(comma)devel)
 endef
 endif
 
@@ -242,7 +246,8 @@ endif
 ifndef $(2)_INSTALL_TARGET_CMDS
 define $(2)_INSTALL_TARGET_CMDS
 	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
-		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
+		$$(MESON) install -C \
+		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime)
 endef
 endif
 
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags
  2025-01-02 16:46                               ` [Buildroot] [PATCH v6 0/2] meson install with optional tags Vincent Jardin
  2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2025-01-02 16:46                                 ` Vincent Jardin
  2025-01-10  0:09                                   ` Brandon Maier
  2025-01-26 11:15                                   ` Thomas Petazzoni via buildroot
  1 sibling, 2 replies; 33+ messages in thread
From: Vincent Jardin @ 2025-01-02 16:46 UTC (permalink / raw)
  To: buildroot; +Cc: Eric Le Bihan, Robin Jarry, Brandon Maier, Vincent Jardin

Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
the footprint of the target since only the runtime will be installed.
All the other development header files or libraries will be installed
into the staging folder.

Signed-off-by: Vincent Jardin <vjardin@free.fr>
Suggested-by: Brandon Maier <brandon.maier@gmail.com>
---
 docs/manual/adding-packages-meson.adoc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/docs/manual/adding-packages-meson.adoc b/docs/manual/adding-packages-meson.adoc
index 01891e03cc..b7c987ddd1 100644
--- a/docs/manual/adding-packages-meson.adoc
+++ b/docs/manual/adding-packages-meson.adoc
@@ -124,6 +124,11 @@ will therefore only use a few of them.
   +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
   +pkg_config_libdir+.
 
+* +FOO_MESON_INSTALL_TAGS+, can be set to +YES+ to enable meson's `--runtime` and
+  `--devel` installation modes for the target and staging folders, respectively.
+  This configuration is necessary to prevent meson from installing development
+  artifacts into the target folder.
+
 * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
   +ninja+, meson companion tool in charge of the build operations. By default,
   empty.
-- 
2.34.1

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v5 2/2] doc/manual/adding-packages-meson.adoc: tags
  2024-12-10  0:08                             ` Brandon Maier
  2025-01-02 16:46                               ` [Buildroot] [PATCH v6 0/2] meson install with optional tags Vincent Jardin
@ 2025-01-02 16:50                               ` Vincent Jardin
  1 sibling, 0 replies; 33+ messages in thread
From: Vincent Jardin @ 2025-01-02 16:50 UTC (permalink / raw)
  To: Brandon Maier; +Cc: Eric Le Bihan, Robin Jarry, buildroot

Hi Brandon,

Happy new year !

> > -		  $$($$(PKG)_SRCDIR)/build $(if $(filter YES,$($(2)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)
> > +		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime$(comma)devel)
> 
> It looks like these changes accidentally got applied to the
> wrong patch.
> 

Oops, I hope 2025 will be more efficient ! v6 for such a small patch ;)
  LoL

Thanks for your support,
  Vincent
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v6 1/2] package/pkg-meson: h files only into sysroot
  2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
@ 2025-01-10  0:08                                   ` Brandon Maier
  2025-01-26 11:14                                   ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 33+ messages in thread
From: Brandon Maier @ 2025-01-10  0:08 UTC (permalink / raw)
  To: Vincent Jardin, buildroot; +Cc: Eric Le Bihan, Robin Jarry

Hi Vincent,

On Thu Jan 2, 2025 at 10:46 AM CST, Vincent Jardin wrote:
> Many packages built with Buildroot and meson currently install header
> files into both:
>   - the target’s /usr/include, and
>   - the sysroot’s /usr/include.
>
> When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
> installed exclusively in the staging (sysroot) target during the
> build process.
>
> The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
> changing to this new behaviour for the time being.
>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> Suggested-by: Robin Jarry <robin@jarry.cc>
> Suggested-by: Brandon Maier <brandon.maier@gmail.com>

Reviewed-by: Brandon Maier <brandon.maier@gmail.com>

Thanks!

> ---
>  package/pkg-meson.mk | 11 ++++++++---
>  1 file changed, 8 insertions(+), 3 deletions(-)
>
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index bc805b799c..c08371aa10 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
> @@ -220,10 +220,13 @@ endif
>  ifndef $(2)_INSTALL_CMDS
>  define $(2)_INSTALL_CMDS
>  	$$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \
> -		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +		$$(MESON) install -C $$($$(PKG)_SRCDIR)/build
>  endef
>  endif
>
> +# Default values for Staging installation and Target installation
> +$(2)_MESON_INSTALL_TAGS ?= NO
> +
>  #
>  # Staging installation step. Only define it if not already defined by
>  # the package .mk file.
> @@ -231,7 +234,8 @@ endif
>  ifndef $(2)_INSTALL_STAGING_CMDS
>  define $(2)_INSTALL_STAGING_CMDS
>  	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(STAGING_DIR) \
> -		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +		$$(MESON) install -C \
> +		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime$$(comma)devel)
>  endef
>  endif
>
> @@ -242,7 +246,8 @@ endif
>  ifndef $(2)_INSTALL_TARGET_CMDS
>  define $(2)_INSTALL_TARGET_CMDS
>  	$$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) DESTDIR=$$(TARGET_DIR) \
> -		$$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install
> +		$$(MESON) install -C \
> +		  $$($$(PKG)_SRCDIR)/build $$(if $$(filter YES,$$($$(PKG)_MESON_INSTALL_TAGS)),--tags=runtime)
>  endef
>  endif
>
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags
  2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
@ 2025-01-10  0:09                                   ` Brandon Maier
  2025-01-26 10:23                                     ` Vincent Jardin
  2025-01-26 11:15                                   ` Thomas Petazzoni via buildroot
  1 sibling, 1 reply; 33+ messages in thread
From: Brandon Maier @ 2025-01-10  0:09 UTC (permalink / raw)
  To: Vincent Jardin, buildroot; +Cc: Eric Le Bihan, Robin Jarry

On Thu Jan 2, 2025 at 10:46 AM CST, Vincent Jardin wrote:
> Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
> the footprint of the target since only the runtime will be installed.
> All the other development header files or libraries will be installed
> into the staging folder.
>
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> Suggested-by: Brandon Maier <brandon.maier@gmail.com>

Reviewed-by: Brandon Maier <brandon.maier@gmail.com>

> ---
>  docs/manual/adding-packages-meson.adoc | 5 +++++
>  1 file changed, 5 insertions(+)
>
> diff --git a/docs/manual/adding-packages-meson.adoc b/docs/manual/adding-packages-meson.adoc
> index 01891e03cc..b7c987ddd1 100644
> --- a/docs/manual/adding-packages-meson.adoc
> +++ b/docs/manual/adding-packages-meson.adoc
> @@ -124,6 +124,11 @@ will therefore only use a few of them.
>    +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
>    +pkg_config_libdir+.
>
> +* +FOO_MESON_INSTALL_TAGS+, can be set to +YES+ to enable meson's `--runtime` and
> +  `--devel` installation modes for the target and staging folders, respectively.
> +  This configuration is necessary to prevent meson from installing development
> +  artifacts into the target folder.
> +
>  * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
>    +ninja+, meson companion tool in charge of the build operations. By default,
>    empty.
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags
  2025-01-10  0:09                                   ` Brandon Maier
@ 2025-01-26 10:23                                     ` Vincent Jardin
  0 siblings, 0 replies; 33+ messages in thread
From: Vincent Jardin @ 2025-01-26 10:23 UTC (permalink / raw)
  To: Brandon Maier, buildroot, Julien Olivain, thomas.petazzoni
  Cc: Eric Le Bihan, Robin Jarry


[-- Attachment #1.1: Type: text/plain, Size: 1668 bytes --]



Le 10 janvier 2025 01:09:24 "Brandon Maier" <brandon.maier@gmail.com> a écrit :

> On Thu Jan 2, 2025 at 10:46 AM CST, Vincent Jardin wrote:
>> Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
>> the footprint of the target since only the runtime will be installed.
>> All the other development header files or libraries will be installed
>> into the staging folder.
>>
>> Signed-off-by: Vincent Jardin <vjardin@free.fr>
>> Suggested-by: Brandon Maier <brandon.maier@gmail.com>
>
> Reviewed-by: Brandon Maier <brandon.maier@gmail.com>

I understand that this serie is OK. Can it be merged ?
  https://patchwork.ozlabs.org/project/buildroot/list/?series=438648

Thank you,
  Vincent


>
>
>> ---
>> docs/manual/adding-packages-meson.adoc | 5 +++++
>> 1 file changed, 5 insertions(+)
>>
>> diff --git a/docs/manual/adding-packages-meson.adoc 
>> b/docs/manual/adding-packages-meson.adoc
>> index 01891e03cc..b7c987ddd1 100644
>> --- a/docs/manual/adding-packages-meson.adoc
>> +++ b/docs/manual/adding-packages-meson.adoc
>> @@ -124,6 +124,11 @@ will therefore only use a few of them.
>> +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
>> +pkg_config_libdir+.
>>
>> +* +FOO_MESON_INSTALL_TAGS+, can be set to +YES+ to enable meson's 
>> `--runtime` and
>> +  `--devel` installation modes for the target and staging folders, 
>> respectively.
>> +  This configuration is necessary to prevent meson from installing development
>> +  artifacts into the target folder.
>> +
>> * +FOO_NINJA_ENV+, to specify additional environment variables to pass to
>> +ninja+, meson companion tool in charge of the build operations. By default,
>> empty.


[-- Attachment #1.2: Type: text/html, Size: 3611 bytes --]

[-- Attachment #2: Type: text/plain, Size: 150 bytes --]

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v6 1/2] package/pkg-meson: h files only into sysroot
  2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
  2025-01-10  0:08                                   ` Brandon Maier
@ 2025-01-26 11:14                                   ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 33+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-01-26 11:14 UTC (permalink / raw)
  To: Vincent Jardin
  Cc: buildroot, Eric Le Bihan, Robin Jarry, Brandon Maier,
	Julien Olivain

Hello,

On Thu,  2 Jan 2025 17:46:29 +0100
Vincent Jardin <vjardin@free.fr> wrote:

> Many packages built with Buildroot and meson currently install header
> files into both:
>   - the target’s /usr/include, and
>   - the sysroot’s /usr/include.
> 
> When FOO_MESON_INSTALL_TAGS = YES, ensure that header files are
> installed exclusively in the staging (sysroot) target during the
> build process.
> 
> The default is FOO_MESON_INSTALL_TAGS ?= NO in order to avoid
> changing to this new behaviour for the time being.
> 
> Signed-off-by: Vincent Jardin <vjardin@free.fr>
> Suggested-by: Robin Jarry <robin@jarry.cc>
> Suggested-by: Brandon Maier <brandon.maier@gmail.com>

Thanks Vincent for the patch.

I am not sure we want this behavior, as it would only be applicable to
meson packages. For all other packages, we install pretty much
everything to target, and then wipe-out what's needed in
target-finalize. So I'm not sure what is the benefit of diverging from
this common behavior just for meson packages.

This is not a strong feeling, but as other build systems don't have
this concept of installing only the runtime, I'm not sure it makes a
lot of sense to use that just for meson-based packages.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

* Re: [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags
  2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
  2025-01-10  0:09                                   ` Brandon Maier
@ 2025-01-26 11:15                                   ` Thomas Petazzoni via buildroot
  1 sibling, 0 replies; 33+ messages in thread
From: Thomas Petazzoni via buildroot @ 2025-01-26 11:15 UTC (permalink / raw)
  To: Vincent Jardin; +Cc: buildroot, Eric Le Bihan, Robin Jarry, Brandon Maier

On Thu,  2 Jan 2025 17:46:30 +0100
Vincent Jardin <vjardin@free.fr> wrote:

> Described the usage of FOO_MESON_INSTALL_TAGS=YES which decreases
> the footprint of the target since only the runtime will be installed.
> All the other development header files or libraries will be installed
> into the staging folder.

This is not quite true: headers and development files are anyway
dropped from $(TARGET_DIR) during the target-finalize step. So this
commit does not decrease the footprint of the root filesystem.

Thomas
-- 
Thomas Petazzoni, co-owner and CEO, Bootlin
Embedded Linux and Kernel engineering and training
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 33+ messages in thread

end of thread, other threads:[~2025-01-26 11:15 UTC | newest]

Thread overview: 33+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-19 20:59 [Buildroot] [PATCH 1/1] package/pkg-meson: h files only into sysroot Vincent Jardin
2024-11-21 13:49 ` Brandon Maier
2024-11-22  0:20   ` Vincent Jardin
2024-11-26 14:17     ` Brandon Maier
2024-11-26 18:10       ` Vincent Jardin
2024-11-26 19:57         ` Brandon Maier
2024-11-27  1:29           ` [Buildroot] [PATCH v2 0/2] meson install with optional tags Vincent Jardin
2024-11-27  1:30             ` [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
2024-11-29 23:42               ` Brandon Maier
2024-12-02 15:39                 ` Vincent Jardin
2024-12-02 15:46                   ` [Buildroot] [PATCH v3 0/2] meson install with optional tags Vincent Jardin
2024-12-02 15:46                     ` [Buildroot] [PATCH v3 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
2024-12-02 15:46                     ` [Buildroot] [PATCH v3 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
2024-12-03 14:00                   ` [Buildroot] [PATCH v4 0/2] meson install with optional tags Vincent Jardin
2024-12-03 14:00                     ` [Buildroot] [PATCH v4 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
2024-12-06 13:45                       ` Brandon Maier
2024-12-06 21:30                         ` [Buildroot] [PATCH v5 0/2] meson install with optional tags Vincent Jardin
2024-12-06 21:30                           ` [Buildroot] [PATCH v5 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
2024-12-06 21:30                           ` [Buildroot] [PATCH v5 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
2024-12-10  0:08                             ` Brandon Maier
2025-01-02 16:46                               ` [Buildroot] [PATCH v6 0/2] meson install with optional tags Vincent Jardin
2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 1/2] package/pkg-meson: h files only into sysroot Vincent Jardin
2025-01-10  0:08                                   ` Brandon Maier
2025-01-26 11:14                                   ` Thomas Petazzoni via buildroot
2025-01-02 16:46                                 ` [Buildroot] [PATCH v6 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin
2025-01-10  0:09                                   ` Brandon Maier
2025-01-26 10:23                                     ` Vincent Jardin
2025-01-26 11:15                                   ` Thomas Petazzoni via buildroot
2025-01-02 16:50                               ` [Buildroot] [PATCH v5 " Vincent Jardin
2024-12-03 14:00                     ` [Buildroot] [PATCH v4 " Vincent Jardin
2024-12-06 13:47                   ` [Buildroot] [PATCH v2 1/2] package/pkg-meson: h files only into sysroot Brandon Maier
2024-12-06 21:51                     ` Vincent Jardin
2024-11-27  1:30             ` [Buildroot] [PATCH v2 2/2] doc/manual/adding-packages-meson.adoc: tags Vincent Jardin

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.