allow build infrastructure to pick up installed meson tool
This is v3 of the patchset, only patch 1 got modifications.
Patch 1 will install a cross-compilation.conf as part of the toolchain target, removing this logic from the meson package.
Patch 2 + Patch 3 allow picking up meson + ninja from the system, this functionality is currently disabled.
Patch 4 moves some common functionality of the support tool handling into a helper script.
[v2->v3]
- rebase - support overriding [C,CXX,LD]FLAGS in package - place most logic into a HOST_MESON_CROSSCONFIG_SED variable - further refactoring and simplification
PATCH 1/4 package/pkg-meson: move crosscompilation support out of package
install the cross-compilation.conf file when setting up the staging area, not as part of host-meson.
This allows external usage of the buildroot toolchain through meson.
Remove a few variables, as they were only used to communicate between meson package and pkg-meson.
---
package/meson/meson.mk | 60 ------------
package/pkg-meson.mk | 92 +++++++++++++++----
.../misc}/cross-compilation.conf.in | 0
3 files changed, 72 insertions(+), 80 deletions(-)
rename {package/meson => support/misc}/cross-compilation.conf.in (100%)package/meson/meson.mk +0 -60
@@ -13,64 +13,4 @@ MESON_SETUP_TYPE = setuptools HOST_MESON_DEPENDENCIES = host-ninja HOST_MESON_NEEDS_HOST_PYTHON = python3 -HOST_MESON_TARGET_ENDIAN = $(call LOWERCASE,$(BR2_ENDIAN)) -HOST_MESON_TARGET_CPU = $(GCC_TARGET_CPU) - -# https://mesonbuild.com/Reference-tables.html#cpu-families -ifeq ($(BR2_arcle)$(BR2_arceb),y) -HOST_MESON_TARGET_CPU_FAMILY = arc -else ifeq ($(BR2_arm)$(BR2_armeb),y) -HOST_MESON_TARGET_CPU_FAMILY = arm -else ifeq ($(BR2_aarch64)$(BR2_aarch64_be),y) -HOST_MESON_TARGET_CPU_FAMILY = aarch64 -else ifeq ($(BR2_i386),y) -HOST_MESON_TARGET_CPU_FAMILY = x86 -else ifeq ($(BR2_mips)$(BR2_mipsel),y) -HOST_MESON_TARGET_CPU_FAMILY = mips -else ifeq ($(BR2_mips64)$(BR2_mips64el),y) -HOST_MESON_TARGET_CPU_FAMILY = mips64 -else ifeq ($(BR2_powerpc),y) -HOST_MESON_TARGET_CPU_FAMILY = ppc -else ifeq ($(BR2_powerpc64)$(BR2_powerpc64le),y) -HOST_MESON_TARGET_CPU_FAMILY = ppc64 -else ifeq ($(BR2_riscv),y) -HOST_MESON_TARGET_CPU_FAMILY = riscv64 -else ifeq ($(BR2_sparc),y) -HOST_MESON_TARGET_CPU_FAMILY = sparc -else ifeq ($(BR2_sparc64),y) -HOST_MESON_TARGET_CPU_FAMILY = sparc64 -else ifeq ($(BR2_x86_64),y) -HOST_MESON_TARGET_CPU_FAMILY = x86_64 -else -HOST_MESON_TARGET_CPU_FAMILY = $(ARCH) -endif - -HOST_MESON_SED_CFLAGS = $(if $(strip $(TARGET_CFLAGS)),`printf '"%s"$(comma) ' $(TARGET_CFLAGS)`) -HOST_MESON_SED_LDFLAGS = $(if $(strip $(TARGET_LDFLAGS)),`printf '"%s"$(comma) ' $(TARGET_LDFLAGS)`) -HOST_MESON_SED_CXXFLAGS = $(if $(strip $(TARGET_CXXFLAGS)),`printf '"%s"$(comma) ' $(TARGET_CXXFLAGS)`) - -# Generate a Meson cross-compilation.conf suitable for use with the -# SDK; also install the file as a template for users to add their -# own flags if they need to. -define HOST_MESON_INSTALL_CROSS_CONF - mkdir -p $(HOST_DIR)/etc/meson - sed -e "s%@TARGET_CROSS@%$(TARGET_CROSS)%g" \ - -e "s%@TARGET_ARCH@%$(HOST_MESON_TARGET_CPU_FAMILY)%g" \ - -e "s%@TARGET_CPU@%$(HOST_MESON_TARGET_CPU)%g" \ - -e "s%@TARGET_ENDIAN@%$(HOST_MESON_TARGET_ENDIAN)%g" \ - -e "s%@TARGET_CFLAGS@%$(HOST_MESON_SED_CFLAGS)@PKG_TARGET_CFLAGS@%g" \ - -e "s%@TARGET_LDFLAGS@%$(HOST_MESON_SED_LDFLAGS)@PKG_TARGET_CFLAGS@%g" \ - -e "s%@TARGET_CXXFLAGS@%$(HOST_MESON_SED_CXXFLAGS)@PKG_TARGET_CFLAGS@%g" \ - -e "s%@HOST_DIR@%$(HOST_DIR)%g" \ - $(HOST_MESON_PKGDIR)/cross-compilation.conf.in \ - > $(HOST_DIR)/etc/meson/cross-compilation.conf.in - sed -e "s%@PKG_TARGET_CFLAGS@%%g" \ - -e "s%@PKG_TARGET_LDFLAGS@%%g" \ - -e "s%@PKG_TARGET_CXXFLAGS@%%g" \ - $(HOST_DIR)/etc/meson/cross-compilation.conf.in \ - > $(HOST_DIR)/etc/meson/cross-compilation.conf -endef - -TARGET_FINALIZE_HOOKS += HOST_MESON_INSTALL_CROSS_CONF - $(eval $(host-python-package))
package/pkg-meson.mk +72 -20
107 lines not on this page · raw message
support/misc/cross-compilation.conf.in renamed from package/meson/cross-compilation.conf.in +0 -0
Signature · 1 line
2.23.0
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
In reply to Norbert LangeAutomatically check for an available meson tool,
and use it as long as the version is fitting.
Using a system provided meson is not an official supported option, hence this is currently disabled.
use of the system provided meson can be enforced with:
make ... BR2_MESON_VERSION_MIN=0
--- package/pkg-meson.mk | 4 +-- support/dependencies/check-host-meson.mk | 15 ++++++++ support/dependencies/check-host-meson.sh | 45 ++++++++++++++++++++++++ 3 files changed, 62 insertions(+), 2 deletions(-) create mode 100644 support/dependencies/check-host-meson.mk create mode 100755 support/dependencies/check-host-meson.sh
package/pkg-meson.mk +2 -2
@@ -25,7 +25,7 @@ # $(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 +MESON = PYTHONNOUSERSITE=y $(BR2_MESON) NINJA = PYTHONNOUSERSITE=y $(HOST_DIR)/bin/ninja NINJA_OPTS = $(if $(VERBOSE),-v) -j$(PARALLEL_JOBS)
@@ -99,7 +99,7 @@ endef endif endif -$(2)_DEPENDENCIES += host-meson +$(2)_DEPENDENCIES += $(BR2_MESON_HOST_DEPENDENCY) # # Build step. Only define it if not already defined by the package .mk
support/dependencies/check-host-meson.mk new file +15 -0
@@ -0,0 +1,15 @@ +# Set this to a valid version like 0.49, depending on the highest minimum +# version required by any of the packages bundled in Buildroot. +# An empty version will never match a system executable +# +# BR2_MESON_VERSION_MIN = 0.49 + +BR2_MESON_CANDIDATES ?= meson +BR2_MESON ?= $(call suitable-host-package,meson,\ + $(BR2_MESON_VERSION_MIN) $(BR2_MESON_CANDIDATES)) +ifeq ($(BR2_MESON),) +BR2_MESON = $(HOST_DIR)/bin/meson +BR2_MESON_HOST_DEPENDENCY = host-meson host-ninja +else +BR2_MESON_HOST_DEPENDENCY = host-ninja +endif
support/dependencies/check-host-meson.sh new file +45 -0
45 lines not on this page · raw message
--
2.23.0
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
Hello Norbert
Quoted 10 lines · On Wed, 16 Oct 2019 13:19:25 +0200 Norbert Lange <[email protected]> wrote:
Automatically check for an available meson tool,
and use it as long as the version is fitting.Using a system provided meson is not an official supported option, hence this is currently disabled.
use of the system provided meson can be enforced with:make ... BR2_MESON_VERSION_MIN=0Signed-off-by Norbert Lange <[email protected]>
Thanks for this, however I don't think we will ever merge this until a system-provided meson can effectively be used.
What about working on merging 0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch to upstream Meson, in this form or another form ? This would definitely pave the way to using the system-provided Meson.
Another (more useful ?) thing to look at: is it possible to use the system-provided Python for Meson and Ninja, when python3 is provided by the system ? I think Meson and Ninja by themselves are not long at all to build, and it would be a much more useful direction for this patch series.
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
Am Mi., 16. Okt. 2019 um 15:48 Uhr schrieb Thomas Petazzoni <[email protected]>:
Quoted 13 lines
Hello Norbert
Quoted 7 lines · On Wed, 16 Oct 2019 13:19:25 +0200 Norbert Lange <[email protected]> wrote:
Automatically check for an available meson tool,
and use it as long as the version is fitting.Using a system provided meson is not an official supported option, hence this is currently disabled.
use of the system provided meson can be enforced with:
Quoted 6 lines
Quoted 3 lines
make ... BR2_MESON_VERSION_MIN=0Signed-off-by Norbert Lange <[email protected]>Thanks for this, however I don't think we will ever merge this until a system-provided meson can effectively be used.
Well I do effectively use it, meson and its dependencies multiply my build-time, builds systemd and my libfuse3 package fine.
Patch #1 is a freestanding improvement, I hope there arent issues with merging at least that one?
Quoted 4 lines
What about working on merging 0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch to upstream Meson, in this form or another form ? This would definitely pave the way to using the system-provided Meson.
I'm in no way involved with meson, AFAIK this was proposed for upstream already?
Quoted 5 lines
Another (more useful ?) thing to look at: is it possible to use the system-provided Python for Meson and Ninja, when python3 is provided by the system ? I think Meson and Ninja by themselves are not long at all to build, and it would be a much more useful direction for this patch series.
Define "useful". The patches work correctly for me (tm), and I dont use more than
1000 included packages that are useless for me (tm). Even if meson is not ready (again: it is for me), then improving buildroot ahead of it
causes no harm?
If I were cynical, Id say I prefer spending time porting packages to CMake rather than trying to fix meson.
regards Norbert.
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
Hello,
Quoted 8 lines · On Wed, 16 Oct 2019 18:28:02 +0200 Norbert Lange <[email protected]> wrote:
Quoted 2 lines
Thanks for this, however I don't think we will ever merge this until a system-provided meson can effectively be used.
Well I do effectively use it, meson and its dependencies multiply my build-time, builds systemd and my libfuse3 package fine.
Patch #1 is a freestanding improvement, I hope there arent issues with merging at least that one?
Yes, of course PATCH 1/4 is totally independent from this discussion, and can/will be considered separately. I looked at it briefly, I haven't made up my mind yet, but I agree it is completely separate.
Quoted 6 lines
Quoted 4 lines
What about working on merging 0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch to upstream Meson, in this form or another form ? This would definitely pave the way to using the system-provided Meson.
I'm in no way involved with meson, AFAIK this was proposed for upstream already?
You don't have to be involved with Meson to work on it. Many of us regularly contribute patches to upstream projects without being involved in any way with those projects.
Quoted 10 lines
Quoted 5 lines
Another (more useful ?) thing to look at: is it possible to use the system-provided Python for Meson and Ninja, when python3 is provided by the system ? I think Meson and Ninja by themselves are not long at all to build, and it would be a much more useful direction for this patch series.
Define "useful". The patches work correctly for me (tm), and I dont use more than 1000 included packages that are useless for me (tm). Even if meson is not ready (again: it is for me), then improving buildroot ahead of it causes no harm?
Because today meson requires a Buildroot patch, and in fact what really adds to the build time is not building host-meson or host-ninja, but really the fact that it requires the build of host-python3. And Python 3.x is now widely available on most build machines. So the idea would be, instead of relying on system-provided meson/ninja, to still build our own meson/ninja, but really the system-provided python3.
Quoted 2 lines
If I were cynical, Id say I prefer spending time porting packages to CMake rather than trying to fix meson.
I don't think the point of this discussion is to decide whether cmake, meson or autotools, or whatever is the best build system.
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
Norbert, Thomas, All,
On 2019-10-16 21:01 +0200, Thomas Petazzoni spake thusly:
Quoted 4 lines
Quoted 2 lines · On Wed, 16 Oct 2019 18:28:02 +0200 Norbert Lange <[email protected]> wrote:
Well I do effectively use it, meson and its dependencies multiply my build-time, builds systemd and my libfuse3 package fine.
So this had me wonder: why do you report that it works for you (and I am ready to believe you), although we do have a patch that you are not using?
Put in other words, I was wondering that, maybe, your report was an indication that our patch was in fact no longer needed, in which case we could drop it and would reconsider your proposal.
So I had to dig a bit on what this patch was doing (it is a relatively simple patch), and why it was needed.
It turns out that the prupose of that patch is to ensure that a host-meson-package that also uses a library installed by one of our other host packages, keeps an RPATH to find that library (instead of not finding it, or of finding the system-provided one).
This is nicely laid out in the git log for our patch:
commit 5c939246a802c0ad9704dac1505105037542a1d3
Author: Eric Le Bihan <[email protected]>
Date: Sat Oct 27 19:59:22 2018 +0200
meson: re-add patch for skipping RPATH fixing
The patch to skip RPATH fixing performed by Meson was removed in commit a03f46ca6e9f43028003aedc92f1a1204ae7480f, as the script support/scripts/check-host-rpath was not complaining anymore.
But without it, the problem still occurs for host packages [1].
So, restore this patch to fix build of host packages with Meson.
[1] http://lists.busybox.net/pipermail/buildroot/2018-October/232956.html
So yes, ther are situations where using a system-provided meson _may_ work, but the generic case is that our patch is still required to ensure that the situatiuon dexribed above still works.
Note that the only package in that situation in upstream Buildroot, is libglib2, so if you don't have that, then you do not have the problem this patch is solving.
So, with those explanations, I hope it is now clearer why we can't rely on the system-provided meson.
Anyway, your proposal was interesting, if at least because it really made us reconsider the usefulness of our patch.
Quoted 9 lines
Quoted 9 lines
Quoted 5 lines
Another (more useful ?) thing to look at: is it possible to use the system-provided Python for Meson and Ninja, when python3 is provided by the system ? I think Meson and Ninja by themselves are not long at all to build, and it would be a much more useful direction for this patch series.
Define "useful". The patches work correctly for me (tm), and I dont use more than 1000 included packages that are useless for me (tm). Even if meson is not ready (again: it is for me), then improving buildroot ahead of it causes no harm?
The case "works for me" is not a valid reason, because as demonstrated above, there are cases where it won't work.
Regards,
Yann E. MORIN.
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
Am Mi., 16. Okt. 2019 um 22:16 Uhr schrieb Yann E. MORIN <[email protected]>:
Quoted 41 lines
Norbert, Thomas, All,
On 2019-10-16 21:01 +0200, Thomas Petazzoni spake thusly:
Quoted 4 lines
Quoted 2 lines · On Wed, 16 Oct 2019 18:28:02 +0200 Norbert Lange <[email protected]> wrote:
Well I do effectively use it, meson and its dependencies multiply my build-time, builds systemd and my libfuse3 package fine.
So this had me wonder: why do you report that it works for you (and I am ready to believe you), although we do have a patch that you are not using?
Put in other words, I was wondering that, maybe, your report was an indication that our patch was in fact no longer needed, in which case we could drop it and would reconsider your proposal.
So I had to dig a bit on what this patch was doing (it is a relatively simple patch), and why it was needed.
It turns out that the prupose of that patch is to ensure that a host-meson-package that also uses a library installed by one of our other host packages, keeps an RPATH to find that library (instead of not finding it, or of finding the system-provided one).
This is nicely laid out in the git log for our patch:
commit
5c939246a802c0ad9704dac1505105037542a1d3
Author: Eric Le Bihan <[email protected]>
Date: Sat Oct 27 19:59:22 2018 +0200meson: re-add patch for skipping RPATH fixing
The patch to skip RPATH fixing performed by Meson was removed in commit
a03f46ca6e9f43028003aedc92f1a1204ae7480f, as the script support/scripts/check-host-rpath was not complaining anymore.But without it, the problem still occurs for host packages [1].
So, restore this patch to fix build of host packages with Meson.
Quoted 8 lines
[1] http://lists.busybox.net/pipermail/buildroot/2018-October/232956.html
Signed-off-by Eric Le Bihan <[email protected]>Signed-off-by Thomas Petazzoni <[email protected]>So yes, ther are situations where using a system-provided meson _may_ work, but the generic case is that our patch is still required to ensure that the situatiuon dexribed above still works.
Yes, you want to be able to build all packages in buildroot without issues. My patch would not change that. You would need to set an variable override to pick up the system meson/ninja.
If upstream is fixed and you are confident nothing breaks, just set that variable
in check-host-meson.mk.
Work done now, tested by users at their own peril now, flipping the switch later. Sounds not so outrageous for me?
Quoted 6 lines
Note that the only package in that situation in upstream Buildroot, is libglib2, so if you don't have that, then you do not have the problem this patch is solving.
So, with those explanations, I hope it is now clearer why we can't rely on the system-provided meson.
Not rely, but add an option that the user can pick up the system meson if he dares to do so.
Quoted 8 lines
Anyway, your proposal was interesting, if at least because it really made us reconsider the usefulness of our patch.
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
Another (more useful ?) thing to look at: is it possible to use the system-provided Python for Meson and Ninja, when python3 is provided by the system ? I think Meson and Ninja by themselves are not long at all to build, and it would be a much more useful direction for this patch series.
Quoted 7 lines
Quoted 4 lines
Quoted 4 lines
Define "useful". The patches work correctly for me (tm), and I dont use more than 1000 included packages that are useless for me (tm). Even if meson is not ready (again: it is for me), then improving buildroot ahead of it causes no harm?
The case "works for me" is not a valid reason, because as demonstrated above, there are cases where it won't work.
As reiterated above, unless you explicitly enable it, those patches will NOT pick up system meson. "Works for me" means there is a valid reason for having the option.
Regards, Norbert
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
Hello Norbert,
Quoted 7 lines · On Wed, 16 Oct 2019 22:31:24 +0200 Norbert Lange <[email protected]> wrote:
Quoted 3 lines
So yes, ther are situations where using a system-provided meson _may_ work, but the generic case is that our patch is still required to ensure that the situatiuon dexribed above still works.
Yes, you want to be able to build all packages in buildroot without issues. My patch would not change that. You would need to set an variable override to pick up the system meson/ninja.
We don't want to have this code that is basically "dead" (because it can only be enabled by tweaking those variables in the environment).
Best regards,
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
Am Mi., 16. Okt. 2019 um 23:08 Uhr schrieb Thomas Petazzoni <[email protected]>:
Quoted 10 lines
Hello Norbert,
Quoted 4 lines · On Wed, 16 Oct 2019 22:31:24 +0200 Norbert Lange <[email protected]> wrote:
Quoted 3 lines
So yes, ther are situations where using a system-provided meson _may_ work, but the generic case is that our patch is still required to ensure that the situatiuon dexribed above still works.
Quoted 6 lines
Quoted 3 lines
Yes, you want to be able to build all packages in buildroot without issues. My patch would not change that. You would need to set an variable override to pick up the system meson/ninja.
We don't want to have this code that is basically "dead" (because it can only be enabled by tweaking those variables in the environment).
Sure then, please look at the other patches and I will respin those you deem useful
regards, Norbert
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
In reply to Thomas PetazzoniAm Mi., 16. Okt. 2019 um 21:01 Uhr schrieb Thomas Petazzoni <[email protected]>:
Quoted 24 lines
Hello,
Quoted 8 lines · On Wed, 16 Oct 2019 18:28:02 +0200 Norbert Lange <[email protected]> wrote:
Quoted 2 lines
Thanks for this, however I don't think we will ever merge this until a system-provided meson can effectively be used.
Well I do effectively use it, meson and its dependencies multiply my build-time, builds systemd and my libfuse3 package fine.
Patch #1 is a freestanding improvement, I hope there arent issues with merging at least that one?
Yes, of course PATCH 1/4 is totally independent from this discussion, and can/will be considered separately. I looked at it briefly, I haven't made up my mind yet, but I agree it is completely separate.
Quoted 5 lines
Quoted 4 lines
What about working on merging 0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch to upstream Meson, in this form or another form ? This would definitely pave the way to using the system-provided Meson.
Quoted 5 lines
Quoted 1 line
I'm in no way involved with meson, AFAIK this was proposed for upstream already?
You don't have to be involved with Meson to work on it. Many of us regularly contribute patches to upstream projects without being involved in any way with those projects.
I don't even know what the issue is, as I use the system meson without troubles, I can however do the other part: prepare BR for using system meson (in the hope that those issues will be sorted out sometime).
Quoted 11 lines
Quoted 10 lines
Quoted 5 lines
Another (more useful ?) thing to look at: is it possible to use the system-provided Python for Meson and Ninja, when python3 is provided by the system ? I think Meson and Ninja by themselves are not long at all to build, and it would be a much more useful direction for this patch series.
Define "useful". The patches work correctly for me (tm), and I dont use more than 1000 included packages that are useless for me (tm). Even if meson is not ready (again: it is for me), then improving buildroot ahead of it causes no harm?
Quoted 6 lines
Because today meson requires a Buildroot patch, and in fact what really adds to the build time is not building host-meson or host-ninja, but really the fact that it requires the build of host-python3. And Python 3.x is now widely available on most build machines. So the idea would be, instead of relying on system-provided meson/ninja, to still build our own meson/ninja, but really the system-provided python3.
I get that you prefer to build meson as only supported option, but why exactly is there a big issue of
preparing a feature (that needs some arcane Variable overrides to enable). I build my meson packages without any trouble (and got a email to rebase my patch, so I don't think I am the only one).
With ninja its even worse as it only needs python for a bootstrap *during build*,
ninja is actually stable and broadly available, means any newer version will work.
Of course meson is currently the only realistic reason for pulling in host-ninja.
All I am saying is that the decision to what tools can be picked from the system seems arbitrary to me. Nowadays you would just use a container with the tools prepared (could even use a patched meson).
Quoted 5 lines
Quoted 2 lines
If I were cynical, Id say I prefer spending time porting packages to CMake rather than trying to fix meson.
I don't think the point of this discussion is to decide whether cmake, meson or autotools, or whatever is the best build system.
Nope, but only one of these needs to be rebuilt every time in buildroot.
Regards, Norbert
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
In reply to Thomas PetazzoniThomas, Norbert, All,
On 2019-10-16 15:48 +0200, Thomas Petazzoni spake thusly:
Quoted 7 lines
Quoted 2 lines · On Wed, 16 Oct 2019 13:19:25 +0200 Norbert Lange <[email protected]> wrote:
Automatically check for an available meson tool,
and use it as long as the version is fitting.Thanks for this, however I don't think we will ever merge this until a system-provided meson can effectively be used.
I do agreee with that.
However, I guess that what Norbert is trying to do, is to build their own meson that they patched with our patch, thus achieving the "system-provided meson is capable" status.
But if we're going that way for meson, why not do the same for all the other host tools we do build? That would be totally unfeasible.
So, I am still not convinced by this feature, until we can at least detect that a system-provided meson is capable, and that we can decide by actually asking that meson (e.g. by checking the version, or dumping its help for options, or whatevs...).
Quoted 10 lines
What about working on merging 0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch to upstream Meson, in this form or another form ? This would definitely pave the way to using the system-provided Meson.
Another (more useful ?) thing to look at: is it possible to use the system-provided Python for Meson and Ninja, when python3 is provided by the system ? I think Meson and Ninja by themselves are not long at all to build, and it would be a much more useful direction for this patch series.
But then, it should be done very carefully: if the hot-python3 must otherwise be built (because something else forcibly depends on it), then our host-meson must also be using that host-python3 too, otherwise, we could end up with a host-meson built with the system-provided python3 but run with our host-python3.
Regards,
Yann E. MORIN.
Quoted 7 lines
Thanks!
Thomas
Signature · 3 lines
Thomas Petazzoni, CTO, Bootlin Embedded Linux and Kernel engineering https://bootlin.com
Signature · 6 lines
.-----------------.--------------------.------------------.--------------------. | 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. | '------------------------------^-------^------------------^--------------------'
PATCH 2/4 prepare build infrastructure to pick up installed meson tool
Am Mi., 16. Okt. 2019 um 18:47 Uhr schrieb Yann E. MORIN <[email protected]>:
Quoted 9 lines
Thomas, Norbert, All,
On 2019-10-16 15:48 +0200, Thomas Petazzoni spake thusly:
Quoted 5 lines
Quoted 2 lines · On Wed, 16 Oct 2019 13:19:25 +0200 Norbert Lange <[email protected]> wrote:
Automatically check for an available meson tool,
and use it as long as the version is fitting.
Quoted 8 lines
Quoted 2 lines
Thanks for this, however I don't think we will ever merge this until a system-provided meson can effectively be used.
I do agreee with that.
However, I guess that what Norbert is trying to do, is to build their own meson that they patched with our patch, thus achieving the "system-provided meson is capable" status.
Actually I use meson from debian testing.
Quoted 2 lines
But if we're going that way for meson, why not do the same for all the other host tools we do build? That would be totally unfeasible.
For those complicated or long to build its useful. You already do that for CMake, several compressors and a few others.
Quoted 4 lines
So, I am still not convinced by this feature, until we can at least detect that a system-provided meson is capable, and that we can decide by actually asking that meson (e.g. by checking the version, or dumping its help for options, or whatevs...).
Again, patch #1 is a freestanding cleanup, hope atleast that is clear for merging?
And the patches never automatically use meson/ninja, but are helpful if a user would decide to cut buildtime (in a scenario where the system tools suffice).
What about if you just want to build a toolchain? I can use this painless from CMake,
as the toolchain.cmake gets installed even if I dont build CMake or have CMake installed.
I would want the same for meson.
Quoted 11 lines
Quoted 10 lines
What about working on merging 0001-Only-fix-RPATH-if-install_rpath-is-not-empty.patch to upstream Meson, in this form or another form ? This would definitely pave the way to using the system-provided Meson.
Another (more useful ?) thing to look at: is it possible to use the system-provided Python for Meson and Ninja, when python3 is provided by the system ? I think Meson and Ninja by themselves are not long at all to build, and it would be a much more useful direction for this patch series.
Quoted 5 lines
But then, it should be done very carefully: if the hot-python3 must otherwise be built (because something else forcibly depends on it), then our host-meson must also be using that host-python3 too, otherwise, we could end up with a host-meson built with the system-provided python3 but run with our host-python3.
Hmm, dont get why using system python is anything better than using cmake, ninja or (a fixed/usable) meson from the system.
regards, Norbert
PATCH 3/4 prepare build infrastructure to pick up installed ninja tool
In reply to Norbert LangeThe only notable use is as dependency from meson, since using the system installed meson is not officially supported, netiher is using a system installed ninja.
a user can force the use of the system installed ninja with
make graph-depends BR2_NINJA_VERSION_MIN=0
--- package/meson/meson.mk | 1 - package/pkg-meson.mk | 2 +- support/dependencies/check-host-meson.mk | 4 +-- support/dependencies/check-host-ninja.mk | 13 +++++++ support/dependencies/check-host-ninja.sh | 45 ++++++++++++++++++++++++ 5 files changed, 61 insertions(+), 4 deletions(-) create mode 100644 support/dependencies/check-host-ninja.mk create mode 100755 support/dependencies/check-host-ninja.sh
package/meson/meson.mk +0 -1
@@ -10,7 +10,6 @@ MESON_LICENSE = Apache-2.0 MESON_LICENSE_FILES = COPYING MESON_SETUP_TYPE = setuptools -HOST_MESON_DEPENDENCIES = host-ninja HOST_MESON_NEEDS_HOST_PYTHON = python3 $(eval $(host-python-package))
package/pkg-meson.mk +1 -1
@@ -26,7 +26,7 @@ # $HOME/.local/lib/python3.x/site-packages # MESON = PYTHONNOUSERSITE=y $(BR2_MESON) -NINJA = PYTHONNOUSERSITE=y $(HOST_DIR)/bin/ninja +NINJA = PYTHONNOUSERSITE=y $(BR2_NINJA) NINJA_OPTS = $(if $(VERBOSE),-v) -j$(PARALLEL_JOBS) ################################################################################
support/dependencies/check-host-meson.mk +2 -2
@@ -9,7 +9,7 @@ BR2_MESON ?= $(call suitable-host-package,meson,\ $(BR2_MESON_VERSION_MIN) $(BR2_MESON_CANDIDATES)) ifeq ($(BR2_MESON),) BR2_MESON = $(HOST_DIR)/bin/meson -BR2_MESON_HOST_DEPENDENCY = host-meson host-ninja +BR2_MESON_HOST_DEPENDENCY = host-meson $(BR2_NINJA_HOST_DEPENDENCY) else -BR2_MESON_HOST_DEPENDENCY = host-ninja +BR2_MESON_HOST_DEPENDENCY = $(BR2_NINJA_HOST_DEPENDENCY) endif
support/dependencies/check-host-ninja.mk new file +13 -0
@@ -0,0 +1,13 @@ +# Set this to a valid version like 1.8.2, depending on the highest +# minimum version required by any of the packages bundled in Buildroot. +# An empty version will never match a system executable +# +# BR2_NINJA_VERSION_MIN = 1.8.2 + +BR2_NINJA_CANDIDATES ?= ninja +BR2_NINJA ?= $(call suitable-host-package,ninja,\ + $(BR2_NINJA_VERSION_MIN) $(BR2_NINJA_CANDIDATES)) +ifeq ($(BR2_NINJA),) +BR2_NINJA = $(HOST_DIR)/bin/ninja +BR2_NINJA_HOST_DEPENDENCY = host-ninja +endif
support/dependencies/check-host-ninja.sh new file +45 -0
45 lines not on this page · raw message
--
2.23.0
PATCH 4/4 support/dependencies: use a helper script for common checks
In reply to Norbert Lange--- support/dependencies/check-host-cmake.sh | 47 +++--------------------- support/dependencies/check-host-make.sh | 39 +++----------------- support/dependencies/check-host-meson.sh | 44 ++-------------------- support/dependencies/check-host-ninja.sh | 44 ++-------------------- support/dependencies/versioncheck.sh | 45 +++++++++++++++++++++++ 5 files changed, 61 insertions(+), 158 deletions(-) create mode 100755 support/dependencies/versioncheck.sh
support/dependencies/check-host-cmake.sh +5 -42
@@ -1,45 +1,8 @@ #!/bin/sh -# prevent shift error -[ $# -lt 2 ] && exit 1 +readversion() { + "$1" --version | + sed -r -e '/.* ([[:digit:]]+\.[[:digit:]]+).*$/!d;' -e 's//\1/' +} -major_min="${1%.*}" -minor_min="${1#*.}" - -shift - -for candidate; do - - # Try to locate the candidate. Discard it if not located. - cmake=`which "${candidate}" 2>/dev/null` - [ -n "${cmake}" ] || continue - - # Extract version X.Y from versions in the form X.Y or X.Y.Z - # with X, Y and Z numbers with one or more digits each, e.g. - # 3.2 -> 3.2 - # 3.2.3 -> 3.2 - # 3.2.42 -> 3.2 - # 3.10 -> 3.10 - # 3.10.4 -> 3.10 - # 3.10.42 -> 3.10 - # Discard the candidate if no version can be obtained - version="$(${cmake} --version \ - |sed -r -e '/.* ([[:digit:]]+\.[[:digit:]]+).*$/!d;' \ - -e 's//\1/' - )" - [ -n "${version}" ] || continue - - major="${version%.*}" - minor="${version#*.}" - - if [ ${major} -gt ${major_min} ]; then - echo "${cmake}" - exit - elif [ ${major} -eq ${major_min} -a ${minor} -ge ${minor_min} ]; then - echo "${cmake}" - exit - fi -done - -# echo nothing: no suitable cmake found -exit 1 +. "$(dirname "$(readlink -e "$0")")"/versioncheck.sh
support/dependencies/check-host-make.sh +5 -34
@@ -1,37 +1,8 @@ #!/bin/sh -# prevent shift error -[ $# -lt 2 ] && exit 1 +readversion() { + "$1" --version 2>&1 | + sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-].*//g' -e '1q' +} -major_min="${1%.*}" -minor_min="${1#*.}" - -shift - -# The host make program is already checked by dependencies.sh but we -# want to check the version number even if Buildroot is able to use -# GNU make >= 3.81 but some packages may require a more recent version. -make="$1" - -# Output of 'make --version' examples: -# GNU Make 4.2.1 -# GNU Make 4.0 -# GNU Make 3.81 -version=`$make --version 2>&1 | sed -e 's/^.* \([0-9\.]\)/\1/g' -e 's/[-\ -].*//g' -e '1q'` - -major=`echo "$version" | cut -d. -f1` -minor=`echo "$version" | cut -d. -f2` - -if [ $major -lt $major_min ]; then - # echo nothing: no suitable make found - exit 1 -fi - -if [ $major -eq $major_min -a $minor -lt $minor_min ]; then - # echo nothing: no suitable make found - exit 1 -fi - -# valid -echo $make +. "$(dirname "$(readlink -e "$0")")"/versioncheck.sh
support/dependencies/check-host-meson.sh +3 -41
48 lines not on this page · raw message
support/dependencies/check-host-ninja.sh +3 -41
48 lines not on this page · raw message
support/dependencies/versioncheck.sh new file +45 -0
45 lines not on this page · raw message
Signature · 1 line
2.23.0