README: Explain how to build with meson
PATCH 1/2 README: Explain how to build with meson
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.
---
CONTRIBUTING.md | 4 ++-- README.md | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-)
CONTRIBUTING.md +2 -2
@@ -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
README.md +19 -0
@@ -8,6 +8,25 @@ dtc and libfdt are maintained by: * [David Gibson `<[email protected]>`](mailto:[email protected]) +## 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
Signature · 1 line
2.43.0
PATCH 2/2 README: Use meson in the Python section
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.
---
README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
README.md +9 -7
@@ -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
Signature · 1 line
2.43.0
Re: [PATCH 2/2] README: Use meson in the Python section
Hi Simon,
Quoted 10 lines · On Wed, 28 Oct 2026 05:20:02 -0600 Simon Glass <[email protected]> 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.
Quoted 7 lines
Assisted-by Claude:claude-opus-5-5Signed-off-by Simon Glass <[email protected]>---
README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
LGMT.
Best regards,
Hervé
Re: [PATCH 2/2] README: Use meson in the Python section
In reply to Simon GlassQuoted 7 lines · 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.
Quoted 5 lines
Use meson to install and to disable the Python library, and run the examples from the build directory.
Assisted-by Claude:claude-opus-5-5Signed-off-by Simon Glass <[email protected]>
Quoted 73 lines
---
README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)README.md +9
-8@@ -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-mesonSignature · 1 line
2.43.0
Signature · 4 lines
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
Simon Glass
AppliedRe: [PATCH 2/2] README: Use meson in the Python section
Quoted 9 lines · Simon Glass
README: Use meson in the Python section
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.
Quoted 8 lines
Use meson to install and to disable the Python library, and run the examples from the build directory.
Assisted-by Claude:claude-opus-5-5Signed-off-by Simon Glass <[email protected]>README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
Applied to main.
[2/2] README: Use meson in the Python section
c22868416b8d
Regards,
Simon
Hi Simon,
Quoted 10 lines · On Wed, 28 Oct 2026 05:20:01 -0600 Simon Glass <[email protected]> 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
Makefileprints.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.
Quoted 9 lines
Assisted-by Claude:claude-opus-5-5Signed-off-by Simon Glass <[email protected]>---
CONTRIBUTING.md | 4 ++-- README.md | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-)
Thanks for having improved those documents.
Best regards,
Hervé
Quoted 5 lines · 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
Makefileprints.
Quoted 8 lines
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.Assisted-by Claude:claude-opus-5-5Signed-off-by Simon Glass <[email protected]>
Quoted 59 lines
---
CONTRIBUTING.md | 4 ++-- README.md | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-)CONTRIBUTING.md +2
-2@@ -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`. SoREADME.md +19
-1@@ -8,6 +8,25 @@ dtc and libfdt are maintained by: * [David Gibson `<[email protected]>`](mailto:[email protected]) +## 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-mesonSignature · 1 line
2.43.0
Signature · 4 lines
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
Simon Glass
AppliedQuoted 12 lines · Simon Glass
README: Explain how to build with meson
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
Makefileprints.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.
Quoted 7 lines
Assisted-by Claude:claude-opus-5-5Signed-off-by Simon Glass <[email protected]>CONTRIBUTING.md | 4 ++-- README.md | 19 +++++++++++++++++++ 2 files changed, 21 insertions(+), 2 deletions(-)
Applied to main.
[1/2] README: Explain how to build with meson
66975bab448e
Regards,
Simon