Devicetree Compiler
 help / color / mirror / Atom feed
* [PATCH 1/2] README: Explain how to build with meson
@ 2026-10-28 11:20 Simon Glass
  2026-10-28 11:20 ` [PATCH 2/2] README: Use meson in the Python section Simon Glass
                   ` (2 more replies)
  0 siblings, 3 replies; 6+ messages in thread
From: Simon Glass @ 2026-10-28 11:20 UTC (permalink / raw)
  To: Devicetree Compiler; +Cc: David Gibson, Simon Glass

Building with make is deprecated in favour of meson, but README.md only
gives instructions for make, in its Python section, and CONTRIBUTING.md
says to use 'make check'. The meson commands only appear in the warning
which the Makefile prints.

Add a short Building section to README.md with the meson commands for
building, testing and installing, pointing to the Meson quick guide and
to scripts/install-deps.sh. Use meson for running the tests in
CONTRIBUTING.md too.

Closes: https://github.com/dgibson/dtc/issues/83
Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 CONTRIBUTING.md |  4 ++--
 README.md       | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9742dc3..caf0210 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -17,8 +17,8 @@ works with pylibfdt. If it cannot be supported, put the declaration in
 
 ## Tests
 
-Test files are kept in the `tests/` directory. Use `make check` to build and run
-all tests.
+Test files are kept in the `tests/` directory. Use `meson test -C build` to
+build and run all tests (see [README.md](README.md#building)).
 
 If you want to adjust a test file, be aware that `tree_tree1.dts` is compiled
 and checked against a binary tree from assembler macros in `trees.S`. So
diff --git a/README.md b/README.md
index 8f1a5d2..ed9039d 100644
--- a/README.md
+++ b/README.md
@@ -8,6 +8,25 @@ dtc and libfdt are maintained by:
 
 * [David Gibson `<david@gibson.dropbear.id.au>`](mailto:david@gibson.dropbear.id.au)
 
+## Building
+
+dtc and libfdt are built with [Meson](https://mesonbuild.com/):
+
+```
+$ meson setup build
+$ meson compile -C build
+$ meson test -C build
+$ meson install -C build
+```
+
+`meson configure build` lists the build options, e.g. `-Dpython=disabled`
+to skip the Python library. See the
+[Meson quick guide](https://mesonbuild.com/Quick-guide.html) for more,
+such as installing with `--destdir`. `scripts/install-deps.sh` installs
+the packages needed on common systems.
+
+Building with `make` still works but is deprecated.
+
 ## Python library
 
 A Python library wrapping libfdt is also available. To build this you
---
base-commit: 1d50f3f8fa8bf9429eebb0769dafa5df37381ae1
branch: readme-meson

-- 
2.43.0


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

* [PATCH 2/2] README: Use meson in the Python section
  2026-10-28 11:20 [PATCH 1/2] README: Explain how to build with meson Simon Glass
@ 2026-10-28 11:20 ` Simon Glass
  2026-10-28 20:05   ` Herve Codina
  2026-10-29  1:17   ` David Gibson
  2026-10-28 19:52 ` [PATCH 1/2] README: Explain how to build with meson Herve Codina
  2026-10-29  1:17 ` David Gibson
  2 siblings, 2 replies; 6+ messages in thread
From: Simon Glass @ 2026-10-28 11:20 UTC (permalink / raw)
  To: Devicetree Compiler; +Cc: David Gibson, Simon Glass

The Python section of README.md assumes a make build. It installs with
'make install', disables the library with NO_PYTHON, and runs its
examples from the source tree, where make puts the built module. With
meson the module is in the build directory instead, so the help example
quietly imports whatever libfdt is installed, and the coverage example
fails.

Use meson to install and to disable the Python library, and run the
examples from the build directory.

Assisted-by: Claude:claude-opus-5-5
Signed-off-by: Simon Glass <sjg@chromium.org>
---

 README.md | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/README.md b/README.md
index ed9039d..fcfc2e5 100644
--- a/README.md
+++ b/README.md
@@ -37,7 +37,8 @@ distributions:
 $ sudo apt-get install swig python3-dev
 ```
 
-The library provides an `Fdt` class which you can use like this:
+The library provides an `Fdt` class which you can use like this, from
+`build/tests` after running the tests:
 
 ```
 $ PYTHONPATH=../pylibfdt python3
@@ -59,7 +60,7 @@ You will find tests in `tests/pylibfdt_tests.py` showing how to use each
 method. Help is available using the Python help command, e.g.:
 
 ```
-$ cd pylibfdt
+$ cd build/pylibfdt
 $ python3 -c "import libfdt; help(libfdt)"
 ```
 
@@ -67,9 +68,9 @@ If you add new features, please check code coverage:
 
 ```
 $ sudo apt-get install python3-coverage
-$ cd tests
+$ cd build/tests
 # It's just 'coverage' on most other distributions
-$ python3-coverage run pylibfdt_tests.py
+$ python3-coverage run ../../tests/pylibfdt_tests.py
 $ python3-coverage html
 # Open 'htmlcov/index.html' in your browser
 ```
@@ -91,20 +92,21 @@ host system first. Generally, using `--user` or `--prefix` is not
 necessary and pip will use the default location for the Python
 installation which varies if the user is root or not.
 
-You can also install everything via make if you like, but pip is
+You can also install everything with meson if you like, but pip is
 recommended.
 
 To install both libfdt and pylibfdt you can use:
 
 ```
-$ make install [PREFIX=/path/to/install_dir]
+$ meson setup [--prefix=/path/to/install_dir] build
+$ meson install -C build
 ```
 
 To disable building the python library, even if swig and Python are available,
 use:
 
 ```
-$ make NO_PYTHON=1
+$ meson setup -Dpython=disabled build
 ```
 
 More work remains to support all of libfdt, including access to numeric
---
base-commit: 1d50f3f8fa8bf9429eebb0769dafa5df37381ae1
branch: readme-meson

-- 
2.43.0


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

* Re: [PATCH 1/2] README: Explain how to build with meson
  2026-10-28 11:20 [PATCH 1/2] README: Explain how to build with meson Simon Glass
  2026-10-28 11:20 ` [PATCH 2/2] README: Use meson in the Python section Simon Glass
@ 2026-10-28 19:52 ` Herve Codina
  2026-10-29  1:17 ` David Gibson
  2 siblings, 0 replies; 6+ messages in thread
From: Herve Codina @ 2026-10-28 19:52 UTC (permalink / raw)
  To: Simon Glass; +Cc: Devicetree Compiler, David Gibson

Hi Simon,

On Wed, 28 Oct 2026 05:20:01 -0600
Simon Glass <sjg@chromium.org> wrote:

> Building with make is deprecated in favour of meson, but README.md only
> gives instructions for make, in its Python section, and CONTRIBUTING.md
> says to use 'make check'. The meson commands only appear in the warning
> which the Makefile prints.
> 
> Add a short Building section to README.md with the meson commands for
> building, testing and installing, pointing to the Meson quick guide and
> to scripts/install-deps.sh. Use meson for running the tests in
> CONTRIBUTING.md too.
> 
> Closes: https://github.com/dgibson/dtc/issues/83
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  CONTRIBUTING.md |  4 ++--
>  README.md       | 19 +++++++++++++++++++
>  2 files changed, 21 insertions(+), 2 deletions(-)
> 

Thanks for having improved those documents.

Reviewed-by: Herve Codina <herve.codina@bootlin.com>

Best regards,
Hervé

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

* Re: [PATCH 2/2] README: Use meson in the Python section
  2026-10-28 11:20 ` [PATCH 2/2] README: Use meson in the Python section Simon Glass
@ 2026-10-28 20:05   ` Herve Codina
  2026-10-29  1:17   ` David Gibson
  1 sibling, 0 replies; 6+ messages in thread
From: Herve Codina @ 2026-10-28 20:05 UTC (permalink / raw)
  To: Simon Glass; +Cc: Devicetree Compiler, David Gibson

Hi Simon,

On Wed, 28 Oct 2026 05:20:02 -0600
Simon Glass <sjg@chromium.org> wrote:

> The Python section of README.md assumes a make build. It installs with
> 'make install', disables the library with NO_PYTHON, and runs its
> examples from the source tree, where make puts the built module. With
> meson the module is in the build directory instead, so the help example
> quietly imports whatever libfdt is installed, and the coverage example
> fails.
> 
> Use meson to install and to disable the Python library, and run the
> examples from the build directory.
> 
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> 
>  README.md | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 

LGMT.

Reviewed-by: Herve Codina <herve.codina@bootlin.com>

Best regards,
Hervé

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

* Re: [PATCH 1/2] README: Explain how to build with meson
  2026-10-28 11:20 [PATCH 1/2] README: Explain how to build with meson Simon Glass
  2026-10-28 11:20 ` [PATCH 2/2] README: Use meson in the Python section Simon Glass
  2026-10-28 19:52 ` [PATCH 1/2] README: Explain how to build with meson Herve Codina
@ 2026-10-29  1:17 ` David Gibson
  2 siblings, 0 replies; 6+ messages in thread
From: David Gibson @ 2026-10-29  1:17 UTC (permalink / raw)
  To: Simon Glass; +Cc: Devicetree Compiler

[-- Attachment #1: Type: text/plain, Size: 2846 bytes --]

On Wed, Oct 28, 2026 at 05:20:01AM -0600, Simon Glass wrote:
> Building with make is deprecated in favour of meson, but README.md only
> gives instructions for make, in its Python section, and CONTRIBUTING.md
> says to use 'make check'. The meson commands only appear in the warning
> which the Makefile prints.
> 
> Add a short Building section to README.md with the meson commands for
> building, testing and installing, pointing to the Meson quick guide and
> to scripts/install-deps.sh. Use meson for running the tests in
> CONTRIBUTING.md too.
> 
> Closes: https://github.com/dgibson/dtc/issues/83
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
> 
>  CONTRIBUTING.md |  4 ++--
>  README.md       | 19 +++++++++++++++++++
>  2 files changed, 21 insertions(+), 2 deletions(-)
> 
> diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
> index 9742dc3..caf0210 100644
> --- a/CONTRIBUTING.md
> +++ b/CONTRIBUTING.md
> @@ -17,8 +17,8 @@ works with pylibfdt. If it cannot be supported, put the declaration in
>  
>  ## Tests
>  
> -Test files are kept in the `tests/` directory. Use `make check` to build and run
> -all tests.
> +Test files are kept in the `tests/` directory. Use `meson test -C build` to
> +build and run all tests (see [README.md](README.md#building)).
>  
>  If you want to adjust a test file, be aware that `tree_tree1.dts` is compiled
>  and checked against a binary tree from assembler macros in `trees.S`. So
> diff --git a/README.md b/README.md
> index 8f1a5d2..ed9039d 100644
> --- a/README.md
> +++ b/README.md
> @@ -8,6 +8,25 @@ dtc and libfdt are maintained by:
>  
>  * [David Gibson `<david@gibson.dropbear.id.au>`](mailto:david@gibson.dropbear.id.au)
>  
> +## Building
> +
> +dtc and libfdt are built with [Meson](https://mesonbuild.com/):
> +
> +```
> +$ meson setup build
> +$ meson compile -C build
> +$ meson test -C build
> +$ meson install -C build
> +```
> +
> +`meson configure build` lists the build options, e.g. `-Dpython=disabled`
> +to skip the Python library. See the
> +[Meson quick guide](https://mesonbuild.com/Quick-guide.html) for more,
> +such as installing with `--destdir`. `scripts/install-deps.sh` installs
> +the packages needed on common systems.
> +
> +Building with `make` still works but is deprecated.
> +
>  ## Python library
>  
>  A Python library wrapping libfdt is also available. To build this you
> ---
> base-commit: 1d50f3f8fa8bf9429eebb0769dafa5df37381ae1
> branch: readme-meson
> 
> -- 
> 2.43.0
> 
> 

-- 
David Gibson (he or they)	| 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

* Re: [PATCH 2/2] README: Use meson in the Python section
  2026-10-28 11:20 ` [PATCH 2/2] README: Use meson in the Python section Simon Glass
  2026-10-28 20:05   ` Herve Codina
@ 2026-10-29  1:17   ` David Gibson
  1 sibling, 0 replies; 6+ messages in thread
From: David Gibson @ 2026-10-29  1:17 UTC (permalink / raw)
  To: Simon Glass; +Cc: Devicetree Compiler

[-- Attachment #1: Type: text/plain, Size: 3096 bytes --]

On Wed, Oct 28, 2026 at 05:20:02AM -0600, Simon Glass wrote:
> The Python section of README.md assumes a make build. It installs with
> 'make install', disables the library with NO_PYTHON, and runs its
> examples from the source tree, where make puts the built module. With
> meson the module is in the build directory instead, so the help example
> quietly imports whatever libfdt is installed, and the coverage example
> fails.
> 
> Use meson to install and to disable the Python library, and run the
> examples from the build directory.
> 
> Assisted-by: Claude:claude-opus-5-5
> Signed-off-by: Simon Glass <sjg@chromium.org>

Reviewed-by: David Gibson <david@gibson.dropbear.id.au>

> ---
> 
>  README.md | 16 +++++++++-------
>  1 file changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/README.md b/README.md
> index ed9039d..fcfc2e5 100644
> --- a/README.md
> +++ b/README.md
> @@ -37,7 +37,8 @@ distributions:
>  $ sudo apt-get install swig python3-dev
>  ```
>  
> -The library provides an `Fdt` class which you can use like this:
> +The library provides an `Fdt` class which you can use like this, from
> +`build/tests` after running the tests:
>  
>  ```
>  $ PYTHONPATH=../pylibfdt python3
> @@ -59,7 +60,7 @@ You will find tests in `tests/pylibfdt_tests.py` showing how to use each
>  method. Help is available using the Python help command, e.g.:
>  
>  ```
> -$ cd pylibfdt
> +$ cd build/pylibfdt
>  $ python3 -c "import libfdt; help(libfdt)"
>  ```
>  
> @@ -67,9 +68,9 @@ If you add new features, please check code coverage:
>  
>  ```
>  $ sudo apt-get install python3-coverage
> -$ cd tests
> +$ cd build/tests
>  # It's just 'coverage' on most other distributions
> -$ python3-coverage run pylibfdt_tests.py
> +$ python3-coverage run ../../tests/pylibfdt_tests.py
>  $ python3-coverage html
>  # Open 'htmlcov/index.html' in your browser
>  ```
> @@ -91,20 +92,21 @@ host system first. Generally, using `--user` or `--prefix` is not
>  necessary and pip will use the default location for the Python
>  installation which varies if the user is root or not.
>  
> -You can also install everything via make if you like, but pip is
> +You can also install everything with meson if you like, but pip is
>  recommended.
>  
>  To install both libfdt and pylibfdt you can use:
>  
>  ```
> -$ make install [PREFIX=/path/to/install_dir]
> +$ meson setup [--prefix=/path/to/install_dir] build
> +$ meson install -C build
>  ```
>  
>  To disable building the python library, even if swig and Python are available,
>  use:
>  
>  ```
> -$ make NO_PYTHON=1
> +$ meson setup -Dpython=disabled build
>  ```
>  
>  More work remains to support all of libfdt, including access to numeric
> ---
> base-commit: 1d50f3f8fa8bf9429eebb0769dafa5df37381ae1
> branch: readme-meson
> 
> -- 
> 2.43.0
> 
> 

-- 
David Gibson (he or they)	| 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

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

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

end of thread, other threads:[~2026-10-29  1:17 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-10-28 11:20 [PATCH 1/2] README: Explain how to build with meson Simon Glass
2026-10-28 11:20 ` [PATCH 2/2] README: Use meson in the Python section Simon Glass
2026-10-28 20:05   ` Herve Codina
2026-10-29  1:17   ` David Gibson
2026-10-28 19:52 ` [PATCH 1/2] README: Explain how to build with meson Herve Codina
2026-10-29  1:17 ` David Gibson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox