Skip to contentSkip to conversation

Add meson build system

PATCH Applied [email protected] 3 participants 15 messages Oct 12, 2020 – Oct 28, 2020 10 messages not in the archive Arm/Amlogic Meson SoC support

v5 of 6 Applied Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover Add meson build system

From: Marc-André Lureau <[email protected]>

Hi

This series adds support for meson build system. The main reason for this, beside using a more modern and simpler build system, is to enable subproject() support in QEMU.

v5:
- squashed --build-lib change with "pylibfdt: allow build out of tree" as the two are actually related

v4:
- made setup.py --top-builddir option default to CWD
- extend commit messages
- rebased

v3:
- remove workaround for meson#2992 which is now unnecessary
- add description to meson options
- pass NO_YAML & NO_PYTHON down to run_tests.sh
- commit comment tweaks
- rebased

v2:
- various misc improvements after David Gibson v1 review
- add various meson_options.txt build options
- add editorconfig patch

Marc-André Lureau (3):
pylibfdt: allow build out of tree
build-sys: add meson build
travis: test meson build

 .travis.yml                |  16 +++++
 libfdt/meson.build         |  50 ++++++++++++++
 meson.build                | 127 ++++++++++++++++++++++++++++++++++++
 meson_options.txt          |  10 +++
 pylibfdt/Makefile.pylibfdt |   4 +-
 pylibfdt/meson.build       |  13 ++++
 pylibfdt/setup.py          |  27 +++++---
 tests/meson.build          | 130 +++++++++++++++++++++++++++++++++++++
 version_gen.h.in           |   1 +
 9 files changed, 368 insertions(+), 10 deletions(-)
 create mode 100644 libfdt/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 pylibfdt/meson.build
 create mode 100644 tests/meson.build
 create mode 100644 version_gen.h.in
Signature · 1 line
2.28.0

A message that is not in the archive (sent off-list or not yet received): 20201012073405.1682782-1-marcandre.lureau-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#2 lore raw

PATCH v5 1/3 pylibfdt: allow build out of tree

From: Marc-André Lureau <[email protected]>

With meson, we have to support out-of-tree build.

Introduce a --top-builddir option, which will default to the current directory to lookup generated filed such as version_gen.h and output directories.

Other source paths are derived from the location of the setup.py script in the source tree.

--build-lib is changed to be relative to the current directory, instead of relative to setup.py. This has less surprising results!

---
 pylibfdt/Makefile.pylibfdt |  4 ++--
 pylibfdt/setup.py          | 27 +++++++++++++++++++--------
 2 files changed, 21 insertions(+), 10 deletions(-)
pylibfdt/Makefile.pylibfdt +2 -2
index 6866a0b..1b5f236 100644
@@ -10,7 +10,7 @@ PYLIBFDT_CLEANDIRS_L = build __pycache__
 PYLIBFDT_CLEANDIRS = $(PYLIBFDT_CLEANDIRS_L:%=$(PYLIBFDT_dir)/%)
 
 SETUP = $(PYLIBFDT_dir)/setup.py
-SETUPFLAGS =
+SETUPFLAGS = --top-builddir .
 
 ifndef V
 SETUPFLAGS += --quiet
@@ -18,7 +18,7 @@ endif
 
 $(PYMODULE): $(PYLIBFDT_srcs) $(LIBFDT_archive) $(SETUP) $(VERSION_FILE)
 	@$(VECHO) PYMOD $@
-	$(PYTHON) $(SETUP) $(SETUPFLAGS) build_ext --build-lib=../$(PYLIBFDT_dir)
+	$(PYTHON) $(SETUP) $(SETUPFLAGS) build_ext --build-lib=$(PYLIBFDT_dir)
 
 install_pylibfdt: $(PYMODULE)
 	@$(VECHO) INSTALL-PYLIB
pylibfdt/setup.py +19 -8
index 53f2bef..ef40f15 100755
@@ -19,23 +19,33 @@ import sys
 VERSION_PATTERN = '^#define DTC_VERSION "DTC ([^"]*)"$'
 
 
+def get_top_builddir():
+    if '--top-builddir' in sys.argv:
+        index = sys.argv.index('--top-builddir')
+        sys.argv.pop(index)
+        return sys.argv.pop(index)
+    else:
+        return os.getcwd()
+
+
+srcdir = os.path.dirname(os.path.abspath(sys.argv[0]))
+top_builddir = get_top_builddir()
+
+
 def get_version():
-    version_file = "../version_gen.h"
+    version_file = os.path.join(top_builddir, 'version_gen.h')
     f = open(version_file, 'rt')
     m = re.match(VERSION_PATTERN, f.readline())
     return m.group(1)
 
 
-setupdir = os.path.dirname(os.path.abspath(sys.argv[0]))
-os.chdir(setupdir)
-
 libfdt_module = Extension(
     '_libfdt',
-    sources=['libfdt.i'],
-    include_dirs=['../libfdt'],
+    sources=[os.path.join(srcdir, 'libfdt.i')],
+    include_dirs=[os.path.join(srcdir, '../libfdt')],
     libraries=['fdt'],
-    library_dirs=['../libfdt'],
-    swig_opts=['-I../libfdt'],
+    library_dirs=[os.path.join(top_builddir, 'libfdt')],
+    swig_opts=['-I' + os.path.join(srcdir, '../libfdt')],
 )
 
 setup(
@@ -44,5 +54,6 @@ setup(
     author='Simon Glass <[email protected]>',
     description='Python binding for libfdt',
     ext_modules=[libfdt_module],
+    package_dir={'': srcdir},
     py_modules=['libfdt'],
 )
Signature · 1 line
2.28.0

A message that is not in the archive (sent off-list or not yet received): 20201012073405.1682782-2-marcandre.lureau-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

Applied
#4 lore raw

Re: [PATCH v5 1/3] pylibfdt: allow build out of tree

Quoted 8 lines · On Mon, Oct 12, 2020 at 11:34:03AM +0400…

From: Marc-André Lureau <[email protected]>

With meson, we have to support out-of-tree build.

Introduce a --top-builddir option, which will default to the current directory to lookup generated filed such as version_gen.h and output directories.

Quoted 7 lines

Other source paths are derived from the location of the setup.py script in the source tree.

--build-lib is changed to be relative to the current directory, instead of relative to setup.py. This has less surprising results!

Applied, thanks.

Quoted 80 lines
---
 pylibfdt/Makefile.pylibfdt |  4 ++--
 pylibfdt/setup.py          | 27 +++++++++++++++++++--------
 2 files changed, 21 insertions(+), 10 deletions(-)
pylibfdt/Makefile.pylibfdt +2 -2
index 6866a0b..1b5f236 100644
@@ -10,7 +10,7 @@ PYLIBFDT_CLEANDIRS_L = build __pycache__
 PYLIBFDT_CLEANDIRS = $(PYLIBFDT_CLEANDIRS_L:%=$(PYLIBFDT_dir)/%)
 
 SETUP = $(PYLIBFDT_dir)/setup.py
-SETUPFLAGS =
+SETUPFLAGS = --top-builddir .
 
 ifndef V
 SETUPFLAGS += --quiet
@@ -18,7 +18,7 @@ endif
 
 $(PYMODULE): $(PYLIBFDT_srcs) $(LIBFDT_archive) $(SETUP) $(VERSION_FILE)
 	@$(VECHO) PYMOD $@
-	$(PYTHON) $(SETUP) $(SETUPFLAGS) build_ext --build-lib=../$(PYLIBFDT_dir)
+	$(PYTHON) $(SETUP) $(SETUPFLAGS) build_ext --build-lib=$(PYLIBFDT_dir)
 
 install_pylibfdt: $(PYMODULE)
 	@$(VECHO) INSTALL-PYLIB
pylibfdt/setup.py +19 -8
index 53f2bef..ef40f15 100755
@@ -19,23 +19,33 @@ import sys
 VERSION_PATTERN = '^#define DTC_VERSION "DTC ([^"]*)"$'
 
 
+def get_top_builddir():
+    if '--top-builddir' in sys.argv:
+        index = sys.argv.index('--top-builddir')
+        sys.argv.pop(index)
+        return sys.argv.pop(index)
+    else:
+        return os.getcwd()
+
+
+srcdir = os.path.dirname(os.path.abspath(sys.argv[0]))
+top_builddir = get_top_builddir()
+
+
 def get_version():
-    version_file = "../version_gen.h"
+    version_file = os.path.join(top_builddir, 'version_gen.h')
     f = open(version_file, 'rt')
     m = re.match(VERSION_PATTERN, f.readline())
     return m.group(1)
 
 
-setupdir = os.path.dirname(os.path.abspath(sys.argv[0]))
-os.chdir(setupdir)
-
 libfdt_module = Extension(
     '_libfdt',
-    sources=['libfdt.i'],
-    include_dirs=['../libfdt'],
+    sources=[os.path.join(srcdir, 'libfdt.i')],
+    include_dirs=[os.path.join(srcdir, '../libfdt')],
     libraries=['fdt'],
-    library_dirs=['../libfdt'],
-    swig_opts=['-I../libfdt'],
+    library_dirs=[os.path.join(top_builddir, 'libfdt')],
+    swig_opts=['-I' + os.path.join(srcdir, '../libfdt')],
 )
 
 setup(
@@ -44,5 +54,6 @@ setup(
     author='Simon Glass <[email protected]>',
     description='Python binding for libfdt',
     ext_modules=[libfdt_module],
+    package_dir={'': srcdir},
     py_modules=['libfdt'],
 )
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#5 lore raw

PATCH v5 2/3 build-sys: add meson build

In reply to a message not in the archive

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

---
 libfdt/meson.build   |  50 +++++++++++++++++
 meson.build          | 127 ++++++++++++++++++++++++++++++++++++++++++
 meson_options.txt    |  10 ++++
 pylibfdt/meson.build |  13 +++++
 tests/meson.build    | 130 +++++++++++++++++++++++++++++++++++++++++++
 version_gen.h.in     |   1 +
 6 files changed, 331 insertions(+)
 create mode 100644 libfdt/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 create mode 100644 pylibfdt/meson.build
 create mode 100644 tests/meson.build
 create mode 100644 version_gen.h.in
libfdt/meson.build new file +50 -0
new file mode 100644
index 0000000..0307ffb
@@ -0,0 +1,50 @@
+version_script = '-Wl,--version-script=@0@'.format(meson.current_source_dir() / 'version.lds')
+if not cc.has_link_argument(version_script)
+  version_script = []
+endif
+
+sources = files(
+  'fdt.c',
+  'fdt_addresses.c',
+  'fdt_check.c',
+  'fdt_empty_tree.c',
+  'fdt_overlay.c',
+  'fdt_ro.c',
+  'fdt_rw.c',
+  'fdt_strerror.c',
+  'fdt_sw.c',
+  'fdt_wip.c',
+)
+
+libfdt = library(
+  'fdt', sources,
+  version: '1.6.0',
+  link_args: ['-Wl,--no-undefined', version_script],
+  link_depends: 'version.lds',
+  install: true,
+)
+
+libfdt_inc = include_directories('.')
+
+libfdt_dep = declare_dependency(
+  include_directories: libfdt_inc,
+  link_with: libfdt,
+)
+
+install_headers(
+  files(
+    'fdt.h',
+    'libfdt.h',
+    'libfdt_env.h',
+  )
+)
+
+pkgconfig = import('pkgconfig')
+
+pkgconfig.generate(
+  libraries: libfdt,
+  version: meson.project_version(),
+  filebase: 'libfdt',
+  name: 'libfdt',
+  description: 'Flat Device Tree manipulation',
+)
meson.build new file +127 -0

127 lines not on this page · raw message

meson_options.txt new file +10 -0
new file mode 100644
index 0000000..ea59c28
@@ -0,0 +1,10 @@
+option('tools', type: 'boolean', value: true,
+       description: 'Build tools')
+option('assume-mask', type: 'integer', value: 0,
+       description: 'Control the assumptions made (e.g. risking security issues) in the code.')
+option('yaml', type: 'feature', value: 'auto',
+       description: 'YAML support')
+option('valgrind', type: 'feature', value: 'auto',
+       description: 'Valgrind support')
+option('python', type: 'feature', value: 'auto',
+       description: 'Build pylibfdt Python library')
pylibfdt/meson.build new file +13 -0
new file mode 100644
index 0000000..088f249
@@ -0,0 +1,13 @@
+setup_py = find_program('setup.py')
+setup_py = [setup_py.path(), '--quiet', '--top-builddir', meson.current_build_dir() / '..']
+
+custom_target(
+  'pylibfdt',
+  input: 'libfdt.i',
+  output: '_libfdt.so',
+  depends: version_gen_h,
+  command: [setup_py, 'build_ext', '--build-lib=' + meson.current_build_dir()],
+  build_by_default: true,
+)
+
+meson.add_install_script(setup_py, 'install', '--prefix=' + get_option('prefix'), '--root=$DESTDIR')
tests/meson.build new file +130 -0

130 lines not on this page · raw message

version_gen.h.in new file +1 -0
new file mode 100644
index 0000000..7771abb
@@ -0,0 +1 @@
+#define DTC_VERSION "DTC @VCS_TAG@"
Signature · 1 line
2.28.0

A message that is not in the archive (sent off-list or not yet received): 20201012073405.1682782-3-marcandre.lureau-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#7 lore raw

Re: [PATCH v5 2/3] build-sys: add meson build

Quoted 35 lines · On Mon, Oct 12, 2020 at 11:34:04AM +0400…

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

Quoted 5 lines

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

Can you add some docs on how to actually invoke the meson build. The next patch suggests "meson build", but for me that seems to just configure but not actually build anything:

$ meson build
The Meson build system
Version: 0.55.3
Source dir: /home/dwg/src/dtc
Build dir: /home/dwg/src/dtc/build
Build type: native build
Project name: dtc
Project version: 1.6.0
C compiler for the host machine: ccache cc (gcc 10.2.1 "cc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)")
C linker for the host machine: cc ld.bfd 2.34-5
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wall: YES 
Compiler for C supports arguments -Wpointer-arith: YES 
Compiler for C supports arguments -Wcast-qual: YES 
Compiler for C supports arguments -Wnested-externs: YES 
Compiler for C supports arguments -Wstrict-prototypes: YES 
Compiler for C supports arguments -Wmissing-prototypes: YES 
Compiler for C supports arguments -Wredundant-decls: YES 
Compiler for C supports arguments -Wshadow: YES 
meson.build:18: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
Found pkg-config: /bin/pkg-config (1.6.3)
Run-time dependency yaml-0.1 found: YES 0.2.2
Run-time dependency valgrind found: NO (tried pkgconfig)
Program python3 found: YES (/usr/bin/python3)
Program swig found: YES
Found git repository at /home/dwg/src/dtc
Compiler for C supports link arguments -Wl,--version-script=/home/dwg/src/dtc/libfdt/version.lds: YES 
Program flex found: YES
Program bison found: YES
Check usable header "fnmatch.h" : YES 
Program setup.py found: YES
Program /home/dwg/src/dtc/pylibfdt/setup.py found: YES (/home/dwg/src/dtc/pylibfdt/setup.py)
Library dl found: YES
Program run_tests.sh found: YES
Build targets in project: 81

Found ninja-1.10.1 at /bin/ninja

Having to run "ninja -C build test" to run the tests is then pretty horrible. Especially since it doesn't actually show the test summary from run_tests.sh unless you delve into the logs.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

A message that is not in the archive (sent off-list or not yet received): [email protected]

#9 lore raw

Re: [PATCH v5 2/3] build-sys: add meson build

Hi

Quoted 41 lines · David Gibson
Quoted 39 lines · On Mon, Oct 12, 2020 at 11:34:04AM +0400…

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

Quoted 5 lines
Quoted 1 line

Can you add some docs on how to actually invoke the meson build. The next patch suggests "meson build", but for me that seems to just configure but not actually build anything:

Sure, the way to invoke it is just like a regular meson project. I will add some notes to the README.

Quoted 38 lines
$ meson build
The Meson build system
Version: 0.55.3
Source dir: /home/dwg/src/dtc
Build dir: /home/dwg/src/dtc/build
Build type: native build
Project name: dtc
Project version: 1.6.0
C compiler for the host machine: ccache cc (gcc 10.2.1 "cc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)")
C linker for the host machine: cc ld.bfd 2.34-5
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wcast-qual: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wmissing-prototypes: YES
Compiler for C supports arguments -Wredundant-decls: YES
Compiler for C supports arguments -Wshadow: YES
meson.build:18: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
Found pkg-config: /bin/pkg-config (1.6.3)
Run-time dependency yaml-0.1 found: YES 0.2.2
Run-time dependency valgrind found: NO (tried pkgconfig)
Program python3 found: YES (/usr/bin/python3)
Program swig found: YES
Found git repository at /home/dwg/src/dtc
Compiler for C supports link arguments -Wl,--version-script=/home/dwg/src/dtc/libfdt/version.lds: YES
Program flex found: YES
Program bison found: YES
Check usable header "fnmatch.h" : YES
Program setup.py found: YES
Program /home/dwg/src/dtc/pylibfdt/setup.py found: YES (/home/dwg/src/dtc/pylibfdt/setup.py)
Library dl found: YES
Program run_tests.sh found: YES
Build targets in project: 81
Quoted 5 lines

Found ninja-1.10.1 at /bin/ninja

Having to run "ninja -C build test" to run the tests is then pretty horrible. Especially since it doesn't actually show the test summary from run_tests.sh unless you delve into the logs.

If an error occurred, it would print it on the console. But to get a summary on success, you have to look at the log: run_tests.sh isn't very nice for meson. It would be better if it provided TAP output, or even better probably, if the tests would be run by meson.

Quoted 6 lines

--

David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!

http://www.ozlabs.org/~dgibson

A message that is not in the archive (sent off-list or not yet received): CAMxuvazLYGVnQxQec9t0GNRF5_g8JvPKiX1=tNqqAY4itZ1JYg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#11 lore raw

Re: [PATCH v5 2/3] build-sys: add meson build

Quoted 45 lines · Marc-André Lureau

Hi

Quoted 41 lines · David Gibson
Quoted 39 lines · On Mon, Oct 12, 2020 at 11:34:04AM +0400…

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Can you add some docs on how to actually invoke the meson build. The next patch suggests "meson build", but for me that seems to just configure but not actually build anything:

Sure, the way to invoke it is just like a regular meson project.

Well, sure, but meson is not yet widespread enough that we can assume people know what that is. The only meson project I'm familiar with is qemu, and I still invoke it via "make".

Quoted 41 lines

I
will add some notes to the README.

Quoted 38 lines
$ meson build
The Meson build system
Version: 0.55.3
Source dir: /home/dwg/src/dtc
Build dir: /home/dwg/src/dtc/build
Build type: native build
Project name: dtc
Project version: 1.6.0
C compiler for the host machine: ccache cc (gcc 10.2.1 "cc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)")
C linker for the host machine: cc ld.bfd 2.34-5
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wcast-qual: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wmissing-prototypes: YES
Compiler for C supports arguments -Wredundant-decls: YES
Compiler for C supports arguments -Wshadow: YES
meson.build:18: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
Found pkg-config: /bin/pkg-config (1.6.3)
Run-time dependency yaml-0.1 found: YES 0.2.2
Run-time dependency valgrind found: NO (tried pkgconfig)
Program python3 found: YES (/usr/bin/python3)
Program swig found: YES
Found git repository at /home/dwg/src/dtc
Compiler for C supports link arguments -Wl,--version-script=/home/dwg/src/dtc/libfdt/version.lds: YES
Program flex found: YES
Program bison found: YES
Check usable header "fnmatch.h" : YES
Program setup.py found: YES
Program /home/dwg/src/dtc/pylibfdt/setup.py found: YES (/home/dwg/src/dtc/pylibfdt/setup.py)
Library dl found: YES
Program run_tests.sh found: YES
Build targets in project: 81
Quoted 7 lines
Quoted 5 lines

Found ninja-1.10.1 at /bin/ninja

Having to run "ninja -C build test" to run the tests is then pretty horrible. Especially since it doesn't actually show the test summary from run_tests.sh unless you delve into the logs.

If an error occurred, it would print it on the console.

Ok, that helps substantially. Still too wordy and non-obvious to invoke it though.

Quoted 4 lines

But to get a
summary on success, you have to look at the log: run_tests.sh isn't very nice for meson. It would be better if it provided TAP output, or even better probably, if the tests would be run by meson.

Well, sure, but when I started the dtc testsuite all the test frameworks I could find were so intimidating I never would have started writing actual tests if I'd tried to use them.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

A message that is not in the archive (sent off-list or not yet received): [email protected]

#13 lore raw

Re: [PATCH v5 2/3] build-sys: add meson build

Hi

Quoted 53 lines · David Gibson
Quoted 51 lines · Marc-André Lureau

Hi

Quoted 46 lines · David Gibson
Quoted 35 lines · On Mon, Oct 12, 2020 at 11:34:04AM +0400…

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

Quoted 5 lines

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

Can you add some docs on how to actually invoke the meson build. The next patch suggests "meson build", but for me that seems to just configure but not actually build anything:

Quoted 5 lines
Quoted 1 line

Sure, the way to invoke it is just like a regular meson project.

Well, sure, but meson is not yet widespread enough that we can assume people know what that is. The only meson project I'm familiar with is qemu, and I still invoke it via "make".

Would it help if configure & make wrap meson for you?

Should we then drop the Makefile-based build system?

Quoted 44 lines
Quoted 44 lines

I
will add some notes to the README.

Quoted 40 lines
$ meson build
The Meson build system
Version: 0.55.3
Source dir: /home/dwg/src/dtc
Build dir: /home/dwg/src/dtc/build
Build type: native build
Project name: dtc
Project version: 1.6.0
C compiler for the host machine: ccache cc (gcc 10.2.1 "cc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)")
C linker for the host machine: cc ld.bfd 2.34-5
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wcast-qual: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wmissing-prototypes: YES
Compiler for C supports arguments -Wredundant-decls: YES
Compiler for C supports arguments -Wshadow: YES
meson.build:18: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
Found pkg-config: /bin/pkg-config (1.6.3)
Run-time dependency yaml-0.1 found: YES 0.2.2
Run-time dependency valgrind found: NO (tried pkgconfig)
Program python3 found: YES (/usr/bin/python3)
Program swig found: YES
Found git repository at /home/dwg/src/dtc
Compiler for C supports link arguments -Wl,--version-script=/home/dwg/src/dtc/libfdt/version.lds: YES
Program flex found: YES
Program bison found: YES
Check usable header "fnmatch.h" : YES
Program setup.py found: YES
Program /home/dwg/src/dtc/pylibfdt/setup.py found: YES (/home/dwg/src/dtc/pylibfdt/setup.py)
Library dl found: YES
Program run_tests.sh found: YES
Build targets in project: 81

Found ninja-1.10.1 at /bin/ninja

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Having to run "ninja -C build test" to run the tests is then pretty horrible. Especially since it doesn't actually show the test summary from run_tests.sh unless you delve into the logs.

If an error occurred, it would print it on the console.

Ok, that helps substantially. Still too wordy and non-obvious to invoke it though.

We could "make check" run the script in a more verbose way if we decide to wrap meson build there.

Quoted 9 lines
Quoted 5 lines

But to get a
summary on success, you have to look at the log: run_tests.sh isn't very nice for meson. It would be better if it provided TAP output, or even better probably, if the tests would be run by meson.

Well, sure, but when I started the dtc testsuite all the test frameworks I could find were so intimidating I never would have started writing actual tests if I'd tried to use them.

fwiw, I used BATS (https://github.com/sstephenson/bats) in some other project that was using shell to test executables. I can investigate that too for a future series if you don't mind relying on bash & git submodules ;).

A message that is not in the archive (sent off-list or not yet received): CAMxuvax2Rc3ADTxCBWHb0b6OoGDWRsg3GEe+gH6YPe0M0+pNXw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#15 lore raw

Re: [PATCH v5 2/3] build-sys: add meson build

Quoted 130 lines · Marc-André Lureau

Hi

Quoted 53 lines · David Gibson
Quoted 51 lines · Marc-André Lureau

Hi

Quoted 46 lines · David Gibson
Quoted 35 lines · On Mon, Oct 12, 2020 at 11:34:04AM +0400, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

Quoted 5 lines

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

Can you add some docs on how to actually invoke the meson build. The next patch suggests "meson build", but for me that seems to just configure but not actually build anything:

Quoted 5 lines
Quoted 1 line

Sure, the way to invoke it is just like a regular meson project.

Well, sure, but meson is not yet widespread enough that we can assume people know what that is. The only meson project I'm familiar with is qemu, and I still invoke it via "make".

Would it help if configure & make wrap meson for you?

Should we then drop the Makefile-based build system?

Quoted 44 lines
Quoted 44 lines

I
will add some notes to the README.

Quoted 40 lines
$ meson build
The Meson build system
Version: 0.55.3
Source dir: /home/dwg/src/dtc
Build dir: /home/dwg/src/dtc/build
Build type: native build
Project name: dtc
Project version: 1.6.0
C compiler for the host machine: ccache cc (gcc 10.2.1 "cc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)")
C linker for the host machine: cc ld.bfd 2.34-5
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wcast-qual: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wmissing-prototypes: YES
Compiler for C supports arguments -Wredundant-decls: YES
Compiler for C supports arguments -Wshadow: YES
meson.build:18: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
Found pkg-config: /bin/pkg-config (1.6.3)
Run-time dependency yaml-0.1 found: YES 0.2.2
Run-time dependency valgrind found: NO (tried pkgconfig)
Program python3 found: YES (/usr/bin/python3)
Program swig found: YES
Found git repository at /home/dwg/src/dtc
Compiler for C supports link arguments -Wl,--version-script=/home/dwg/src/dtc/libfdt/version.lds: YES
Program flex found: YES
Program bison found: YES
Check usable header "fnmatch.h" : YES
Program setup.py found: YES
Program /home/dwg/src/dtc/pylibfdt/setup.py found: YES (/home/dwg/src/dtc/pylibfdt/setup.py)
Library dl found: YES
Program run_tests.sh found: YES
Build targets in project: 81

Found ninja-1.10.1 at /bin/ninja

Quoted 8 lines
Quoted 5 lines
Quoted 3 lines

Having to run "ninja -C build test" to run the tests is then pretty horrible. Especially since it doesn't actually show the test summary from run_tests.sh unless you delve into the logs.

If an error occurred, it would print it on the console.

Ok, that helps substantially. Still too wordy and non-obvious to invoke it though.

We could "make check" run the script in a more verbose way if we decide to wrap meson build there.

Quoted 6 lines
Quoted 5 lines

But to get a
summary on success, you have to look at the log: run_tests.sh isn't very nice for meson. It would be better if it provided TAP output, or even better probably, if the tests would be run by meson.

Quoted 8 lines
Quoted 3 lines

Well, sure, but when I started the dtc testsuite all the test frameworks I could find were so intimidating I never would have started writing actual tests if I'd tried to use them.

fwiw, I used BATS (https://github.com/sstephenson/bats) in some other project that was using shell to test executables. I can investigate that too for a future series if you don't mind relying on bash & git submodules ;).

Actually I used bats-core (https://github.com/bats-core/bats-core/)
which is a maintained version of unmaintained BATS.

#16 lore raw

Re: [PATCH v5 2/3] build-sys: add meson build

In reply to a message not in the archive
Quoted 63 lines · Marc-André Lureau

Hi

Quoted 58 lines · David Gibson
Quoted 45 lines · Marc-André Lureau

Hi

Quoted 41 lines · David Gibson
Quoted 39 lines · On Mon, Oct 12, 2020 at 11:34:04AM +0400, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Can you add some docs on how to actually invoke the meson build. The next patch suggests "meson build", but for me that seems to just configure but not actually build anything:

Sure, the way to invoke it is just like a regular meson project.

Well, sure, but meson is not yet widespread enough that we can assume people know what that is. The only meson project I'm familiar with is qemu, and I still invoke it via "make".

I've used meson in a couple of projects and it's still not quite in my muscle memory. In any case, pretty much every project documents how to build and install.

Quoted 1 line

Would it help if configure & make wrap meson for you?

I'd say only if that means dropping the bulk of the Makefiles.

Quoted 1 line

Should we then drop the Makefile-based build system?

What do most projects do? Distro packagers just deal with the change when updating versions, or projects carry both until the main distros have updated to meson builds?

Rob

A message that is not in the archive (sent off-list or not yet received): CAL_Jsq+bOxx=2rahno6yqbV_T7_DpzGjKsqmu9=iWcum-PjBKg-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org

#18 lore raw

Re: [PATCH v5 2/3] build-sys: add meson build

Hi

Quoted 73 lines · Rob Herring
Quoted 63 lines · Marc-André Lureau

Hi

Quoted 58 lines · David Gibson
Quoted 45 lines · Marc-André Lureau

Hi

Quoted 41 lines · David Gibson
Quoted 39 lines · On Mon, Oct 12, 2020 at 11:34:04AM +0400, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Can you add some docs on how to actually invoke the meson build. The next patch suggests "meson build", but for me that seems to just configure but not actually build anything:

Sure, the way to invoke it is just like a regular meson project.

Well, sure, but meson is not yet widespread enough that we can assume people know what that is. The only meson project I'm familiar with is qemu, and I still invoke it via "make".

I've used meson in a couple of projects and it's still not quite in my muscle memory. In any case, pretty much every project documents how to build and install.

Quoted 1 line

Would it help if configure & make wrap meson for you?

Quoted 7 lines

I'd say only if that means dropping the bulk of the Makefiles.

Quoted 1 line

Should we then drop the Makefile-based build system?

What do most projects do? Distro packagers just deal with the change when updating versions, or projects carry both until the main distros have updated to meson builds?

It depends, as meson is still a fairly recent build system. Early adopters had some transition period where both Makefile/autotools and meson were maintained side by side to ease that transition (iirc, mesa or glib), especially for older distro. But recently, a lot of projects have done a full switch (libvirt & qemu for example), even though they target quite ancient distro (up to 2y old-stable/LTS for example). They manage to do that in some cases by shipping meson as a submodule (or relying on pip at build-time in some distros perhaps).

I don't remember checking which version is required by the meson.build proposed here. I can do that, if it helps. Then we can compare with what's available out of the box from various distros via
https://repology.org/project/meson/versions.

We can make it easier for the packager by wraping meson in configure & make shim, as done by various projects. But tbh, I don't think it helps the packager, as he still need to be aware that meson is required. And nowadays, there are various macros or declarative ways to package meson projects in various distros.

#19 lore raw

Re: [PATCH v5 2/3] build-sys: add meson build

In reply to a message not in the archive
Quoted 57 lines · Marc-André Lureau

Hi

Quoted 53 lines · David Gibson
Quoted 51 lines · Marc-André Lureau

Hi

Quoted 46 lines · David Gibson
Quoted 35 lines · On Mon, Oct 12, 2020 at 11:34:04AM +0400, [email protected] wrote:

From: Marc-André Lureau <[email protected]>

The meson build system allows projects to "vendor" dtc easily, thanks to subproject(). QEMU has recently switched to meson, and adding meson support to dtc will help to handle the QEMU submodule.

meson rules are arguably simpler to write and maintain than the hand-crafted/custom Makefile. meson support various backends, and default build options (including coverage, sanitizer, debug/release etc, see: https://mesonbuild.com/Builtin-options.html)

Compare to the Makefiles, the same build targets should be built and installed and the same tests should be run ("meson test" can be provided extra test arguments for running the equivalent of checkm/checkv).

There is no support EXTRAVERSION/LOCAL_VERSION/CONFIG_LOCALVERSION, instead the version is simply set with project(), and vcs_tag() is used for git/dirty version reporting (This is most common and is hopefully enough. If necessary, configure-time options could be added for extra versioning.).

libfdt shared library is build following regular naming conventions:
instead of libfdt.so.1 -> libfdt-1.6.0.so (with current build-sys), libfdt.so.1 -> libfdt.so.1.6.0. I am not sure why the current build system use an uncommon naming pattern. I also included a libfdt.pc pkg-config file, as convenience.

Both Linux native build and mingw cross-build pass. CI pass. Tests are only run on native build.

The current Makefiles are left in-tree, and make/check still work. Eventually, the Makefiles could be marked as deprecated, to start a transition period and avoid having to maintain 2 build systems in the near future.

Quoted 5 lines

(run_tests.sh could eventually be replaced by the meson test runner, which would have several advantages in term of flexibility/features, but this is left for another day)

Can you add some docs on how to actually invoke the meson build. The next patch suggests "meson build", but for me that seems to just configure but not actually build anything:

Quoted 7 lines
Quoted 5 lines
Quoted 1 line

Sure, the way to invoke it is just like a regular meson project.

Well, sure, but meson is not yet widespread enough that we can assume people know what that is. The only meson project I'm familiar with is qemu, and I still invoke it via "make".

Would it help if configure & make wrap meson for you?

That sounds like it could be a good idea. Although there is no "configure" for dtc.

Quoted 50 lines

Should we then drop the Makefile-based build system?

Quoted 48 lines
Quoted 48 lines

I
will add some notes to the README.

Quoted 43 lines
$ meson build
The Meson build system
Version: 0.55.3
Source dir: /home/dwg/src/dtc
Build dir: /home/dwg/src/dtc/build
Build type: native build
Project name: dtc
Project version: 1.6.0
C compiler for the host machine: ccache cc (gcc 10.2.1 "cc (GCC) 10.2.1 20200723 (Red Hat 10.2.1-1)")
C linker for the host machine: cc ld.bfd 2.34-5
Host machine cpu family: x86_64
Host machine cpu: x86_64
Compiler for C supports arguments -Wall: YES
Compiler for C supports arguments -Wpointer-arith: YES
Compiler for C supports arguments -Wcast-qual: YES
Compiler for C supports arguments -Wnested-externs: YES
Compiler for C supports arguments -Wstrict-prototypes: YES
Compiler for C supports arguments -Wmissing-prototypes: YES
Compiler for C supports arguments -Wredundant-decls: YES
Compiler for C supports arguments -Wshadow: YES
meson.build:18: WARNING: Consider using the built-in warning_level option instead of using "-Wall".
Found pkg-config: /bin/pkg-config (1.6.3)
Run-time dependency yaml-0.1 found: YES 0.2.2
Run-time dependency valgrind found: NO (tried pkgconfig)
Program python3 found: YES (/usr/bin/python3)
Program swig found: YES
Found git repository at /home/dwg/src/dtc
Compiler for C supports link arguments -Wl,--version-script=/home/dwg/src/dtc/libfdt/version.lds: YES
Program flex found: YES
Program bison found: YES
Check usable header "fnmatch.h" : YES
Program setup.py found: YES
Program /home/dwg/src/dtc/pylibfdt/setup.py found: YES (/home/dwg/src/dtc/pylibfdt/setup.py)
Library dl found: YES
Program run_tests.sh found: YES
Build targets in project: 81

Found ninja-1.10.1 at /bin/ninja

Having to run "ninja -C build test" to run the tests is then pretty horrible. Especially since it doesn't actually show the test summary from run_tests.sh unless you delve into the logs.

Quoted 7 lines
Quoted 4 lines
Quoted 1 line

If an error occurred, it would print it on the console.

Ok, that helps substantially. Still too wordy and non-obvious to invoke it though.

We could "make check" run the script in a more verbose way if we decide to wrap meson build there.

I guess. It concerns me if there's no more succinct "meson native" way of invoking the tests.

Quoted 5 lines
Quoted 5 lines
Quoted 4 lines

But to get a
summary on success, you have to look at the log: run_tests.sh isn't very nice for meson. It would be better if it provided TAP output, or even better probably, if the tests would be run by meson.

Quoted 8 lines
Quoted 3 lines

Well, sure, but when I started the dtc testsuite all the test frameworks I could find were so intimidating I never would have started writing actual tests if I'd tried to use them.

fwiw, I used BATS (https://github.com/sstephenson/bats) in some other project that was using shell to test executables. I can investigate that too for a future series if you don't mind relying on bash & git submodules ;).

Patches considered, but I absolutely do not have time to tackle porting the dtc testsuite to a different framework myself.

Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson
#20 lore raw

PATCH v5 3/3 travis: test meson build

In reply to a message not in the archive

From: Marc-André Lureau <[email protected]>

---
 .travis.yml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
.travis.yml +16 -0
index a5163de..e2d74a4 100644
@@ -6,6 +6,12 @@ env:
   # COVERITY_SCAN_TOKEN (dgibson/dtc)
   - secure: "vlHvXe618//IM9LQaKzqsrUbjs7ng0L9UCST4kJbJnFQDXvVe5JiSmJGd4ef7mm0NUv5bMRl2W3xCiu6BYAu/NvU3tMNHoLG+JgCJs0+wLJXbWOwji/NmH7olqgJG+CmpaCMXjARF6+nrTnBYHJL6cYyf4KVoV4B0I/hLUW91+s="
 
+before_install:
+  - '[ $TRAVIS_CPU_ARCH = amd64 ] && sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu xenial-backports main universe" || sudo add-apt-repository -y "deb http://ports.ubuntu.com xenial-backports main universe"'
+  - sudo apt-get -q update
+  - sudo apt-get -t xenial-backports install -y python3 python3-setuptools python3-pip ninja-build
+  - sudo pip3 install meson
+
 matrix:
   include:
     - addons:
@@ -25,12 +31,16 @@ matrix:
       script:
         - make
         - make check && make checkm
+        - meson build
+        - ninja -C build test
 
     # Check it builds properly without optional packages:
     #     python, valgrind, libyaml
     - script:
         - make
         - make check
+        - meson build
+        - ninja -C build test
 
     - arch: arm64
       addons:
@@ -42,6 +52,8 @@ matrix:
       script:
         - make
         - make check checkm
+        - meson build
+        - ninja -C build test
 
     - arch: ppc64le
       addons:
@@ -52,6 +64,8 @@ matrix:
       script:
         - make
         - make check
+        - meson build
+        - ninja -C build test
 
     - arch: s390x
       addons:
@@ -63,3 +77,5 @@ matrix:
       script:
         - make
         - make check checkm
+        - meson build
+        - ninja -C build test
Signature · 1 line
2.28.0

A message that is not in the archive (sent off-list or not yet received): 20201012073405.1682782-4-marcandre.lureau-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org

#22 lore raw

Re: [PATCH v5 3/3] travis: test meson build

Quoted 25 lines · On Mon, Oct 12, 2020 at 11:34:05AM +0400…

From: Marc-André Lureau <[email protected]>

---
 .travis.yml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
.travis.yml +6 -0
index a5163de..e2d74a4 100644
@@ -6,6 +6,12 @@ env:
   # COVERITY_SCAN_TOKEN (dgibson/dtc)
   - secure: "vlHvXe618//IM9LQaKzqsrUbjs7ng0L9UCST4kJbJnFQDXvVe5JiSmJGd4ef7mm0NUv5bMRl2W3xCiu6BYAu/NvU3tMNHoLG+JgCJs0+wLJXbWOwji/NmH7olqgJG+CmpaCMXjARF6+nrTnBYHJL6cYyf4KVoV4B0I/hLUW91+s="
 
+before_install:
+  - '[ $TRAVIS_CPU_ARCH = amd64 ] && sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu xenial-backports main universe" || sudo add-apt-repository -y "deb http://ports.ubuntu.com xenial-backports main universe"'
+  - sudo apt-get -q update
+  - sudo apt-get -t xenial-backports install -y python3 python3-setuptools python3-pip ninja-build
+  - sudo pip3 install meson
+
 matrix:
   include:
     - addons:

.travis.yml matrix: · line 35

Quoted 5 lines
.travis.yml +2 -0
@@ -25,12 +31,16 @@ matrix:
       script:
         - make
         - make check && make checkm
+        - meson build
+        - ninja -C build test

I'd prefer that the meson builds be done as separate travis subjobs. That way we can be confident that both the legacy-make and meson builds work, without subtle requirements on having run the other one first.

Quoted 35 lines
.travis.yml +8 -0
     # Check it builds properly without optional packages:
     #     python, valgrind, libyaml
     - script:
         - make
         - make check
+        - meson build
+        - ninja -C build test
 
     - arch: arm64
       addons:
@@ -42,6 +52,8 @@ matrix:
       script:
         - make
         - make check checkm
+        - meson build
+        - ninja -C build test
 
     - arch: ppc64le
       addons:
@@ -52,6 +64,8 @@ matrix:
       script:
         - make
         - make check
+        - meson build
+        - ninja -C build test
 
     - arch: s390x
       addons:
@@ -63,3 +77,5 @@ matrix:
       script:
         - make
         - make check checkm
+        - meson build
+        - ninja -C build test
Signature · 4 lines
David Gibson			| I'll have my music baroque, and my code
david AT gibson.dropbear.id.au	| minimalist, thank you.  NOT _the_ _other_
				| _way_ _around_!
http://www.ozlabs.org/~dgibson

A message that is not in the archive (sent off-list or not yet received): [email protected]

#24 lore raw

Re: [PATCH v5 3/3] travis: test meson build

Hi

Quoted 29 lines · David Gibson
Quoted 27 lines · On Mon, Oct 12, 2020 at 11:34:05AM +0400…

From: Marc-André Lureau <[email protected]>

---
 .travis.yml | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
.travis.yml +6 -0
index a5163de..e2d74a4 100644
@@ -6,6 +6,12 @@ env:
   # COVERITY_SCAN_TOKEN (dgibson/dtc)
   - secure: "vlHvXe618//IM9LQaKzqsrUbjs7ng0L9UCST4kJbJnFQDXvVe5JiSmJGd4ef7mm0NUv5bMRl2W3xCiu6BYAu/NvU3tMNHoLG+JgCJs0+wLJXbWOwji/NmH7olqgJG+CmpaCMXjARF6+nrTnBYHJL6cYyf4KVoV4B0I/hLUW91+s="
 
+before_install:
+  - '[ $TRAVIS_CPU_ARCH = amd64 ] && sudo add-apt-repository -y "deb http://archive.ubuntu.com/ubuntu xenial-backports main universe" || sudo add-apt-repository -y "deb http://ports.ubuntu.com xenial-backports main universe"'
+  - sudo apt-get -q update
+  - sudo apt-get -t xenial-backports install -y python3 python3-setuptools python3-pip ninja-build
+  - sudo pip3 install meson
+
 matrix:
   include:
     - addons:
@@ -25,12 +31,16 @@ matrix:
       script:
         - make
Quoted 9 lines

.travis.yml matrix: · line 35

Quoted 3 lines
.travis.yml +2 -0
         - make check && make checkm
+        - meson build
+        - ninja -C build test

I'd prefer that the meson builds be done as separate travis subjobs. That way we can be confident that both the legacy-make and meson builds work, without subtle requirements on having run the other one first.

Tbh, I don't know how to do that. Each .travis-ci file I look at is so different, and testing them is a pain (push to git, check the webpage..). Any idea?

Quoted 41 lines
Quoted 30 lines
.travis.yml +6 -0
     # Check it builds properly without optional packages:
     #     python, valgrind, libyaml
     - script:
         - make
         - make check
+        - meson build
+        - ninja -C build test
 
     - arch: arm64
       addons:
@@ -42,6 +52,8 @@ matrix:
       script:
         - make
         - make check checkm
+        - meson build
+        - ninja -C build test
 
     - arch: ppc64le
       addons:
@@ -52,6 +64,8 @@ matrix:
       script:
         - make
         - make check
+        - meson build
+        - ninja -C build test
 
     - arch: s390x
       addons:

.travis.yml matrix: · line 81

Quoted 5 lines
.travis.yml +2 -0
@@ -63,3 +77,5 @@ matrix:
       script:
         - make
         - make check checkm
+        - meson build
+        - ninja -C build test

--

David Gibson                    | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au  | minimalist, thank you.  NOT _the_ _other_
                                | _way_ _around_!

http://www.ozlabs.org/~dgibson