All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [Patch v3 0/3] Ninja, Meson: new build systems
@ 2016-06-24 19:22 Eric Le Bihan
  2016-06-24 19:22 ` [Buildroot] [Patch v3 1/3] ninja: new package Eric Le Bihan
                   ` (2 more replies)
  0 siblings, 3 replies; 10+ messages in thread
From: Eric Le Bihan @ 2016-06-24 19:22 UTC (permalink / raw)
  To: buildroot

This small patch series provides two new build systems: Ninja and Meson.

v2 -> v3:

 - bump meson to 0.3.2
 - fix cross-compilation configuration template
 - fix dependency on host-ninja

v1 -> v2:

 - only provide host variants of ninja and python-meson.
 - document integration of meson-based packages.
 - drop removal of mesongui.py.

Eric Le Bihan (3):
  ninja: new package
  python-meson: new package
  docs/manual: document meson-based packages

 docs/manual/adding-packages-meson.txt          | 84 ++++++++++++++++++++++++++
 docs/manual/adding-packages.txt                |  2 +
 package/ninja/ninja.hash                       |  2 +
 package/ninja/ninja.mk                         | 22 +++++++
 package/python-meson/cross-compilation.conf.in | 20 ++++++
 package/python-meson/meson-exe-wrapper.in      |  3 +
 package/python-meson/python-meson.hash         |  2 +
 package/python-meson/python-meson.mk           | 41 +++++++++++++
 8 files changed, 176 insertions(+)
 create mode 100644 docs/manual/adding-packages-meson.txt
 create mode 100644 package/ninja/ninja.hash
 create mode 100644 package/ninja/ninja.mk
 create mode 100644 package/python-meson/cross-compilation.conf.in
 create mode 100755 package/python-meson/meson-exe-wrapper.in
 create mode 100644 package/python-meson/python-meson.hash
 create mode 100644 package/python-meson/python-meson.mk

--
2.4.11

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

* [Buildroot] [Patch v3 1/3] ninja: new package
  2016-06-24 19:22 [Buildroot] [Patch v3 0/3] Ninja, Meson: new build systems Eric Le Bihan
@ 2016-06-24 19:22 ` Eric Le Bihan
  2016-07-03 19:31   ` Yann E. MORIN
                     ` (2 more replies)
  2016-06-24 19:22 ` [Buildroot] [Patch v3 2/3] python-meson: " Eric Le Bihan
  2016-06-24 19:22 ` [Buildroot] [Patch v3 3/3] docs/manual: document meson-based packages Eric Le Bihan
  2 siblings, 3 replies; 10+ messages in thread
From: Eric Le Bihan @ 2016-06-24 19:22 UTC (permalink / raw)
  To: buildroot

This new package provides the host variant of Ninja, a small build
system with a focus on speed.

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/ninja/ninja.hash |  2 ++
 package/ninja/ninja.mk   | 22 ++++++++++++++++++++++
 2 files changed, 24 insertions(+)
 create mode 100644 package/ninja/ninja.hash
 create mode 100644 package/ninja/ninja.mk

diff --git a/package/ninja/ninja.hash b/package/ninja/ninja.hash
new file mode 100644
index 0000000..47ec822
--- /dev/null
+++ b/package/ninja/ninja.hash
@@ -0,0 +1,2 @@
+# Locally generated
+sha256 51581de53cf4705b89eb6b14a85baa73288ad08bff256e7d30d529155813be19  ninja-v1.7.1.tar.gz
diff --git a/package/ninja/ninja.mk b/package/ninja/ninja.mk
new file mode 100644
index 0000000..f8cada4
--- /dev/null
+++ b/package/ninja/ninja.mk
@@ -0,0 +1,22 @@
+################################################################################
+#
+# ninja
+#
+################################################################################
+
+NINJA_VERSION = v1.7.1
+NINJA_SITE = $(call github,ninja-build,ninja,$(NINJA_VERSION))
+NINJA_LICENSE = Apache-2.0
+NINJA_LICENSE_FILES = COPYING
+
+HOST_NINJA_DEPENDENCIES = $(if $(BR2_PACKAGE_PYTHON3),host-python3,host-python)
+
+define HOST_NINJA_BUILD_CMDS
+	(cd $(@D); ./configure.py --bootstrap)
+endef
+
+define HOST_NINJA_INSTALL_CMDS
+	$(INSTALL) -m 0755 $(@D)/ninja $(HOST_DIR)/usr/bin/ninja
+endef
+
+$(eval $(host-generic-package))
-- 
2.4.11

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

* [Buildroot] [Patch v3 2/3] python-meson: new package
  2016-06-24 19:22 [Buildroot] [Patch v3 0/3] Ninja, Meson: new build systems Eric Le Bihan
  2016-06-24 19:22 ` [Buildroot] [Patch v3 1/3] ninja: new package Eric Le Bihan
@ 2016-06-24 19:22 ` Eric Le Bihan
  2016-06-26  3:53   ` Baruch Siach
  2016-07-03 20:24   ` Yann E. MORIN
  2016-06-24 19:22 ` [Buildroot] [Patch v3 3/3] docs/manual: document meson-based packages Eric Le Bihan
  2 siblings, 2 replies; 10+ messages in thread
From: Eric Le Bihan @ 2016-06-24 19:22 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 cross-compilation configuration
file ("$(HOST_DIR)/etc/meson/cross-compilation.conf") as well as a
wrapper for QEMU ("$(HOST_DIR)/usr/bin/meson-exe-wrapper"), used to
perform checks when cross-compiling (hence the dependency on host-qemu).

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 package/python-meson/cross-compilation.conf.in | 20 +++++++++++++
 package/python-meson/meson-exe-wrapper.in      |  3 ++
 package/python-meson/python-meson.hash         |  2 ++
 package/python-meson/python-meson.mk           | 41 ++++++++++++++++++++++++++
 4 files changed, 66 insertions(+)
 create mode 100644 package/python-meson/cross-compilation.conf.in
 create mode 100755 package/python-meson/meson-exe-wrapper.in
 create mode 100644 package/python-meson/python-meson.hash
 create mode 100644 package/python-meson/python-meson.mk

diff --git a/package/python-meson/cross-compilation.conf.in b/package/python-meson/cross-compilation.conf.in
new file mode 100644
index 0000000..fc9f1dd
--- /dev/null
+++ b/package/python-meson/cross-compilation.conf.in
@@ -0,0 +1,20 @@
+# Generated file - do not edit
+#
+# Note that, in Meson terminology, what Buildroot calls the "host" system is the
+# "build" system and the "target" system is called the "host" system.
+
+[host_machine]
+system = 'linux'
+cpu_family ='@TARGET_ARCH@'
+cpu = 'generic'
+endian = '@TARGET_ENDIAN@'
+
+[properties]
+
+[binaries]
+c = '@TARGET_CROSS at gcc'
+cpp = '@TARGET_CROSS at g++'
+ar = '@TARGET_CROSS at ar'
+strip = '@TARGET_CROSS at strip'
+exe_wrapper = '@HOST_DIR@/usr/bin/meson-exe-wrapper'
+pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
diff --git a/package/python-meson/meson-exe-wrapper.in b/package/python-meson/meson-exe-wrapper.in
new file mode 100755
index 0000000..5e4415c
--- /dev/null
+++ b/package/python-meson/meson-exe-wrapper.in
@@ -0,0 +1,3 @@
+#!/bin/sh
+
+ at HOST_DIR@/usr/bin/qemu- at TARGET_ARCH@ -L @TARGET_DIR@ "$@"
diff --git a/package/python-meson/python-meson.hash b/package/python-meson/python-meson.hash
new file mode 100644
index 0000000..7540c45
--- /dev/null
+++ b/package/python-meson/python-meson.hash
@@ -0,0 +1,2 @@
+# Locally generated
+sha256 372c18e40ffc3fe101f4ab48e8077f048dd774eaf4e87bbea3221908fca74835 python-meson-0.32.0.tar.gz
diff --git a/package/python-meson/python-meson.mk b/package/python-meson/python-meson.mk
new file mode 100644
index 0000000..97a42e6
--- /dev/null
+++ b/package/python-meson/python-meson.mk
@@ -0,0 +1,41 @@
+################################################################################
+#
+# python-meson
+#
+################################################################################
+
+PYTHON_MESON_VERSION = 0.32.0
+PYTHON_MESON_SITE = $(call github,mesonbuild,meson,$(PYTHON_MESON_VERSION))
+PYTHON_MESON_LICENSE = Apache-2.0
+PYTHON_MESON_LICENSE_FILES = COPYING
+PYTHON_MESON_SETUP_TYPE = setuptools
+
+HOST_PYTHON_MESON_DEPENDENCIES = host-qemu host-ninja
+HOST_PYTHON_MESON_NEEDS_HOST_PYTHON = python3
+
+HOST_PYTHON_MESON_TARGET_ENDIAN = $(shell echo $(BR2_ENDIAN) | tr 'A-Z' 'a-z')
+
+define HOST_PYTHON_MESON_INSTALL_CROSS_CONF
+	$(INSTALL) -D -m 0644 package/python-meson/cross-compilation.conf.in \
+		$(HOST_DIR)/etc/meson/cross-compilation.conf
+	$(SED) 's;@TARGET_CROSS@;$(TARGET_CROSS);g' \
+		-e 's;@TARGET_ARCH@;$(ARCH);g' \
+		-e 's;@TARGET_ENDIAN@;$(HOST_PYTHON_MESON_TARGET_ENDIAN);g' \
+		-e 's;@HOST_DIR@;$(HOST_DIR);g' \
+		$(HOST_DIR)/etc/meson/cross-compilation.conf
+endef
+
+define HOST_PYTHON_MESON_INSTALL_EXE_WRAPPER
+	$(INSTALL) -D -m 0755 package/python-meson/meson-exe-wrapper.in \
+		$(HOST_DIR)/usr/bin/meson-exe-wrapper
+	$(SED) 's;@TARGET_ARCH@;$(ARCH);g' \
+		-e 's;@HOST_DIR@;$(HOST_DIR);g' \
+		-e 's;@TARGET_DIR@;$(TARGET_DIR);g' \
+		$(HOST_DIR)/usr/bin/meson-exe-wrapper
+endef
+
+HOST_PYTHON_MESON_POST_INSTALL_HOOKS += \
+	HOST_PYTHON_MESON_INSTALL_CROSS_CONF \
+	HOST_PYTHON_MESON_INSTALL_EXE_WRAPPER
+
+$(eval $(host-python-package))
-- 
2.4.11

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

* [Buildroot] [Patch v3 3/3] docs/manual: document meson-based packages
  2016-06-24 19:22 [Buildroot] [Patch v3 0/3] Ninja, Meson: new build systems Eric Le Bihan
  2016-06-24 19:22 ` [Buildroot] [Patch v3 1/3] ninja: new package Eric Le Bihan
  2016-06-24 19:22 ` [Buildroot] [Patch v3 2/3] python-meson: " Eric Le Bihan
@ 2016-06-24 19:22 ` Eric Le Bihan
  2 siblings, 0 replies; 10+ messages in thread
From: Eric Le Bihan @ 2016-06-24 19:22 UTC (permalink / raw)
  To: buildroot

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

Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
---
 docs/manual/adding-packages-meson.txt | 84 +++++++++++++++++++++++++++++++++++
 docs/manual/adding-packages.txt       |  2 +
 2 files changed, 86 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 0000000..b8202ed
--- /dev/null
+++ b/docs/manual/adding-packages-meson.txt
@@ -0,0 +1,84 @@
+// -*- 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-python-meson host-pkgconf bar
+14:
+15: ifeq ($(BR2_ENABLE_DEBUG),y)
+16: FOO_MESON_MODE = debug
+17: else
+18: FOO_MESON_MODE = release
+19: endif
+20:
+21: FOO_MESON_OPTS += \
+22: 	--prefix=/usr \
+23: 	--buildtype $(FOO_MESON_MODE) \
+24: 	--cross-file $(HOST_DIR)/etc/meson/cross-compilation.conf
+25:
+26: define FOO_CONFIGURE_CMDS
+27: 	rm -rf $(@D)/build
+28: 	mkdir -p $(@D)/build
+29: 	$(TARGET_MAKE_ENV) meson.py $(FOO_MESON_OPTS) $(@D) $(@D)/build
+30: endef
+31:
+32: define FOO_BUILD_CMDS
+33: 	$(TARGET_MAKE_ENV) ninja -C $(@D)/build
+34: endef
+35:
+36: define FOO_INSTALL_TARGET_CMDS
+37: 	$(TARGET_MAKE_ENV) DESTDIR=$(TARGET_DIR) ninja -C $(@D)/build install
+38: endef
+39:
+40: $(eval $(generic-package))
+--------------------------------
+
+The Makefile starts with the definition of the standard variables for package
+declaration (lines 7 to 11).
+
+As seen in line 40, 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_MESON_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-python-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 76f90c9..8b80a63 100644
--- a/docs/manual/adding-packages.txt
+++ b/docs/manual/adding-packages.txt
@@ -29,6 +29,8 @@ include::adding-packages-kconfig.txt[]
 
 include::adding-packages-rebar.txt[]
 
+include::adding-packages-meson.txt[]
+
 include::adding-packages-kernel-module.txt[]
 
 include::adding-packages-asciidoc.txt[]
-- 
2.4.11

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

* [Buildroot] [Patch v3 2/3] python-meson: new package
  2016-06-24 19:22 ` [Buildroot] [Patch v3 2/3] python-meson: " Eric Le Bihan
@ 2016-06-26  3:53   ` Baruch Siach
  2016-07-03 20:24   ` Yann E. MORIN
  1 sibling, 0 replies; 10+ messages in thread
From: Baruch Siach @ 2016-06-26  3:53 UTC (permalink / raw)
  To: buildroot

Hi Eric,

On Fri, Jun 24, 2016 at 09:22:28PM +0200, Eric Le Bihan wrote: 
> diff --git a/package/python-meson/cross-compilation.conf.in b/package/python-meson/cross-compilation.conf.in
> new file mode 100644
> index 0000000..fc9f1dd
> --- /dev/null
> +++ b/package/python-meson/cross-compilation.conf.in
> @@ -0,0 +1,20 @@
> +# Generated file - do not edit

This is not correct for this file. This is the source file that you sed to 
generate the generated one. Though I understand it's convenient to have this 
comment in the source file, it is also misleading.

Also, as there are many other generated files under $(HOST_DIR), I'm not sure 
this comment is helpful.

baruch

> +#
> +# Note that, in Meson terminology, what Buildroot calls the "host" system is the
> +# "build" system and the "target" system is called the "host" system.
> +
> +[host_machine]
> +system = 'linux'
> +cpu_family ='@TARGET_ARCH@'
> +cpu = 'generic'
> +endian = '@TARGET_ENDIAN@'
> +
> +[properties]
> +
> +[binaries]
> +c = '@TARGET_CROSS at gcc'
> +cpp = '@TARGET_CROSS at g++'
> +ar = '@TARGET_CROSS at ar'
> +strip = '@TARGET_CROSS at strip'
> +exe_wrapper = '@HOST_DIR@/usr/bin/meson-exe-wrapper'
> +pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'

-- 
     http://baruch.siach.name/blog/                  ~. .~   Tk Open Systems
=}------------------------------------------------ooO--U--Ooo------------{=
   - baruch at tkos.co.il - tel: +972.52.368.4656, http://www.tkos.co.il -

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

* [Buildroot] [Patch v3 1/3] ninja: new package
  2016-06-24 19:22 ` [Buildroot] [Patch v3 1/3] ninja: new package Eric Le Bihan
@ 2016-07-03 19:31   ` Yann E. MORIN
  2016-07-03 20:27   ` Peter Korsgaard
  2018-03-26 21:48   ` Thomas Petazzoni
  2 siblings, 0 replies; 10+ messages in thread
From: Yann E. MORIN @ 2016-07-03 19:31 UTC (permalink / raw)
  To: buildroot

?ric, All,

On 2016-06-24 21:22 +0200, Eric Le Bihan spake thusly:
> This new package provides the host variant of Ninja, a small build
> system with a focus on speed.
> 
> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>

Tested-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Reviewed-by: "Yann E. MORIN" <yann.morin.1998@free.fr>

Regards,
Yann E. MORIN.

> ---
>  package/ninja/ninja.hash |  2 ++
>  package/ninja/ninja.mk   | 22 ++++++++++++++++++++++
>  2 files changed, 24 insertions(+)
>  create mode 100644 package/ninja/ninja.hash
>  create mode 100644 package/ninja/ninja.mk
> 
> diff --git a/package/ninja/ninja.hash b/package/ninja/ninja.hash
> new file mode 100644
> index 0000000..47ec822
> --- /dev/null
> +++ b/package/ninja/ninja.hash
> @@ -0,0 +1,2 @@
> +# Locally generated
> +sha256 51581de53cf4705b89eb6b14a85baa73288ad08bff256e7d30d529155813be19  ninja-v1.7.1.tar.gz
> diff --git a/package/ninja/ninja.mk b/package/ninja/ninja.mk
> new file mode 100644
> index 0000000..f8cada4
> --- /dev/null
> +++ b/package/ninja/ninja.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +#
> +# ninja
> +#
> +################################################################################
> +
> +NINJA_VERSION = v1.7.1
> +NINJA_SITE = $(call github,ninja-build,ninja,$(NINJA_VERSION))
> +NINJA_LICENSE = Apache-2.0
> +NINJA_LICENSE_FILES = COPYING
> +
> +HOST_NINJA_DEPENDENCIES = $(if $(BR2_PACKAGE_PYTHON3),host-python3,host-python)
> +
> +define HOST_NINJA_BUILD_CMDS
> +	(cd $(@D); ./configure.py --bootstrap)
> +endef
> +
> +define HOST_NINJA_INSTALL_CMDS
> +	$(INSTALL) -m 0755 $(@D)/ninja $(HOST_DIR)/usr/bin/ninja
> +endef
> +
> +$(eval $(host-generic-package))
> -- 
> 2.4.11
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [Patch v3 2/3] python-meson: new package
  2016-06-24 19:22 ` [Buildroot] [Patch v3 2/3] python-meson: " Eric Le Bihan
  2016-06-26  3:53   ` Baruch Siach
@ 2016-07-03 20:24   ` Yann E. MORIN
  2016-07-09 13:06     ` Eric Le Bihan
  1 sibling, 1 reply; 10+ messages in thread
From: Yann E. MORIN @ 2016-07-03 20:24 UTC (permalink / raw)
  To: buildroot

?ric, All,

On 2016-06-24 21:22 +0200, Eric Le Bihan spake thusly:
> 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.

This should be named "meson", not "python-meson".

> More precisely, Meson creates configuration files for the Ninja build
> system.
> 
> Besides building Meson, it generates a cross-compilation configuration
> file ("$(HOST_DIR)/etc/meson/cross-compilation.conf") as well as a
> wrapper for QEMU ("$(HOST_DIR)/usr/bin/meson-exe-wrapper"), used to
> perform checks when cross-compiling (hence the dependency on host-qemu).

We've (briefly) discussed this patch during the summer camp, and we all
believe that this dependency on host-qemu is really ugly.

We're not very much interested in having this in Buildroot in the state
it is in this patch. Especially since (as far as I could see) you do not
provide a package that uses meson (do you plan on sending one?).

However, after looking a bit at the Meson documentation, especially
about cross-compilation, it appears that we can avoid having to ru nsuch
"target" tests.

For example (from the Meson doc itself):

    sizeof_int = 4
    sizeof_wchar_t = 4
    sizeof_void* = 4

    alignment_char = 1
    alignment_void* = 4
    alignment_double = 4

    has_function_printf = true

    c_args = ['-DCROSS=1', '-DSOMETHING=3']
    c_link_args = ['-some_link_arg']

Also, if you look (in the meson sources) at cross/ubuntu-armhf.txt:

    [binaries]
    # we could set exe_wrapper = qemu-arm-static but to test the case
    # when cross compiled binaries can't be run we don't do that
    c = '/usr/bin/arm-linux-gnueabihf-gcc'
    cpp = '/usr/bin/arm-linux-gnueabihf-g++'
    ar = '/usr/arm-linux-gnueabihf/bin/ar'
    strip = '/usr/arm-linux-gnueabihf/bin/strip'
    pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
    
    [properties]
    root = '/usr/arm-linux-gnueabihf'
    
    has_function_printf = true
    has_function_hfkerhisadf = false
    
    [host_machine]
    system = 'linux'
    cpu_family = 'arm'
    cpu = 'armv7' # Not sure if correct.
    endian = 'little'

So, if we can feed it all the required config options, we can probably
avoid running qemu.

The basic idea is that we start with a simple such config file, which we
preseed with the obvious things. Then, as we add more packages, we can
complement that file step by step.

We'd basically have a few start-point files:
  - per architecture
  - per C library
  - optionally, a meson-basd package would generate its own blob

Those files would be concatenated to form the cross-compilation.conf.

Or so this is the overall idea.

Do you think this is an possible solution? Would mind looking into it?

Regards,
Yann E. MORIN.

> Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
> ---
>  package/python-meson/cross-compilation.conf.in | 20 +++++++++++++
>  package/python-meson/meson-exe-wrapper.in      |  3 ++
>  package/python-meson/python-meson.hash         |  2 ++
>  package/python-meson/python-meson.mk           | 41 ++++++++++++++++++++++++++
>  4 files changed, 66 insertions(+)
>  create mode 100644 package/python-meson/cross-compilation.conf.in
>  create mode 100755 package/python-meson/meson-exe-wrapper.in
>  create mode 100644 package/python-meson/python-meson.hash
>  create mode 100644 package/python-meson/python-meson.mk
> 
> diff --git a/package/python-meson/cross-compilation.conf.in b/package/python-meson/cross-compilation.conf.in
> new file mode 100644
> index 0000000..fc9f1dd
> --- /dev/null
> +++ b/package/python-meson/cross-compilation.conf.in
> @@ -0,0 +1,20 @@
> +# Generated file - do not edit
> +#
> +# Note that, in Meson terminology, what Buildroot calls the "host" system is the
> +# "build" system and the "target" system is called the "host" system.
> +
> +[host_machine]
> +system = 'linux'
> +cpu_family ='@TARGET_ARCH@'
> +cpu = 'generic'
> +endian = '@TARGET_ENDIAN@'
> +
> +[properties]
> +
> +[binaries]
> +c = '@TARGET_CROSS at gcc'
> +cpp = '@TARGET_CROSS at g++'
> +ar = '@TARGET_CROSS at ar'
> +strip = '@TARGET_CROSS at strip'
> +exe_wrapper = '@HOST_DIR@/usr/bin/meson-exe-wrapper'
> +pkgconfig = '@HOST_DIR@/usr/bin/pkg-config'
> diff --git a/package/python-meson/meson-exe-wrapper.in b/package/python-meson/meson-exe-wrapper.in
> new file mode 100755
> index 0000000..5e4415c
> --- /dev/null
> +++ b/package/python-meson/meson-exe-wrapper.in
> @@ -0,0 +1,3 @@
> +#!/bin/sh
> +
> + at HOST_DIR@/usr/bin/qemu- at TARGET_ARCH@ -L @TARGET_DIR@ "$@"
> diff --git a/package/python-meson/python-meson.hash b/package/python-meson/python-meson.hash
> new file mode 100644
> index 0000000..7540c45
> --- /dev/null
> +++ b/package/python-meson/python-meson.hash
> @@ -0,0 +1,2 @@
> +# Locally generated
> +sha256 372c18e40ffc3fe101f4ab48e8077f048dd774eaf4e87bbea3221908fca74835 python-meson-0.32.0.tar.gz
> diff --git a/package/python-meson/python-meson.mk b/package/python-meson/python-meson.mk
> new file mode 100644
> index 0000000..97a42e6
> --- /dev/null
> +++ b/package/python-meson/python-meson.mk
> @@ -0,0 +1,41 @@
> +################################################################################
> +#
> +# python-meson
> +#
> +################################################################################
> +
> +PYTHON_MESON_VERSION = 0.32.0
> +PYTHON_MESON_SITE = $(call github,mesonbuild,meson,$(PYTHON_MESON_VERSION))
> +PYTHON_MESON_LICENSE = Apache-2.0
> +PYTHON_MESON_LICENSE_FILES = COPYING
> +PYTHON_MESON_SETUP_TYPE = setuptools
> +
> +HOST_PYTHON_MESON_DEPENDENCIES = host-qemu host-ninja
> +HOST_PYTHON_MESON_NEEDS_HOST_PYTHON = python3
> +
> +HOST_PYTHON_MESON_TARGET_ENDIAN = $(shell echo $(BR2_ENDIAN) | tr 'A-Z' 'a-z')
> +
> +define HOST_PYTHON_MESON_INSTALL_CROSS_CONF
> +	$(INSTALL) -D -m 0644 package/python-meson/cross-compilation.conf.in \
> +		$(HOST_DIR)/etc/meson/cross-compilation.conf
> +	$(SED) 's;@TARGET_CROSS@;$(TARGET_CROSS);g' \
> +		-e 's;@TARGET_ARCH@;$(ARCH);g' \
> +		-e 's;@TARGET_ENDIAN@;$(HOST_PYTHON_MESON_TARGET_ENDIAN);g' \
> +		-e 's;@HOST_DIR@;$(HOST_DIR);g' \
> +		$(HOST_DIR)/etc/meson/cross-compilation.conf
> +endef
> +
> +define HOST_PYTHON_MESON_INSTALL_EXE_WRAPPER
> +	$(INSTALL) -D -m 0755 package/python-meson/meson-exe-wrapper.in \
> +		$(HOST_DIR)/usr/bin/meson-exe-wrapper
> +	$(SED) 's;@TARGET_ARCH@;$(ARCH);g' \
> +		-e 's;@HOST_DIR@;$(HOST_DIR);g' \
> +		-e 's;@TARGET_DIR@;$(TARGET_DIR);g' \
> +		$(HOST_DIR)/usr/bin/meson-exe-wrapper
> +endef
> +
> +HOST_PYTHON_MESON_POST_INSTALL_HOOKS += \
> +	HOST_PYTHON_MESON_INSTALL_CROSS_CONF \
> +	HOST_PYTHON_MESON_INSTALL_EXE_WRAPPER
> +
> +$(eval $(host-python-package))
> -- 
> 2.4.11
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

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

* [Buildroot] [Patch v3 1/3] ninja: new package
  2016-06-24 19:22 ` [Buildroot] [Patch v3 1/3] ninja: new package Eric Le Bihan
  2016-07-03 19:31   ` Yann E. MORIN
@ 2016-07-03 20:27   ` Peter Korsgaard
  2018-03-26 21:48   ` Thomas Petazzoni
  2 siblings, 0 replies; 10+ messages in thread
From: Peter Korsgaard @ 2016-07-03 20:27 UTC (permalink / raw)
  To: buildroot

>>>>> "Eric" == Eric Le Bihan <eric.le.bihan.dev@free.fr> writes:

 > This new package provides the host variant of Ninja, a small build
 > system with a focus on speed.

 > Signed-off-by: Eric Le Bihan <eric.le.bihan.dev@free.fr>
 > ---
 >  package/ninja/ninja.hash |  2 ++
 >  package/ninja/ninja.mk   | 22 ++++++++++++++++++++++
 >  2 files changed, 24 insertions(+)
 >  create mode 100644 package/ninja/ninja.hash
 >  create mode 100644 package/ninja/ninja.mk

 > diff --git a/package/ninja/ninja.hash b/package/ninja/ninja.hash
 > new file mode 100644
 > index 0000000..47ec822
 > --- /dev/null
 > +++ b/package/ninja/ninja.hash
 > @@ -0,0 +1,2 @@
 > +# Locally generated
 > +sha256 51581de53cf4705b89eb6b14a85baa73288ad08bff256e7d30d529155813be19  ninja-v1.7.1.tar.gz
 > diff --git a/package/ninja/ninja.mk b/package/ninja/ninja.mk
 > new file mode 100644
 > index 0000000..f8cada4
 > --- /dev/null
 > +++ b/package/ninja/ninja.mk
 > @@ -0,0 +1,22 @@
 > +################################################################################
 > +#
 > +# ninja
 > +#
 > +################################################################################
 > +
 > +NINJA_VERSION = v1.7.1
 > +NINJA_SITE = $(call github,ninja-build,ninja,$(NINJA_VERSION))
 > +NINJA_LICENSE = Apache-2.0
 > +NINJA_LICENSE_FILES = COPYING
 > +
 > +HOST_NINJA_DEPENDENCIES = $(if $(BR2_PACKAGE_PYTHON3),host-python3,host-python)
 > +
 > +define HOST_NINJA_BUILD_CMDS
 > +	(cd $(@D); ./configure.py --bootstrap)
 > +endef
 > +
 > +define HOST_NINJA_INSTALL_CMDS
 > +	$(INSTALL) -m 0755 $(@D)/ninja $(HOST_DIR)/usr/bin/ninja

When the destination filename is passes then the -D option should be
used with install.

Committed with that fixed, thanks.

-- 
Bye, Peter Korsgaard

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

* [Buildroot] [Patch v3 2/3] python-meson: new package
  2016-07-03 20:24   ` Yann E. MORIN
@ 2016-07-09 13:06     ` Eric Le Bihan
  0 siblings, 0 replies; 10+ messages in thread
From: Eric Le Bihan @ 2016-07-09 13:06 UTC (permalink / raw)
  To: buildroot

Hi all!

Le Sun, 3 Jul 2016 22:24:21 +0200,
"Yann E. MORIN" <yann.morin.1998@free.fr> a ?crit :

> On 2016-06-24 21:22 +0200, Eric Le Bihan spake thusly:
> > 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.  
> 
> This should be named "meson", not "python-meson".

OK.

> > More precisely, Meson creates configuration files for the Ninja
> > build system.
> > 
> > Besides building Meson, it generates a cross-compilation
> > configuration file ("$(HOST_DIR)/etc/meson/cross-compilation.conf")
> > as well as a wrapper for QEMU
> > ("$(HOST_DIR)/usr/bin/meson-exe-wrapper"), used to perform checks
> > when cross-compiling (hence the dependency on host-qemu).  
> 
> We've (briefly) discussed this patch during the summer camp, and we
> all believe that this dependency on host-qemu is really ugly.
> 
> We're not very much interested in having this in Buildroot in the
> state it is in this patch. Especially since (as far as I could see)
> you do not provide a package that uses meson (do you plan on sending
> one?).
> 
> However, after looking a bit at the Meson documentation, especially
> about cross-compilation, it appears that we can avoid having to ru
> nsuch "target" tests.
> 
> For example (from the Meson doc itself):
> 
>     sizeof_int = 4
>     sizeof_wchar_t = 4
>     sizeof_void* = 4
> 
>     alignment_char = 1
>     alignment_void* = 4
>     alignment_double = 4
> 
>     has_function_printf = true
> 
>     c_args = ['-DCROSS=1', '-DSOMETHING=3']
>     c_link_args = ['-some_link_arg']
> 
> Also, if you look (in the meson sources) at cross/ubuntu-armhf.txt:
> 
>     [binaries]
>     # we could set exe_wrapper = qemu-arm-static but to test the case
>     # when cross compiled binaries can't be run we don't do that
>     c = '/usr/bin/arm-linux-gnueabihf-gcc'
>     cpp = '/usr/bin/arm-linux-gnueabihf-g++'
>     ar = '/usr/arm-linux-gnueabihf/bin/ar'
>     strip = '/usr/arm-linux-gnueabihf/bin/strip'
>     pkgconfig = '/usr/bin/arm-linux-gnueabihf-pkg-config'
>     
>     [properties]
>     root = '/usr/arm-linux-gnueabihf'
>     
>     has_function_printf = true
>     has_function_hfkerhisadf = false
>     
>     [host_machine]
>     system = 'linux'
>     cpu_family = 'arm'
>     cpu = 'armv7' # Not sure if correct.
>     endian = 'little'
> 
> So, if we can feed it all the required config options, we can probably
> avoid running qemu.
> 
> The basic idea is that we start with a simple such config file, which
> we preseed with the obvious things. Then, as we add more packages, we
> can complement that file step by step.
> 
> We'd basically have a few start-point files:
>   - per architecture
>   - per C library
>   - optionally, a meson-basd package would generate its own blob
> 
> Those files would be concatenated to form the cross-compilation.conf.
> 
> Or so this is the overall idea.
> 
> Do you think this is an possible solution? Would mind looking into it?

Indeed, for the basic cases, defining an "exe_wrapper" which uses
host-qemu is not mandatory. I'll post a new series for a new package
named "meson", where the dependency has been removed and the
cross-compilation configuration file simplified. This should be
sufficient for the users wanting to add a package which uses pkg-config
for dependency management and does not require exotic platform checks.

ATM, there are not many new projects using Meson, so I will not provided
packages using it. But some projects, like Gstreamer [1] are being
ported from autotools to Meson. 

[1] http://blog.nirbheek.in/2016/05/gstreamer-and-meson-new-hope.html

Regards,

-- 
ELB

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

* [Buildroot] [Patch v3 1/3] ninja: new package
  2016-06-24 19:22 ` [Buildroot] [Patch v3 1/3] ninja: new package Eric Le Bihan
  2016-07-03 19:31   ` Yann E. MORIN
  2016-07-03 20:27   ` Peter Korsgaard
@ 2018-03-26 21:48   ` Thomas Petazzoni
  2 siblings, 0 replies; 10+ messages in thread
From: Thomas Petazzoni @ 2018-03-26 21:48 UTC (permalink / raw)
  To: buildroot

Hello Eric,

On Fri, 24 Jun 2016 21:22:27 +0200, Eric Le Bihan wrote:

> +NINJA_VERSION = v1.7.1
> +NINJA_SITE = $(call github,ninja-build,ninja,$(NINJA_VERSION))
> +NINJA_LICENSE = Apache-2.0
> +NINJA_LICENSE_FILES = COPYING
> +
> +HOST_NINJA_DEPENDENCIES = $(if $(BR2_PACKAGE_PYTHON3),host-python3,host-python)

Sorry for reviving such an old thread, but do you remember why you need
host-python3 or host-python ?

Indeed, this indicates that ninja supports both Python 2.x and Python
3.x, and Buildroot already guarantees that either Python 2.x or Python
3.x is available on the system, without the need to build host-python
or host-python3.

Therefore, why do we have this dependency ?

Thanks!

Thomas
-- 
Thomas Petazzoni, CTO, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

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

end of thread, other threads:[~2018-03-26 21:48 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-24 19:22 [Buildroot] [Patch v3 0/3] Ninja, Meson: new build systems Eric Le Bihan
2016-06-24 19:22 ` [Buildroot] [Patch v3 1/3] ninja: new package Eric Le Bihan
2016-07-03 19:31   ` Yann E. MORIN
2016-07-03 20:27   ` Peter Korsgaard
2018-03-26 21:48   ` Thomas Petazzoni
2016-06-24 19:22 ` [Buildroot] [Patch v3 2/3] python-meson: " Eric Le Bihan
2016-06-26  3:53   ` Baruch Siach
2016-07-03 20:24   ` Yann E. MORIN
2016-07-09 13:06     ` Eric Le Bihan
2016-06-24 19:22 ` [Buildroot] [Patch v3 3/3] docs/manual: document meson-based packages Eric Le Bihan

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.