Message ID | 20220727071557.3434892-2-james.hilliard1@gmail.com |
---|---|
State | Changes Requested |
Headers | show |
Series | [v5,1/2] support/misc/toolchainfile.cmake.in: don't set PKG_CONFIG_SYSROOT_DIR | expand |
On 27/07/2022 09:15, James Hilliard wrote: > 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. > > Note that we've removed FOO_NINJA_ENV which may cause issues > in the unlikely event an external package uses it. > > We need to set --pkgconfig.relocatable so that pkg-config files are > not generated with absolute paths which cause issues with per-package > directories. This still doesn't explain how it is related to using meson rather than ninja. Are you saying that when calling ninja directly, PPD work perfectly fine, but if it's installed with meson, it doesn't? Then I'd really like to have a little more insight into what meson does to break it. I suspect that the two are actually unrelated, and thus the patches should be split. > > Remove conflicting host-systemd paths. > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> [snip] > @@ -156,10 +157,20 @@ define $(2)_CONFIGURE_CMDS > mkdir -p $$($$(PKG)_SRCDIR)/build > $$(HOST_CONFIGURE_OPTS) \ > $$($$(PKG)_CONF_ENV) $$(MESON) \ > + --pkgconfig.relocatable \ > --prefix=$$(HOST_DIR) \ > - --libdir=lib \ > - --sysconfdir=$$(HOST_DIR)/etc \ > + --bindir=$$(HOST_DIR)/bin \ bindir defaults to "bin", which means things will be installed in <prefix>/bin and references to bindir in pkgconfig will use <prefix>/bin absolute paths as well (actually, as ${prefix}/bin). How does pkgconfig.relocatable change things that we suddenly need to override the default with an absolute path? > + --datadir=$$(HOST_DIR)/share \ > + --includedir=$$(HOST_DIR)/include \ > + --infodir=$$(HOST_DIR)/share/info \ > + --libdir=$$(HOST_DIR)/lib \ > + --libexecdir=$$(HOST_DIR)/libexec \ > + --localedir=$$(HOST_DIR)/share/locale \ > --localstatedir=$$(HOST_DIR)/var \ > + --mandir=$$(HOST_DIR)/share/man \ > + --sbindir=$$(HOST_DIR)/sbin \ > + --sharedstatedir=$$(HOST_DIR)/com \ > + --sysconfdir=$$(HOST_DIR)/etc \ > --default-library=shared \ > --buildtype=release \ > --wrap-mode=nodownload \ > @@ -179,13 +190,23 @@ $(2)_DEPENDENCIES += host-meson > ifndef $(2)_BUILD_CMDS > ifeq ($(4),target) > define $(2)_BUILD_CMDS > - $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ > - $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build > + $$(TARGET_MAKE_ENV) \ > + $$($$(PKG)_MESON_ENV) \ > + $$(MESON) \ > + compile \ > + $$(MESON_BUILD_OPTS) \ > + $$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \ > + -C $$($$(PKG)_SRCDIR)/build > endef > else > define $(2)_BUILD_CMDS > - $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ > - $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build > + $$(HOST_MAKE_ENV) \ > + $$($$(PKG)_MESON_ENV) \ > + $$(MESON) \ > + compile \ > + $$(MESON_BUILD_OPTS) \ > + $$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \ > + -C $$($$(PKG)_SRCDIR)/build > endef > endif > endif > @@ -196,8 +217,12 @@ endif > # > ifndef $(2)_INSTALL_CMDS > define $(2)_INSTALL_CMDS > - $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ > - $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install > + $$(HOST_MAKE_ENV) \ > + $$($$(PKG)_MESON_ENV) \ > + $$(MESON) \ > + install \ > + $$(MESON_INSTALL_OPTS) \ > + -C $$($$(PKG)_SRCDIR)/build Why is there a --ninja-args in the build but not in the install? > endef > endif > > @@ -207,8 +232,13 @@ 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 > + $$(TARGET_MAKE_ENV) \ > + $$($$(PKG)_MESON_ENV) \ > + $$(MESON) \ > + install \ > + $$(MESON_INSTALL_OPTS) \ > + --destdir $$(STAGING_DIR) \ > + -C $$($$(PKG)_SRCDIR)/build > endef > endif > > @@ -218,8 +248,13 @@ 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 > + $$(TARGET_MAKE_ENV) \ > + $$($$(PKG)_MESON_ENV) \ > + $$(MESON) \ > + install \ > + $$(MESON_INSTALL_OPTS) \ > + --destdir $$(TARGET_DIR) \ > + -C $$($$(PKG)_SRCDIR)/build > endef > endif > > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > index 47aaddf849..6efc8d636f 100644 > --- a/package/systemd/systemd.mk > +++ b/package/systemd/systemd.mk > @@ -749,7 +749,7 @@ endef > SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_PRESET_ALL > > SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) > -SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) > +SYSTEMD_MESON_ENV = $(HOST_UTF8_LOCALE_ENV) > > define SYSTEMD_LINUX_CONFIG_FIXUPS > $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS) > @@ -777,10 +777,7 @@ endef > HOST_SYSTEMD_CONF_OPTS = \ > -Dsplit-bin=true \ > -Dsplit-usr=false \ > - --prefix=/usr \ > - --libdir=lib \ > - --sysconfdir=/etc \ > - --localstatedir=/var \ > + -Drootprefix=$(HOST_DIR) \ This change looks like something we can apply independently of the rest of the seris as well. It looks like a much better way of handling the special case of systemd. However, I'd like a much more detailed explanation about why this works now but didn't work in commit 35c11a027c88a3c943554eefbbed051fd2d98a50. That commit has an extensive explanation of the reasoning. Regards, Arnout > -Dmode=release \ > -Dutmp=false \ > -Dhibernate=false \ > @@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \ > host-gperf \ > host-python-jinja2 > > -HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR) > - > # Fix RPATH After installation > # * systemd provides a install_rpath instruction to meson because the binaries > # need to link with libsystemd which is not in a standard path
James, All, On 2022-07-27 01:15 -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. [--SNIP--] > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > index 47aaddf849..6efc8d636f 100644 > --- a/package/systemd/systemd.mk > +++ b/package/systemd/systemd.mk [--SNIP--] > @@ -777,10 +777,7 @@ endef > HOST_SYSTEMD_CONF_OPTS = \ > -Dsplit-bin=true \ > -Dsplit-usr=false \ > - --prefix=/usr \ > - --libdir=lib \ > - --sysconfdir=/etc \ > - --localstatedir=/var \ > + -Drootprefix=$(HOST_DIR) \ Have you read the explanations in 35c11a027c8 (package/systemd: add host variant)? This change must expand on how it does not break things, with a very good and detailed commit log, and as a separate patch. Also, if the HOST_SYSTEMD_FIX_RPATH hook still needed, then? Regards, Yann E. MORIN. > -Dutmp=false \ > -Dhibernate=false \ > @@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \ > host-gperf \ > host-python-jinja2 > > -HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR) > - > # Fix RPATH After installation > # * systemd provides a install_rpath instruction to meson because the binaries > # need to link with libsystemd which is not in a standard path > -- > 2.34.1 > > _______________________________________________ > buildroot mailing list > buildroot@buildroot.org > https://lists.buildroot.org/mailman/listinfo/buildroot
On Wed, Jul 27, 2022 at 5:08 AM Arnout Vandecappelle <arnout@mind.be> wrote: > > > > On 27/07/2022 09:15, James Hilliard wrote: > > 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. > > > > Note that we've removed FOO_NINJA_ENV which may cause issues > > in the unlikely event an external package uses it. > > > > We need to set --pkgconfig.relocatable so that pkg-config files are > > not generated with absolute paths which cause issues with per-package > > directories. > > This still doesn't explain how it is related to using meson rather than ninja. > Are you saying that when calling ninja directly, PPD work perfectly fine, but if > it's installed with meson, it doesn't? Then I'd really like to have a little > more insight into what meson does to break it. Well, the issue seems to be that without --pkgconfig.relocatable meson install messes up the paths during install due to generating absolute pkgconfig paths while ninja doesn't. > > I suspect that the two are actually unrelated, and thus the patches should be > split. > > > > > Remove conflicting host-systemd paths. > > > > Signed-off-by: James Hilliard <james.hilliard1@gmail.com> > > [snip] > > @@ -156,10 +157,20 @@ define $(2)_CONFIGURE_CMDS > > mkdir -p $$($$(PKG)_SRCDIR)/build > > $$(HOST_CONFIGURE_OPTS) \ > > $$($$(PKG)_CONF_ENV) $$(MESON) \ > > + --pkgconfig.relocatable \ > > --prefix=$$(HOST_DIR) \ > > - --libdir=lib \ > > - --sysconfdir=$$(HOST_DIR)/etc \ > > + --bindir=$$(HOST_DIR)/bin \ > > bindir defaults to "bin", which means things will be installed in <prefix>/bin > and references to bindir in pkgconfig will use <prefix>/bin absolute paths as > well (actually, as ${prefix}/bin). How does pkgconfig.relocatable change things > that we suddenly need to override the default with an absolute path? From my understanding pkgconfig.relocatable tells meson to calculate pkgconf paths relative to the prefix, so things work when both the prefix and bindir are set to absolute paths that produce the right relative paths when meson resolves the paths against each other during pkgconfig generation. > > > + --datadir=$$(HOST_DIR)/share \ > > + --includedir=$$(HOST_DIR)/include \ > > + --infodir=$$(HOST_DIR)/share/info \ > > + --libdir=$$(HOST_DIR)/lib \ > > + --libexecdir=$$(HOST_DIR)/libexec \ > > + --localedir=$$(HOST_DIR)/share/locale \ > > --localstatedir=$$(HOST_DIR)/var \ > > + --mandir=$$(HOST_DIR)/share/man \ > > + --sbindir=$$(HOST_DIR)/sbin \ > > + --sharedstatedir=$$(HOST_DIR)/com \ > > + --sysconfdir=$$(HOST_DIR)/etc \ > > --default-library=shared \ > > --buildtype=release \ > > --wrap-mode=nodownload \ > > @@ -179,13 +190,23 @@ $(2)_DEPENDENCIES += host-meson > > ifndef $(2)_BUILD_CMDS > > ifeq ($(4),target) > > define $(2)_BUILD_CMDS > > - $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ > > - $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build > > + $$(TARGET_MAKE_ENV) \ > > + $$($$(PKG)_MESON_ENV) \ > > + $$(MESON) \ > > + compile \ > > + $$(MESON_BUILD_OPTS) \ > > + $$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \ > > + -C $$($$(PKG)_SRCDIR)/build > > endef > > else > > define $(2)_BUILD_CMDS > > - $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ > > - $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build > > + $$(HOST_MAKE_ENV) \ > > + $$($$(PKG)_MESON_ENV) \ > > + $$(MESON) \ > > + compile \ > > + $$(MESON_BUILD_OPTS) \ > > + $$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \ > > + -C $$($$(PKG)_SRCDIR)/build > > endef > > endif > > endif > > @@ -196,8 +217,12 @@ endif > > # > > ifndef $(2)_INSTALL_CMDS > > define $(2)_INSTALL_CMDS > > - $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ > > - $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install > > + $$(HOST_MAKE_ENV) \ > > + $$($$(PKG)_MESON_ENV) \ > > + $$(MESON) \ > > + install \ > > + $$(MESON_INSTALL_OPTS) \ > > + -C $$($$(PKG)_SRCDIR)/build > > Why is there a --ninja-args in the build but not in the install? > > > endef > > endif > > > > @@ -207,8 +232,13 @@ 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 > > + $$(TARGET_MAKE_ENV) \ > > + $$($$(PKG)_MESON_ENV) \ > > + $$(MESON) \ > > + install \ > > + $$(MESON_INSTALL_OPTS) \ > > + --destdir $$(STAGING_DIR) \ > > + -C $$($$(PKG)_SRCDIR)/build > > endef > > endif > > > > @@ -218,8 +248,13 @@ 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 > > + $$(TARGET_MAKE_ENV) \ > > + $$($$(PKG)_MESON_ENV) \ > > + $$(MESON) \ > > + install \ > > + $$(MESON_INSTALL_OPTS) \ > > + --destdir $$(TARGET_DIR) \ > > + -C $$($$(PKG)_SRCDIR)/build > > endef > > endif > > > > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > > index 47aaddf849..6efc8d636f 100644 > > --- a/package/systemd/systemd.mk > > +++ b/package/systemd/systemd.mk > > @@ -749,7 +749,7 @@ endef > > SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_PRESET_ALL > > > > SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) > > -SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) > > +SYSTEMD_MESON_ENV = $(HOST_UTF8_LOCALE_ENV) > > > > define SYSTEMD_LINUX_CONFIG_FIXUPS > > $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS) > > @@ -777,10 +777,7 @@ endef > > HOST_SYSTEMD_CONF_OPTS = \ > > -Dsplit-bin=true \ > > -Dsplit-usr=false \ > > - --prefix=/usr \ > > - --libdir=lib \ > > - --sysconfdir=/etc \ > > - --localstatedir=/var \ > > + -Drootprefix=$(HOST_DIR) \ > > This change looks like something we can apply independently of the rest of the > seris as well. It looks like a much better way of handling the special case of > systemd. However, I'd like a much more detailed explanation about why this works > now but didn't work in commit 35c11a027c88a3c943554eefbbed051fd2d98a50. That > commit has an extensive explanation of the reasoning. Hmm, I'll look into this more. > > Regards, > Arnout > > > -Dmode=release \ > > -Dutmp=false \ > > -Dhibernate=false \ > > @@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \ > > host-gperf \ > > host-python-jinja2 > > > > -HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR) > > - > > # Fix RPATH After installation > > # * systemd provides a install_rpath instruction to meson because the binaries > > # need to link with libsystemd which is not in a standard path
James, All, On 2022-07-27 12:33 -0600, James Hilliard spake thusly: > On Wed, Jul 27, 2022 at 5:08 AM Arnout Vandecappelle <arnout@mind.be> wrote: > > On 27/07/2022 09:15, James Hilliard wrote: [--SNIP--] > > > We need to set --pkgconfig.relocatable so that pkg-config files are > > > not generated with absolute paths which cause issues with per-package > > > directories. > > This still doesn't explain how it is related to using meson rather than ninja. > > Are you saying that when calling ninja directly, PPD work perfectly fine, but if > > it's installed with meson, it doesn't? Then I'd really like to have a little > > more insight into what meson does to break it. > Well, the issue seems to be that without --pkgconfig.relocatable meson install > messes up the paths during install due to generating absolute pkgconfig paths > while ninja doesn't. But does that actually causes any real issue and build breakage? For the non-PPD case, that should not be an issue, as the HOST_DIR (and STAGING_DIR, below it) are constant throughout the build. For the PPD case, we have a prepare hook that fixes the paths in all text files, see b06294e9897e (core/pkg-generic: fixup all PPD paths in a generic fashion). So this should be covered. For the SDK, there is a script that does something very similar to the PPD case, so again there should be no issue. What is it that you actually want to achieve with relative paths, that is currently broken with absolute paths? Regards, Yann E. MORIN.
On Wed, Jul 27, 2022 at 5:25 AM Yann E. MORIN <yann.morin.1998@free.fr> wrote: > > James, All, > > On 2022-07-27 01:15 -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. > [--SNIP--] > > diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk > > index 47aaddf849..6efc8d636f 100644 > > --- a/package/systemd/systemd.mk > > +++ b/package/systemd/systemd.mk > [--SNIP--] > > @@ -777,10 +777,7 @@ endef > > HOST_SYSTEMD_CONF_OPTS = \ > > -Dsplit-bin=true \ > > -Dsplit-usr=false \ > > - --prefix=/usr \ > > - --libdir=lib \ > > - --sysconfdir=/etc \ > > - --localstatedir=/var \ > > + -Drootprefix=$(HOST_DIR) \ > > Have you read the explanations in 35c11a027c8 (package/systemd: add host > variant)? This change must expand on how it does not break things, with > a very good and detailed commit log, and as a separate patch. > > Also, if the HOST_SYSTEMD_FIX_RPATH hook still needed, then? Well I think I did find a way to remove that: https://patchwork.ozlabs.org/project/buildroot/patch/20220727221055.1838031-1-james.hilliard1@gmail.com/ > > Regards, > Yann E. MORIN. > > > -Dutmp=false \ > > -Dhibernate=false \ > > @@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \ > > host-gperf \ > > host-python-jinja2 > > > > -HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR) > > - > > # Fix RPATH After installation > > # * systemd provides a install_rpath instruction to meson because the binaries > > # need to link with libsystemd which is not in a standard path > > -- > > 2.34.1 > > > > _______________________________________________ > > buildroot mailing list > > buildroot@buildroot.org > > https://lists.buildroot.org/mailman/listinfo/buildroot > > -- > .-----------------.--------------------.------------------.--------------------. > | 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. | > '------------------------------^-------^------------------^--------------------'
On Wed, Jul 27, 2022 at 1:19 PM Yann E. MORIN <yann.morin.1998@free.fr> wrote: > > James, All, > > On 2022-07-27 12:33 -0600, James Hilliard spake thusly: > > On Wed, Jul 27, 2022 at 5:08 AM Arnout Vandecappelle <arnout@mind.be> wrote: > > > On 27/07/2022 09:15, James Hilliard wrote: > [--SNIP--] > > > > We need to set --pkgconfig.relocatable so that pkg-config files are > > > > not generated with absolute paths which cause issues with per-package > > > > directories. > > > This still doesn't explain how it is related to using meson rather than ninja. > > > Are you saying that when calling ninja directly, PPD work perfectly fine, but if > > > it's installed with meson, it doesn't? Then I'd really like to have a little > > > more insight into what meson does to break it. > > Well, the issue seems to be that without --pkgconfig.relocatable meson install > > messes up the paths during install due to generating absolute pkgconfig paths > > while ninja doesn't. > > But does that actually causes any real issue and build breakage? Appears to break when using meson's install. > > For the non-PPD case, that should not be an issue, as the HOST_DIR (and > STAGING_DIR, below it) are constant throughout the build. > > For the PPD case, we have a prepare hook that fixes the paths in all > text files, see b06294e9897e (core/pkg-generic: fixup all PPD paths in a > generic fashion). So this should be covered. > > For the SDK, there is a script that does something very similar to the > PPD case, so again there should be no issue. > > What is it that you actually want to achieve with relative paths, that > is currently broken with absolute paths? Looks like the relocatable format works fine without meson's install: https://patchwork.ozlabs.org/project/buildroot/patch/20220728014402.142320-2-james.hilliard1@gmail.com/ Although the cmake prefix fix is also needed: https://patchwork.ozlabs.org/project/buildroot/patch/20220728014402.142320-1-james.hilliard1@gmail.com/ > > 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. | > '------------------------------^-------^------------------^--------------------'
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. * +FOO_NINJA_OPTS+, to specify a space-separated list of targets to build. By diff --git a/package/gobject-introspection/gobject-introspection.mk b/package/gobject-introspection/gobject-introspection.mk index 41d64171a7..ea5100247d 100644 --- a/package/gobject-introspection/gobject-introspection.mk +++ b/package/gobject-introspection/gobject-introspection.mk @@ -30,14 +30,14 @@ HOST_GOBJECT_INTROSPECTION_DEPENDENCIES = \ host-python3 # g-ir-scanner will default to /usr/bin/ld for linking if this is not set. -GOBJECT_INTROSPECTION_NINJA_ENV += \ +GOBJECT_INTROSPECTION_MESON_ENV += \ CC="$(TARGET_CC)" # When building, gobject-introspection uses tools/g-ir-scanner to build several # .gir and .typelib files. g-ir-scanner does not use LDFLAGS, and by default, # links to the system-installed libglib2 path. To remedy this issue, defining # LD_LIBRARY_PATH forces g-ir-scanner to use our host installed libglib2 files. -HOST_GOBJECT_INTROSPECTION_NINJA_ENV += \ +HOST_GOBJECT_INTROSPECTION_MESON_ENV += \ LD_LIBRARY_PATH="$(if $(LD_LIBRARY_PATH),$(LD_LIBRARY_PATH):)$(HOST_DIR)/lib" # Use the host gi-scanner to prevent the scanner from generating incorrect diff --git a/package/pkg-meson.mk b/package/pkg-meson.mk index 0835e08e3a..ffa1f662a9 100644 --- a/package/pkg-meson.mk +++ b/package/pkg-meson.mk @@ -21,13 +21,13 @@ ################################################################################ # -# Pass PYTHONNOUSERSITE environment variable when invoking Meson or Ninja, so +# Pass PYTHONNOUSERSITE environment variable when invoking Meson, so # $(HOST_DIR)/bin/python3 will not look for Meson modules in # $HOME/.local/lib/python3.x/site-packages # -MESON = PYTHONNOUSERSITE=y $(HOST_DIR)/bin/meson -NINJA = PYTHONNOUSERSITE=y $(HOST_DIR)/bin/ninja -NINJA_OPTS = $(if $(VERBOSE),-v) +MESON = PYTHONNOUSERSITE=y $(HOST_DIR)/bin/meson +MESON_BUILD_OPTS = $(if $(VERBOSE),-v) +MESON_INSTALL_OPTS = --no-rebuild # https://mesonbuild.com/Reference-tables.html#cpu-families ifeq ($(BR2_arcle)$(BR2_arceb),y) @@ -136,6 +136,7 @@ define $(2)_CONFIGURE_CMDS CXX_FOR_BUILD="$$(HOSTCXX)" \ $$($$(PKG)_CONF_ENV) \ $$(MESON) \ + --pkgconfig.relocatable \ --prefix=/usr \ --libdir=lib \ --default-library=$(if $(BR2_STATIC_LIBS),static,shared) \ @@ -156,10 +157,20 @@ define $(2)_CONFIGURE_CMDS mkdir -p $$($$(PKG)_SRCDIR)/build $$(HOST_CONFIGURE_OPTS) \ $$($$(PKG)_CONF_ENV) $$(MESON) \ + --pkgconfig.relocatable \ --prefix=$$(HOST_DIR) \ - --libdir=lib \ - --sysconfdir=$$(HOST_DIR)/etc \ + --bindir=$$(HOST_DIR)/bin \ + --datadir=$$(HOST_DIR)/share \ + --includedir=$$(HOST_DIR)/include \ + --infodir=$$(HOST_DIR)/share/info \ + --libdir=$$(HOST_DIR)/lib \ + --libexecdir=$$(HOST_DIR)/libexec \ + --localedir=$$(HOST_DIR)/share/locale \ --localstatedir=$$(HOST_DIR)/var \ + --mandir=$$(HOST_DIR)/share/man \ + --sbindir=$$(HOST_DIR)/sbin \ + --sharedstatedir=$$(HOST_DIR)/com \ + --sysconfdir=$$(HOST_DIR)/etc \ --default-library=shared \ --buildtype=release \ --wrap-mode=nodownload \ @@ -179,13 +190,23 @@ $(2)_DEPENDENCIES += host-meson ifndef $(2)_BUILD_CMDS ifeq ($(4),target) define $(2)_BUILD_CMDS - $$(TARGET_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ - $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build + $$(TARGET_MAKE_ENV) \ + $$($$(PKG)_MESON_ENV) \ + $$(MESON) \ + compile \ + $$(MESON_BUILD_OPTS) \ + $$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \ + -C $$($$(PKG)_SRCDIR)/build endef else define $(2)_BUILD_CMDS - $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ - $$(NINJA) $$(NINJA_OPTS) $$($$(PKG)_NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build + $$(HOST_MAKE_ENV) \ + $$($$(PKG)_MESON_ENV) \ + $$(MESON) \ + compile \ + $$(MESON_BUILD_OPTS) \ + $$(if $$($$(PKG)_NINJA_OPTS),--ninja-args $$($$(PKG)_NINJA_OPTS)) \ + -C $$($$(PKG)_SRCDIR)/build endef endif endif @@ -196,8 +217,12 @@ endif # ifndef $(2)_INSTALL_CMDS define $(2)_INSTALL_CMDS - $$(HOST_MAKE_ENV) $$($$(PKG)_NINJA_ENV) \ - $$(NINJA) $$(NINJA_OPTS) -C $$($$(PKG)_SRCDIR)/build install + $$(HOST_MAKE_ENV) \ + $$($$(PKG)_MESON_ENV) \ + $$(MESON) \ + install \ + $$(MESON_INSTALL_OPTS) \ + -C $$($$(PKG)_SRCDIR)/build endef endif @@ -207,8 +232,13 @@ 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 + $$(TARGET_MAKE_ENV) \ + $$($$(PKG)_MESON_ENV) \ + $$(MESON) \ + install \ + $$(MESON_INSTALL_OPTS) \ + --destdir $$(STAGING_DIR) \ + -C $$($$(PKG)_SRCDIR)/build endef endif @@ -218,8 +248,13 @@ 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 + $$(TARGET_MAKE_ENV) \ + $$($$(PKG)_MESON_ENV) \ + $$(MESON) \ + install \ + $$(MESON_INSTALL_OPTS) \ + --destdir $$(TARGET_DIR) \ + -C $$($$(PKG)_SRCDIR)/build endef endif diff --git a/package/systemd/systemd.mk b/package/systemd/systemd.mk index 47aaddf849..6efc8d636f 100644 --- a/package/systemd/systemd.mk +++ b/package/systemd/systemd.mk @@ -749,7 +749,7 @@ endef SYSTEMD_ROOTFS_PRE_CMD_HOOKS += SYSTEMD_PRESET_ALL SYSTEMD_CONF_ENV = $(HOST_UTF8_LOCALE_ENV) -SYSTEMD_NINJA_ENV = $(HOST_UTF8_LOCALE_ENV) +SYSTEMD_MESON_ENV = $(HOST_UTF8_LOCALE_ENV) define SYSTEMD_LINUX_CONFIG_FIXUPS $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS) @@ -777,10 +777,7 @@ endef HOST_SYSTEMD_CONF_OPTS = \ -Dsplit-bin=true \ -Dsplit-usr=false \ - --prefix=/usr \ - --libdir=lib \ - --sysconfdir=/etc \ - --localstatedir=/var \ + -Drootprefix=$(HOST_DIR) \ -Dmode=release \ -Dutmp=false \ -Dhibernate=false \ @@ -852,8 +849,6 @@ HOST_SYSTEMD_DEPENDENCIES = \ host-gperf \ host-python-jinja2 -HOST_SYSTEMD_NINJA_ENV = DESTDIR=$(HOST_DIR) - # Fix RPATH After installation # * systemd provides a install_rpath instruction to meson because the binaries # need to link with libsystemd which is not in a standard path
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. Note that we've removed FOO_NINJA_ENV which may cause issues in the unlikely event an external package uses it. We need to set --pkgconfig.relocatable so that pkg-config files are not generated with absolute paths which cause issues with per-package directories. Remove conflicting host-systemd paths. Signed-off-by: James Hilliard <james.hilliard1@gmail.com> --- Changes v4 -> v5: - don't set destdir for host install Changes v3 -> v4: - split out cmake fix - cleanup config vars - clearify commit message Changes v2 -> v3: - set pkgconfig to relocatable - set cmake pkg-config prefix path Changes v1 -> v2: - update docs --- docs/manual/adding-packages-meson.txt | 4 +- .../gobject-introspection.mk | 4 +- package/pkg-meson.mk | 67 ++++++++++++++----- package/systemd/systemd.mk | 9 +-- 4 files changed, 57 insertions(+), 27 deletions(-)