diff mbox series

[v6,1/2] package/pkg-meson: h files only into sysroot

Message ID 20250102164630.25695-2-vjardin@free.fr
State New
Headers show
Series meson install with optional tags | expand

Commit Message

Vincent Jardin Jan. 2, 2025, 4:46 p.m. UTC
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(-)

Comments

Brandon Maier Jan. 10, 2025, 12:08 a.m. UTC | #1
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
>
Thomas Petazzoni Jan. 26, 2025, 11:14 a.m. UTC | #2
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
diff mbox series

Patch

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