All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [Patch v3 0/2] Add support for Meson build
@ 2017-10-11  6:50 Eric Le Bihan
  2017-10-11  6:50 ` [Buildroot] [Patch v3 1/2] meson: new package Eric Le Bihan
  2017-10-11  6:50 ` [Buildroot] [Patch v3 2/2] docs/manual: document meson-based packages Eric Le Bihan
  0 siblings, 2 replies; 7+ messages in thread
From: Eric Le Bihan @ 2017-10-11  6:50 UTC (permalink / raw)
  To: buildroot

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [Patch v3 1/2] meson: new package
  2017-10-11  6:50 [Buildroot] [Patch v3 0/2] Add support for Meson build Eric Le Bihan
@ 2017-10-11  6:50 ` Eric Le Bihan
  2017-10-11 21:04   ` Arnout Vandecappelle
  2017-10-11  6:50 ` [Buildroot] [Patch v3 2/2] docs/manual: document meson-based packages Eric Le Bihan
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Le Bihan @ 2017-10-11  6:50 UTC (permalink / raw)
  To: buildroot

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 <joerg.krause@embedded.rocks>
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 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

diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
new file mode 100644
index 0000000000..84b399f51f
--- /dev/null
+++ b/package/meson/cross-compilation.conf.in
@@ -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@'
diff --git a/package/meson/meson.hash b/package/meson/meson.hash
new file mode 100644
index 0000000000..cdb7d1b9ef
--- /dev/null
+++ b/package/meson/meson.hash
@@ -0,0 +1,2 @@
+# Locally generated
+sha256 324894427dcd29f6156fe06b046c6ad1b998470714debd7c5705902f21aaaa73  meson-0.43.0.tar.gz
diff --git a/package/meson/meson.mk b/package/meson/meson.mk
new file mode 100644
index 0000000000..e4bff229a6
--- /dev/null
+++ b/package/meson/meson.mk
@@ -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))
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [Patch v3 2/2] docs/manual: document meson-based packages
  2017-10-11  6:50 [Buildroot] [Patch v3 0/2] Add support for Meson build Eric Le Bihan
  2017-10-11  6:50 ` [Buildroot] [Patch v3 1/2] meson: new package Eric Le Bihan
@ 2017-10-11  6:50 ` Eric Le Bihan
  2017-10-11 21:23   ` Arnout Vandecappelle
  1 sibling, 1 reply; 7+ messages in thread
From: Eric Le Bihan @ 2017-10-11  6:50 UTC (permalink / raw)
  To: buildroot

Add instructions for adding a package which uses the Meson build system.

Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 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

diff --git a/docs/manual/adding-packages-meson.txt b/docs/manual/adding-packages-meson.txt
new file mode 100644
index 0000000000..14153a2ad3
--- /dev/null
+++ b/docs/manual/adding-packages-meson.txt
@@ -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.
diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt
index d577ff030e..e542124cf9 100644
--- a/docs/manual/adding-packages.txt
+++ b/docs/manual/adding-packages.txt
@@ -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[]
-- 
2.13.6

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Buildroot] [Patch v3 1/2] meson: new package
  2017-10-11  6:50 ` [Buildroot] [Patch v3 1/2] meson: new package Eric Le Bihan
@ 2017-10-11 21:04   ` Arnout Vandecappelle
  2017-10-24 18:57     ` Eric Le Bihan
  0 siblings, 1 reply; 7+ messages in thread
From: Arnout Vandecappelle @ 2017-10-11 21:04 UTC (permalink / raw)
  To: buildroot

On 11-10-17 08:50, Eric Le Bihan wrote:
> 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 <joerg.krause@embedded.rocks>
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  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
> 
> diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> new file mode 100644
> index 0000000000..84b399f51f
> --- /dev/null
> +++ b/package/meson/cross-compilation.conf.in
> @@ -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@'

 Does meson have the same definition of ARCH as we do? Does it support all our
ARCHes?

> +cpu = '@TARGET_CPU@'
> +endian = '@TARGET_ENDIAN@'

 I'm completely missing our TARGET_CFLAGS and TARGET_LDFLAGS here. Is there no
way to specify those?

> diff --git a/package/meson/meson.hash b/package/meson/meson.hash
> new file mode 100644
> index 0000000000..cdb7d1b9ef
> --- /dev/null
> +++ b/package/meson/meson.hash
> @@ -0,0 +1,2 @@
> +# Locally generated

 You should also verify it against upstream's meson-0.43.0.tar.gz.asc.

> +sha256 324894427dcd29f6156fe06b046c6ad1b998470714debd7c5705902f21aaaa73  meson-0.43.0.tar.gz
> diff --git a/package/meson/meson.mk b/package/meson/meson.mk
> new file mode 100644
> index 0000000000..e4bff229a6
> --- /dev/null
> +++ b/package/meson/meson.mk
> @@ -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).

> +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

> +
> +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))
> 

-- 
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [Patch v3 2/2] docs/manual: document meson-based packages
  2017-10-11  6:50 ` [Buildroot] [Patch v3 2/2] docs/manual: document meson-based packages Eric Le Bihan
@ 2017-10-11 21:23   ` Arnout Vandecappelle
  0 siblings, 0 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2017-10-11 21:23 UTC (permalink / raw)
  To: buildroot



On 11-10-17 08:50, Eric Le Bihan wrote:
> Add instructions for adding a package which uses the Meson build system.
> 
> Signed-off-by: J?rg Krause <joerg.krause@embedded.rocks>
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  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
> 
> diff --git a/docs/manual/adding-packages-meson.txt b/docs/manual/adding-packages-meson.txt
> new file mode 100644
> index 0000000000..14153a2ad3
> --- /dev/null
> +++ b/docs/manual/adding-packages-meson.txt
> @@ -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

 As mentioned before, all the examples use libfoo instead of foo, so please
stick to that.

> +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+

> +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.

> +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.
> diff --git a/docs/manual/adding-packages.txt b/docs/manual/adding-packages.txt
> index d577ff030e..e542124cf9 100644
> --- a/docs/manual/adding-packages.txt
> +++ b/docs/manual/adding-packages.txt
> @@ -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

> +
>  include::adding-packages-kernel-module.txt[]
>  
>  include::adding-packages-asciidoc.txt[]
> 

-- 
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [Patch v3 1/2] meson: new package
  2017-10-11 21:04   ` Arnout Vandecappelle
@ 2017-10-24 18:57     ` Eric Le Bihan
  2017-10-24 22:08       ` Arnout Vandecappelle
  0 siblings, 1 reply; 7+ messages in thread
From: Eric Le Bihan @ 2017-10-24 18:57 UTC (permalink / raw)
  To: buildroot

Hi!

On 17-10-11 23:04:56, Arnout Vandecappelle wrote:
> On 11-10-17 08:50, Eric Le Bihan wrote:
> > 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 <joerg.krause@embedded.rocks>
> > Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> > ---
> >  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
> >
> > diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
> > new file mode 100644
> > index 0000000000..84b399f51f
> > --- /dev/null
> > +++ b/package/meson/cross-compilation.conf.in
> > @@ -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@'
>
>  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?

> > +cpu = '@TARGET_CPU@'
> > +endian = '@TARGET_ENDIAN@'
>
>  I'm completely missing our TARGET_CFLAGS and TARGET_LDFLAGS here. 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.

> > diff --git a/package/meson/meson.hash b/package/meson/meson.hash
> > new file mode 100644
> > index 0000000000..cdb7d1b9ef
> > --- /dev/null
> > +++ b/package/meson/meson.hash
> > @@ -0,0 +1,2 @@
> > +# Locally generated
>
>  You should also verify it against upstream's meson-0.43.0.tar.gz.asc.

Will do!

> > +sha256 324894427dcd29f6156fe06b046c6ad1b998470714debd7c5705902f21aaaa73  meson-0.43.0.tar.gz
> > diff --git a/package/meson/meson.mk b/package/meson/meson.mk
> > new file mode 100644
> > index 0000000000..e4bff229a6
> > --- /dev/null
> > +++ b/package/meson/meson.mk
> > @@ -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).

Of course! It is mentionned in docs/manual/adding-packages-tips.txt. I
should re-read the manual more often...

> > +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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Buildroot] [Patch v3 1/2] meson: new package
  2017-10-24 18:57     ` Eric Le Bihan
@ 2017-10-24 22:08       ` Arnout Vandecappelle
  0 siblings, 0 replies; 7+ messages in thread
From: Arnout Vandecappelle @ 2017-10-24 22:08 UTC (permalink / raw)
  To: buildroot



On 24-10-17 20:57, Eric Le Bihan wrote:
> Hi!
> 
> On 17-10-11 23:04:56, Arnout Vandecappelle wrote:
>> On 11-10-17 08:50, Eric Le Bihan wrote:
>>> 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 <joerg.krause@embedded.rocks>
>>> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
>>> ---
>>>  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
>>>
>>> diff --git a/package/meson/cross-compilation.conf.in b/package/meson/cross-compilation.conf.in
>>> new file mode 100644
>>> index 0000000000..84b399f51f
>>> --- /dev/null
>>> +++ b/package/meson/cross-compilation.conf.in
>>> @@ -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@'
>>
>>  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?

 Just add a Config.in.host that has BR2_PACKAGE_HOST_MESON_ARCH_DEPENDS and a
blind BR2_PACKAGE_HOST_MESON.

[snip]
> 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!

> ```
> 
> $(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


-- 
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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-10-24 22:08 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-10-11  6:50 [Buildroot] [Patch v3 0/2] Add support for Meson build Eric Le Bihan
2017-10-11  6:50 ` [Buildroot] [Patch v3 1/2] meson: new package Eric Le Bihan
2017-10-11 21:04   ` Arnout Vandecappelle
2017-10-24 18:57     ` Eric Le Bihan
2017-10-24 22:08       ` Arnout Vandecappelle
2017-10-11  6:50 ` [Buildroot] [Patch v3 2/2] docs/manual: document meson-based packages Eric Le Bihan
2017-10-11 21:23   ` Arnout Vandecappelle

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.