[Buildroot] [PATCH v3 1/1] package/pkg-meson: use meson to build/install packages
Yann E. MORIN
yann.morin.1998 at free.fr
Sun Jul 24 15:37:36 UTC 2022
James, All,
On 2022-07-22 00:09 -0600, James Hilliard spake thusly:
> As of version 0.54.0 meson has had the ability to build and install
> packages rather than having to run ninja directly as before.
>
> This will allow us to use features such as meson install tags in
> the future which require meson to be used for the installation.
>
> It appears we need to ensure the cmake prefix path is set for the
> meson generated relocatable pkg-config format to work properly.
>
> Signed-off-by: James Hilliard <james.hilliard1 at gmail.com>
> ---
[--SNIP--]
> diff --git a/docs/manual/adding-packages-meson.txt b/docs/manual/adding-packages-meson.txt
> index 029c8c2488..c8aed65c2f 100644
> --- a/docs/manual/adding-packages-meson.txt
> +++ b/docs/manual/adding-packages-meson.txt
> @@ -125,8 +125,8 @@ will therefore only use a few of them.
> +c_link_args+, +cpp_args+, +cpp_link_args+, +sys_root+, and
> +pkg_config_libdir+.
>
> -* +FOO_NINJA_ENV+, to specify additional environment variables to pass to
> - +ninja+, meson companion tool in charge of the build operations. By default,
> +* +FOO_MESON_ENV+, to specify additional environment variables to pass to
> + +meson+, meson tool in charge of the build/install operations. By default,
> empty.
IIRC, the topic of what to do about external packages that set their
FOO_NINJA_ENV, was raised in a previous iteration.
I understand that the conclusion was basically "the probability is low,
we don't handle it". This should have been noted in the commit log.
> * +FOO_NINJA_OPTS+, to specify a space-separated list of targets to build. By
Now that we use meson to build and instal, does it still make sense to
have FOO_NINJA_OPTS to be the list of targets to install?
I mean, isn't there a way to tell meson what to install, instead?
[--SNIP--]
> diff --git a/package/pkg-cmake.mk b/package/pkg-cmake.mk
> index 3b1db35fb6..4fa620080d 100644
> --- a/package/pkg-cmake.mk
> +++ b/package/pkg-cmake.mk
> @@ -90,6 +90,8 @@ define $(2)_CONFIGURE_CMDS
> $$($$(PKG)_CONF_ENV) $$(BR2_CMAKE) $$($$(PKG)_SRCDIR) \
> -DCMAKE_TOOLCHAIN_FILE="$$(HOST_DIR)/share/buildroot/toolchainfile.cmake" \
> -DCMAKE_INSTALL_PREFIX="/usr" \
> + -DCMAKE_PREFIX_PATH="$$(STAGING_DIR)/usr" \
> + -DPKG_CONFIG_USE_CMAKE_PREFIX_PATH=ON \
But doesn't that needs to be in a separate patch? I mean, does it not
make sense opn its own?
[--SNIP--]
> diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk
> index 0835e08e3a..de5817d5da 100644
> --- a/package/pkg-meson.mk
> +++ b/package/pkg-meson.mk
[--SNIP--]
> @@ -138,6 +138,7 @@ define $(2)_CONFIGURE_CMDS
> $$(MESON) \
> --prefix=/usr \
> --libdir=lib \
> + --pkgconfig.relocatable \
Please explain what that means and why this is needed in the context of
a target package.
> --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \
> --buildtype=$(if $(BR2_ENABLE_RUNTIME_DEBUG),debug,release) \
> --cross-file=$$($$(PKG)_SRCDIR)/build/cross-compilation.conf \
> @@ -156,10 +157,11 @@ define $(2)_CONFIGURE_CMDS
> mkdir -p $$($$(PKG)_SRCDIR)/build
> $$(HOST_CONFIGURE_OPTS) \
> $$($$(PKG)_CONF_ENV) $$(MESON) \
> - --prefix=$$(HOST_DIR) \
> + --prefix=/ \
It is very weird that host packages are configured with / as prefix, and
then installed in HOST_DIR set as DEST_DIR.
I guess this is working thanks to --pkgconfig.relocatable a few lines
below?
This must be explained in the commit log (and probably a little comment
above $(2)_CONFIGURE_CMDS for host packages.
> --libdir=lib \
> - --sysconfdir=$$(HOST_DIR)/etc \
> - --localstatedir=$$(HOST_DIR)/var \
> + --pkgconfig.relocatable \
> + --sysconfdir=etc \
> + --localstatedir=var \
Ditto for etc and var?
So, to make it easier to follow, I'd change the ordering:
--pkgconfig.relocatable \
--prefix=/ \
--sysconfdir=etc \
--localstatedir=var \
Regards,
Yann E. MORIN.
--
.-----------------.--------------------.------------------.--------------------.
| Yann E. MORIN | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software Designer | \ / CAMPAIGN | ___ |
| +33 561 099 427 `------------.-------: X AGAINST | \e/ There is no |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL | v conspiracy. |
'------------------------------^-------^------------------^--------------------'
More information about the buildroot
mailing list