Add support for Meson build
v3 cover Add support for Meson build
This small patch series provides a new build system: Meson.
v2 -> v3:
- bump version to 0.43.0
- re-use github helper
- reword comments in cross-compilation.conf.in
- use $(FOO_CONF_OPTS) in package documentation
v1 -> v2: (J?rg Krause)
- bump to version 0.41.2
- use explicit tarball release instead of github helper
- use explicit sed
- pass BR2_GCC_TARGET_CPU to cross file
Eric Le Bihan (2):
meson: new package
docs/manual: document meson-based packages
docs/manual/adding-packages-meson.txt | 80 +++++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + package/meson/cross-compilation.conf.in | 17 +++++++ package/meson/meson.hash | 2 + package/meson/meson.mk | 31 +++++++++++++ 5 files changed, 132 insertions(+) create mode 100644 docs/manual/adding-packages-meson.txt create mode 100644 package/meson/cross-compilation.conf.in create mode 100644 package/meson/meson.hash create mode 100644 package/meson/meson.mk
--
2.13.6
PATCH v3 1/2 meson: new package
This new package provides the host variant of the Meson Build System, an open source build system meant to be both extremely fast, and as user friendly as possible.
More precisely, Meson creates configuration files for the Ninja build system.
Besides building Meson, it generates a configuration file ("$(HOST_DIR)/etc/meson/cross-compilation.conf") to be used when cross-compiling a Meson-based project.
--- package/meson/cross-compilation.conf.in | 17 +++++++++++++++++ package/meson/meson.hash | 2 ++ package/meson/meson.mk | 31 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 package/meson/cross-compilation.conf.in create mode 100644 package/meson/meson.hash create mode 100644 package/meson/meson.mk
package/meson/cross-compilation.conf.in new file +17 -0
@@ -0,0 +1,17 @@ +# Note: Buildroot's and Meson's terminologies differ about the meaning +# of 'build', 'host' and 'target': +# - Buildroot's 'host' is Meson's 'build' +# - Buildroot's 'target' is Meson's 'host' + +[binaries] +c = '@TARGET_CROSS at gcc' +cpp = '@TARGET_CROSS at g++' +ar = '@TARGET_CROSS at ar' +strip = '@TARGET_CROSS at strip' +pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family ='@TARGET_ARCH@' +cpu = '@TARGET_CPU@' +endian = '@TARGET_ENDIAN@'
package/meson/meson.hash new file +2 -0
@@ -0,0 +1,2 @@ +# Locally generated +sha256 324894427dcd29f6156fe06b046c6ad1b998470714debd7c5705902f21aaaa73 meson-0.43.0.tar.gz
package/meson/meson.mk new file +31 -0
@@ -0,0 +1,31 @@ +################################################################################ +# +# meson +# +################################################################################ + +MESON_VERSION = 0.43.0 +MESON_SITE = $(call github,mesonbuild,meson,$(MESON_VERSION)) +MESON_LICENSE = Apache-2.0 +MESON_LICENSE_FILES = COPYING +MESON_SETUP_TYPE = setuptools + +HOST_MESON_DEPENDENCIES = host-ninja +HOST_MESON_NEEDS_HOST_PYTHON = python3 + +HOST_MESON_TARGET_ENDIAN = $(shell echo $(BR2_ENDIAN) | tr 'A-Z' 'a-z') + +define HOST_MESON_INSTALL_CROSS_CONF + mkdir -p $(HOST_DIR)/etc/meson + sed -e 's;@TARGET_CROSS@;$(TARGET_CROSS);g' \ + -e 's;@TARGET_ARCH@;$(ARCH);g' \ + -e 's;@TARGET_CPU@;$(BR2_GCC_TARGET_CPU);g' \ + -e 's;@TARGET_ENDIAN@;$(HOST_MESON_TARGET_ENDIAN);g' \ + -e 's;@HOST_DIR@;$(HOST_DIR);g' \ + $(HOST_MESON_PKGDIR)/cross-compilation.conf.in \ + > $(HOST_DIR)/etc/meson/cross-compilation.conf +endef + +HOST_MESON_POST_INSTALL_HOOKS += HOST_MESON_INSTALL_CROSS_CONF + +$(eval $(host-python-package))
Signature · 1 line
2.13.6
PATCH v3 1/2 meson: new package
Quoted 33 lines · Eric Le Bihan
This new package provides the host variant of the Meson Build System, an open source build system meant to be both extremely fast, and as user friendly as possible.
More precisely, Meson creates configuration files for the Ninja build system.
Besides building Meson, it generates a configuration file ("$(HOST_DIR)/etc/meson/cross-compilation.conf") to be used when cross-compiling a Meson-based project.
Signed-off-by J?rg Krause <[email protected]>Signed-off-by Eric Le Bihan <[email protected]>--- package/meson/cross-compilation.conf.in | 17 +++++++++++++++++ package/meson/meson.hash | 2 ++ package/meson/meson.mk | 31 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 package/meson/cross-compilation.conf.in create mode 100644 package/meson/meson.hash create mode 100644 package/meson/meson.mkpackage/meson/cross-compilation.conf.in new file +5
-0@@ -0,0 +1,17 @@ +# Note: Buildroot's and Meson's terminologies differ about the meaning +# of 'build', 'host' and 'target': +# - Buildroot's 'host' is Meson's 'build' +# - Buildroot's 'target' is Meson's 'host' +
package/meson/cross-compilation.conf.in line 15
Quoted 10 lines
package/meson/cross-compilation.conf.in new file +10
-0+[binaries] +c = '@TARGET_CROSS at gcc' +cpp = '@TARGET_CROSS at g++' +ar = '@TARGET_CROSS at ar' +strip = '@TARGET_CROSS at strip' +pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family ='@TARGET_ARCH@'
Does meson have the same definition of ARCH as we do? Does it support all our
ARCHes?
package/meson/cross-compilation.conf.in line 17
Quoted 2 lines
package/meson/cross-compilation.conf.in new file +2
-0+cpu = '@TARGET_CPU@' +endian = '@TARGET_ENDIAN@'
I'm completely missing our TARGET_CFLAGS and TARGET_LDFLAGS here. Is there no
way to specify those?
package/meson/meson.hash line 1
Quoted 7 lines
package/meson/meson.hash new file +1
-0@@ -0,0 +1,2 @@ +# Locally generated
You should also verify it against upstream's meson-0.43.0.tar.gz.asc.
Quoted 7 lines
package/meson/meson.hash new file +1
-0+sha256 324894427dcd29f6156fe06b046c6ad1b998470714debd7c5705902f21aaaa73 meson-0.43.0.tar.gzpackage/meson/meson.mk new file +0
-0
package/meson/meson.mk line 8
Quoted 8 lines
package/meson/meson.mk new file +8
-0@@ -0,0 +1,31 @@ +################################################################################ +# +# meson +# +################################################################################ + +MESON_VERSION = 0.43.0 +MESON_SITE = $(call github,mesonbuild,meson,$(MESON_VERSION))
Upstream has an uploaded tarball. In that case, we use the uploaded tarball,
not the autogenerated one. The uploaded tarball is signed, and sometimes it is subtly different (e.g. containing some generated files).
package/meson/meson.mk line 16
Quoted 8 lines
package/meson/meson.mk new file +8
-0+MESON_LICENSE = Apache-2.0 +MESON_LICENSE_FILES = COPYING +MESON_SETUP_TYPE = setuptools + +HOST_MESON_DEPENDENCIES = host-ninja +HOST_MESON_NEEDS_HOST_PYTHON = python3 + +HOST_MESON_TARGET_ENDIAN = $(shell echo $(BR2_ENDIAN) | tr 'A-Z' 'a-z')
$(call LOWERCASE,$(BR2_ENDIAN))
Regards,
Arnout
Quoted 16 lines
package/meson/meson.mk new file +15
-0+ +define HOST_MESON_INSTALL_CROSS_CONF + mkdir -p $(HOST_DIR)/etc/meson + sed -e 's;@TARGET_CROSS@;$(TARGET_CROSS);g' \ + -e 's;@TARGET_ARCH@;$(ARCH);g' \ + -e 's;@TARGET_CPU@;$(BR2_GCC_TARGET_CPU);g' \ + -e 's;@TARGET_ENDIAN@;$(HOST_MESON_TARGET_ENDIAN);g' \ + -e 's;@HOST_DIR@;$(HOST_DIR);g' \ + $(HOST_MESON_PKGDIR)/cross-compilation.conf.in \ + > $(HOST_DIR)/etc/meson/cross-compilation.conf +endef + +HOST_MESON_POST_INSTALL_HOOKS += HOST_MESON_INSTALL_CROSS_CONF + +$(eval $(host-python-package))
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v3 1/2 meson: new package
Hi!
Quoted 39 lines · Arnout Vandecappelle
Quoted 38 lines · Eric Le Bihan
This new package provides the host variant of the Meson Build System, an open source build system meant to be both extremely fast, and as user friendly as possible.
More precisely, Meson creates configuration files for the Ninja build system.
Besides building Meson, it generates a configuration file ("$(HOST_DIR)/etc/meson/cross-compilation.conf") to be used when cross-compiling a Meson-based project.
Signed-off-by J?rg Krause <[email protected]>Signed-off-by Eric Le Bihan <[email protected]>--- package/meson/cross-compilation.conf.in | 17 +++++++++++++++++ package/meson/meson.hash | 2 ++ package/meson/meson.mk | 31 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 package/meson/cross-compilation.conf.in create mode 100644 package/meson/meson.hash create mode 100644 package/meson/meson.mkpackage/meson/cross-compilation.conf.in new file +10
-0@@ -0,0 +1,17 @@ +# Note: Buildroot's and Meson's terminologies differ about the meaning +# of 'build', 'host' and 'target': +# - Buildroot's 'host' is Meson's 'build' +# - Buildroot's 'target' is Meson's 'host' + +[binaries] +c = '@TARGET_CROSS at gcc' +cpp = '@TARGET_CROSS at g++' +ar = '@TARGET_CROSS at ar' +strip = '@TARGET_CROSS at strip'
Quoted 8 lines
package/meson/cross-compilation.conf.in line 15
Quoted 5 lines
package/meson/cross-compilation.conf.in new file +5
-0+pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family ='@TARGET_ARCH@'Does meson have the same definition of ARCH as we do? Does it support all our
ARCHes?
It goes well with the usual suspects (arm, mips, ppc, x86, ...) but I'll have to check for sparc, sh4 and xtensa. If needed, how should I add a restriction, given that there is no Config.in.host?
Quoted 5 lines
package/meson/cross-compilation.conf.in line 17
Quoted 2 lines
package/meson/cross-compilation.conf.in new file +2
-0+cpu = '@TARGET_CPU@' +endian = '@TARGET_ENDIAN@'I'm completely missing our
TARGET_CFLAGSandTARGET_LDFLAGShere. Is there no
way to specify those?
These are to be passed via the c_args, c_link_args parameters in the "properties" section of the cross-compilation configuration file. I will add this.
Quoted 9 lines
package/meson/meson.hash line 1
Quoted 7 lines
package/meson/meson.hash new file +1
-0@@ -0,0 +1,2 @@ +# Locally generatedYou should also verify it against upstream's meson-0.43.0.tar.gz.asc.
Will do!
Quoted 11 lines
Quoted 11 lines
package/meson/meson.hash new file +1
-0+sha256 324894427dcd29f6156fe06b046c6ad1b998470714debd7c5705902f21aaaa73 meson-0.43.0.tar.gzpackage/meson/meson.mk new file +4
-0@@ -0,0 +1,31 @@ +################################################################################ +# +# meson +#
Quoted 8 lines
package/meson/meson.mk line 8
Quoted 4 lines
package/meson/meson.mk new file +4
-0+################################################################################ + +MESON_VERSION = 0.43.0 +MESON_SITE = $(call github,mesonbuild,meson,$(MESON_VERSION))Upstream has an uploaded tarball. In that case, we use the uploaded tarball,
not the autogenerated one. The uploaded tarball is signed, and sometimes it is subtly different (e.g. containing some generated files).
Of course! It is mentionned in docs/manual/adding-packages-tips.txt. I should re-read the manual more often...
Quoted 10 lines
package/meson/meson.mk line 16
Quoted 8 lines
package/meson/meson.mk new file +8
-0+MESON_LICENSE = Apache-2.0 +MESON_LICENSE_FILES = COPYING +MESON_SETUP_TYPE = setuptools + +HOST_MESON_DEPENDENCIES = host-ninja +HOST_MESON_NEEDS_HOST_PYTHON = python3 + +HOST_MESON_TARGET_ENDIAN = $(shell echo $(BR2_ENDIAN) | tr 'A-Z' 'a-z')$(call LOWERCASE,$(BR2_ENDIAN))
Will do!
BTW, the value of the "c_args" parameter in the "properties" section of the cross-compilation configuration file is formatted as follow:
``` [properties] c_args = ['foo', 'bar', 'baz'] ```
$(TARGET_CFLAGS) is a string like "foo bar baz". To convert it, is the following OK?
```
qlist = $(shell echo $(1) | sed -e "s/[^ ][^ ]*/'&',/g")
sed -e "s;@TARGET_CFLAGS@;$(call qlist,$(TARGET_CFLAGS));g" \
$(HOST_MESON_PKGDIR)/cross-compilation.conf.in \
> $(HOST_DIR)/etc/meson/cross-compilation.conf
```Regards,
--
ELB
PATCH v3 1/2 meson: new package
Quoted 51 lines · Eric Le Bihan
Hi!
Quoted 39 lines · Arnout Vandecappelle
Quoted 38 lines · Eric Le Bihan
This new package provides the host variant of the Meson Build System, an open source build system meant to be both extremely fast, and as user friendly as possible.
More precisely, Meson creates configuration files for the Ninja build system.
Besides building Meson, it generates a configuration file ("$(HOST_DIR)/etc/meson/cross-compilation.conf") to be used when cross-compiling a Meson-based project.
Signed-off-by J?rg Krause <[email protected]>Signed-off-by Eric Le Bihan <[email protected]>--- package/meson/cross-compilation.conf.in | 17 +++++++++++++++++ package/meson/meson.hash | 2 ++ package/meson/meson.mk | 31 +++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+) create mode 100644 package/meson/cross-compilation.conf.in create mode 100644 package/meson/meson.hash create mode 100644 package/meson/meson.mkpackage/meson/cross-compilation.conf.in new file +10
-0@@ -0,0 +1,17 @@ +# Note: Buildroot's and Meson's terminologies differ about the meaning +# of 'build', 'host' and 'target': +# - Buildroot's 'host' is Meson's 'build' +# - Buildroot's 'target' is Meson's 'host' + +[binaries] +c = '@TARGET_CROSS at gcc' +cpp = '@TARGET_CROSS at g++' +ar = '@TARGET_CROSS at ar' +strip = '@TARGET_CROSS at strip'Quoted 8 lines
package/meson/cross-compilation.conf.in line 15
Quoted 5 lines
package/meson/cross-compilation.conf.in new file +5
-0+pkgconfig = '@HOST_DIR@/usr/bin/pkg-config' + +[host_machine] +system = 'linux' +cpu_family ='@TARGET_ARCH@'Does meson have the same definition of ARCH as we do? Does it support all our
ARCHes?
Quoted 3 lines
It goes well with the usual suspects (arm, mips, ppc, x86, ...) but I'll have to check for sparc, sh4 and xtensa. If needed, how should I add a restriction, given that there is no Config.in.host?
Just add a Config.in.host that has BR2_PACKAGE_HOST_MESON_ARCH_DEPENDS and a
blind BR2_PACKAGE_HOST_MESON.
[snip]
Quoted 6 lines
BTW, the value of the "
c_args" parameter in the "properties" section of the cross-compilation configuration file is formatted as follow:```
[properties]c_args= ['foo', 'bar', 'baz']
Argh!
Quoted 11 lines
``` $(TARGET_CFLAGS) is a string like "foo bar baz". To convert it, is the following OK? ```qlist = $(shell echo $(1) | sed -e "s/[^ ][^ ]*/'&',/g")
sed -e "s;@TARGET_CFLAGS@;$(call qlist,$(TARGET_CFLAGS));g" \ $(HOST_MESON_PKGDIR)/cross-compilation.conf.in \ > $(HOST_DIR)/etc/meson/cross-compilation.conf
Unfortunately that's not enough since TARGET_CFLAGS might contain something
like -DFOO='"bar baz"' and your sed would break the quotes.
What you need is:
sed -e "s%@TARGET_CFLAGS@%printf '"%s", ' $(TARGET_CFLAGS)%g" \
...
Note that I used % here: we use various different delimiters for sed at the
moment, and ; is NOT one of them, so let's not add it now :-)
Regards,
Arnout
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF
PATCH v3 2/2 docs/manual: document meson-based packages
In reply to Eric Le BihanAdd instructions for adding a package which uses the Meson build system.
--- docs/manual/adding-packages-meson.txt | 80 +++++++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 82 insertions(+) create mode 100644 docs/manual/adding-packages-meson.txt
docs/manual/adding-packages-meson.txt new file +80 -0
@@ -0,0 +1,80 @@ +// -*- mode:doc; -*- +// vim: set syntax=asciidoc: + +=== Integration of Meson-based packages + +[[meson-package-tutorial]] + +==== +meson-package+ tutorial + +http://mesonbuild.com[Meson] is an open source build system meant to be both +extremely fast, and, even more importantly, as user friendly as possible. + +Buildroot does not (yet) provide a dedicated package infrastructure for +meson-based packages. So, we will explain how to write a +.mk+ file for such a +package. Let's start with an example: + +------------------------------ +01: ################################################################################ +02: # +03: # foo +04: # +05: ################################################################################ +06: +07: FOO_VERSION = 1.0 +08: FOO_SOURCE = foo-$(FOO_VERSION).tar.gz +09: FOO_SITE = http://www.foosoftware.org/download +10: FOO_LICENSE = GPLv3+ +11: FOO_LICENSE_FILES = COPYING +12: +13: FOO_DEPENDENCIES = host-meson host-pkgconf bar +14: +15: FOO_CONF_OPTS += \ +16: --prefix=/usr \ +17: --buildtype $(if $(BR2_ENABLE_DEBUG),debug,release) \ +18: --cross-file $(HOST_DIR)/etc/meson/cross-compilation.conf +19: +20: define FOO_CONFIGURE_CMDS +21: rm -rf $(@D)/build +22: mkdir -p $(@D)/build +23: $(TARGET_MAKE_ENV) meson.py $(FOO_CONF_OPTS) $(@D) $(@D)/build +24: endef +25: +26: define FOO_BUILD_CMDS +27: $(TARGET_MAKE_ENV) ninja -C $(@D)/build +28: endef +29: +30: define FOO_INSTALL_TARGET_CMDS +31: $(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) ninja -C $(@D)/build install +32: endef +33: +34: $(eval $(generic-package)) +-------------------------------- + +The Makefile starts with the definition of the standard variables for package +declaration (lines 7 to 11). + +As seen in line 34, it is based on the +xref:generic-package-tutorial[+generic-package+ infrastructure]. So, it defines +the variables required by this particular infrastructure, where Meson and its +companion tool, Ninja, are invoked: + +* +FOO_CONFIGURE_CMDS+: the build directory required by Meson is created, and + Meson is invoked to generate the Ninja build file. The options required to + configure the cross-compilation of the package are passed via + +FOO_CONF_OPTS+. + +* +FOO_BUILD_CMDS+: Ninja is invoked to perform the build. + +* +FOO_INSTALL_TARGET_CMDS+: Ninja is invoked to install the files generated + during the build step. + +In order to have Meson available for the build, +FOO_DEPENDENCIES+ needs to +contain +host-meson+. In the example, +host-pkgconf+ and +bar+ are also +declared as dependencies because the Meson build file of +foo+ uses `pkg-config` +to determine the compilation flags and libraries of package +bar+. + +To sum it up, to add a new meson-based package, the Makefile example can be +copied verbatim then edited to replace all occurences of +FOO+ with the +uppercase name of the new package and update the values of the standard +variables.
docs/manual/adding-packages.txt +2 -0
@@ -34,6 +34,8 @@ include::adding-packages-rebar.txt[] include::adding-packages-waf.txt[] +include::adding-packages-meson.txt[] + include::adding-packages-kernel-module.txt[] include::adding-packages-asciidoc.txt[]
Signature · 1 line
2.13.6
PATCH v3 2/2 docs/manual: document meson-based packages
Quoted 30 lines · Eric Le Bihan
Add instructions for adding a package which uses the Meson build system.
Signed-off-by J?rg Krause <[email protected]>Signed-off-by Eric Le Bihan <[email protected]>--- docs/manual/adding-packages-meson.txt | 80 +++++++++++++++++++++++++++++++++++ docs/manual/adding-packages.txt | 2 + 2 files changed, 82 insertions(+) create mode 100644 docs/manual/adding-packages-meson.txtdocs/manual/adding-packages-meson.txt new file +14
-0@@ -0,0 +1,80 @@ +// -*- mode:doc; -*- +// vim: set syntax=asciidoc: + +=== Integration of Meson-based packages + +[[meson-package-tutorial]] + +==== +meson-package+ tutorial + +http://mesonbuild.com[Meson] is an open source build system meant to be both +extremely fast, and, even more importantly, as user friendly as possible. + +Buildroot does not (yet) provide a dedicated package infrastructure for +meson-based packages. So, we will explain how to write a +.mk+ file for such a
docs/manual/adding-packages-meson.txt line 24
Quoted 10 lines
docs/manual/adding-packages-meson.txt new file +10
-0+package. Let's start with an example: + +------------------------------ +01: ################################################################################ +02: # +03: # foo +04: # +05: ################################################################################ +06: +07: FOO_VERSION = 1.0
As mentioned before, all the examples use libfoo instead of foo, so please
stick to that.
docs/manual/adding-packages-meson.txt line 27
Quoted 3 lines
docs/manual/adding-packages-meson.txt new file +3
-0+08: FOO_SOURCE = foo-$(FOO_VERSION).tar.gz +09: FOO_SITE = http://www.foosoftware.org/download +10: FOO_LICENSE = GPLv3+
This should be SPDX code so GPL-3.0+
docs/manual/adding-packages-meson.txt line 40
Quoted 13 lines
docs/manual/adding-packages-meson.txt new file +13
-0+11: FOO_LICENSE_FILES = COPYING +12: +13: FOO_DEPENDENCIES = host-meson host-pkgconf bar +14: +15: FOO_CONF_OPTS += \ +16: --prefix=/usr \ +17: --buildtype $(if $(BR2_ENABLE_DEBUG),debug,release) \ +18: --cross-file $(HOST_DIR)/etc/meson/cross-compilation.conf +19: +20: define FOO_CONFIGURE_CMDS +21: rm -rf $(@D)/build +22: mkdir -p $(@D)/build +23: $(TARGET_MAKE_ENV) meson.py $(FOO_CONF_OPTS) $(@D) $(@D)/build
For this example it is OK, but if we add an infra for it, it should be
$(@D)/buildroot-build to be consistent with pkg-cmake.
Quoted 45 lines
docs/manual/adding-packages-meson.txt new file +40
-0+24: endef +25: +26: define FOO_BUILD_CMDS +27: $(TARGET_MAKE_ENV) ninja -C $(@D)/build +28: endef +29: +30: define FOO_INSTALL_TARGET_CMDS +31: $(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) ninja -C $(@D)/build install +32: endef +33: +34: $(eval $(generic-package)) +-------------------------------- + +The Makefile starts with the definition of the standard variables for package +declaration (lines 7 to 11). + +As seen in line 34, it is based on the +xref:generic-package-tutorial[+generic-package+ infrastructure]. So, it defines +the variables required by this particular infrastructure, where Meson and its +companion tool, Ninja, are invoked: + +* +FOO_CONFIGURE_CMDS+: the build directory required by Meson is created, and + Meson is invoked to generate the Ninja build file. The options required to + configure the cross-compilation of the package are passed via + +FOO_CONF_OPTS+. + +* +FOO_BUILD_CMDS+: Ninja is invoked to perform the build. + +* +FOO_INSTALL_TARGET_CMDS+: Ninja is invoked to install the files generated + during the build step. + +In order to have Meson available for the build, +FOO_DEPENDENCIES+ needs to +contain +host-meson+. In the example, +host-pkgconf+ and +bar+ are also +declared as dependencies because the Meson build file of +foo+ uses `pkg-config` +to determine the compilation flags and libraries of package +bar+. + +To sum it up, to add a new meson-based package, the Makefile example can be +copied verbatim then edited to replace all occurences of +FOO+ with the +uppercase name of the new package and update the values of the standard +variables.docs/manual/adding-packages.txt +0
-0
docs/manual/adding-packages.txt include::adding-packages-rebar.txt[] · line 37
Quoted 4 lines
docs/manual/adding-packages.txt +1
-0@@ -34,6 +34,8 @@ include::adding-packages-rebar.txt[] include::adding-packages-waf.txt[] +include::adding-packages-meson.txt[]
I think it fits better after cmake.
Regards,
Arnout
Quoted 5 lines
docs/manual/adding-packages.txt +1
-0+ include::adding-packages-kernel-module.txt[] include::adding-packages-asciidoc.txt[]
Signature · 6 lines
Arnout Vandecappelle arnout at mind be Senior Embedded Software Architect +32-16-286500 Essensium/Mind http://www.mind.be G.Geenslaan 9, 3001 Leuven, Belgium BE 872 984 063 RPR Leuven LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle GPG fingerprint: 7493 020B C7E3 8618 8DEC 222C 82EB F404 F9AC 0DDF