linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [libgpiod][WIP PATCH 0/2] Convert the build from autotools to meson
@ 2022-12-05 13:22 Andrew Jeffery
  2022-12-05 13:22 ` [libgpiod][WIP PATCH 1/2] Introduce meson as a build system Andrew Jeffery
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Andrew Jeffery @ 2022-12-05 13:22 UTC (permalink / raw)
  To: linux-gpio

Hello,

Based on a recent poke [1] and in-between meetings I've put together a
WIP series that converts libgpiod's build from autotools to meson. As
far as I'm aware the meson build supports all the significant options to
enable or disable features exposed by the autotools build:

* Tests
* Tools
  * Interactive gpioset
* Bindings
  * C++
  * Python
  * Rust
* Documentation
  * Manpages
  * Doxygen

[1] https://lore.kernel.org/all/CAMRc=Mda8UnyH+_GxeX_4MyKd+DPN0BVH5K+J+VWnMJNC1vwTQ@mail.gmail.com/

Meson has pretty good support for handling python and so the patch does
away with setup.py entirely. However, the rust case isn't quite so
simple. In order to handle the dependencies of the rust bindings I've
called out to cargo through a custom target. It's not great, but from
what I could see it seems to be the path of least resistance given
meson's support for rust.

There's no support for installing the rust bindings through meson, but
this is not worse than the support we appeared to have under autotools.

It's worth noting that you'll probably want to disable the rust bindings
if you need to run the install phase for libgpiod under e.g. sudo but
have used rustup to install cargo for your unpriviledged user.

Also, if you've used rustup to install the rust toolchain you may also
need to install clang in order to pick up C toolchain headers for
consumption by bindgen.

Anyway, feedback on the rust part is definitely appreciated. Maybe
there's a better approach?

Moving along, the following tests pass in their entirety in my test VM:

* gpiod-test
* gpiod-cxx-test
* python -m gpiod.test

I've also briefly compared the install trees for the autotools and meson
builds under some configurations. The differences are accounted for by
meson defaulting to multi-arch installation paths for shared objects and
picking the generic rather than interpreter-version-specific python3
dist-packages directory under $PREFIX. Let me know if those seem
problematic.

A complete meson setup invocation looks as follows:

```
$ meson setup -Dbindings=cxx,python,rust -Ddocumentation=man,inline -Dexamples=true -Dtests=true -Dtools=true build
```

Subsequently the build can be performed with:

```
$ meson compile -C build
```

Meson defaults to using ninja as its backend, and automatically exploits
ccache[2] when available to keep repeated builds speedy.

[2] https://ccache.dev/

We end up with a net reduction of 254 LOC for the build system, and,
IMO, a single and fairly readable language to express it. Along with
that comes easy integration as a dependency in other (meson) projects
and a straight-forward path for their cross-compilation.

Let me know what you think.

Andrew

Andrew Jeffery (2):
  Introduce meson as a build system
  Remove autotools in favour of meson

 Doxyfile.in                               |   2 +-
 Makefile.am                               |  43 ----
 autogen.sh                                |  17 --
 bindings/Makefile.am                      |  22 --
 bindings/cxx/Makefile.am                  |  48 ----
 bindings/cxx/examples/Makefile.am         |  26 ---
 bindings/cxx/examples/meson.build         |   9 +
 bindings/cxx/gpiodcxx/Makefile.am         |  20 --
 bindings/cxx/gpiodcxx/meson.build         |  19 ++
 bindings/cxx/meson.build                  |  49 ++++
 bindings/cxx/tests/Makefile.am            |  32 ---
 bindings/cxx/tests/meson.build            |  26 +++
 bindings/meson.build                      |  14 ++
 bindings/python/Makefile.am               |  35 ---
 bindings/python/examples/Makefile.am      |  10 -
 bindings/python/examples/meson.build      |  12 +
 bindings/python/gpiod/Makefile.am         |  17 --
 bindings/python/gpiod/ext/Makefile.am     |  11 -
 bindings/python/gpiod/ext/meson.build     |  14 ++
 bindings/python/gpiod/meson.build         |  17 ++
 bindings/python/meson.build               |  16 ++
 bindings/python/setup.py                  |  47 ----
 bindings/python/tests/Makefile.am         |  17 --
 bindings/python/tests/gpiosim/Makefile.am |   7 -
 bindings/python/tests/gpiosim/meson.build |  12 +
 bindings/python/tests/meson.build         |  17 ++
 bindings/rust/Makefile.am                 |  19 --
 bindings/rust/gpiosim-sys/build.rs        |   9 +-
 bindings/rust/libgpiod-sys/build.rs       |   9 +-
 bindings/rust/meson.build                 |  33 +++
 configure.ac                              | 272 ----------------------
 include/Makefile.am                       |   4 -
 include/meson.build                       |   7 +
 lib/Makefile.am                           |  27 ---
 lib/meson.build                           |  30 +++
 man/Makefile.am                           |  16 --
 man/meson.build                           |  21 ++
 meson.build                               |  91 ++++++++
 meson_options.txt                         |   9 +
 tests/Makefile.am                         |  34 ---
 tests/gpiosim/Makefile.am                 |  16 --
 tests/gpiosim/meson.build                 |  24 ++
 tests/meson.build                         |  30 +++
 tools/Makefile.am                         |  39 ----
 tools/meson.build                         |  69 ++++++
 45 files changed, 532 insertions(+), 786 deletions(-)
 delete mode 100644 Makefile.am
 delete mode 100755 autogen.sh
 delete mode 100644 bindings/Makefile.am
 delete mode 100644 bindings/cxx/Makefile.am
 delete mode 100644 bindings/cxx/examples/Makefile.am
 create mode 100644 bindings/cxx/examples/meson.build
 delete mode 100644 bindings/cxx/gpiodcxx/Makefile.am
 create mode 100644 bindings/cxx/gpiodcxx/meson.build
 create mode 100644 bindings/cxx/meson.build
 delete mode 100644 bindings/cxx/tests/Makefile.am
 create mode 100644 bindings/cxx/tests/meson.build
 create mode 100644 bindings/meson.build
 delete mode 100644 bindings/python/Makefile.am
 delete mode 100644 bindings/python/examples/Makefile.am
 create mode 100644 bindings/python/examples/meson.build
 delete mode 100644 bindings/python/gpiod/Makefile.am
 delete mode 100644 bindings/python/gpiod/ext/Makefile.am
 create mode 100644 bindings/python/gpiod/ext/meson.build
 create mode 100644 bindings/python/gpiod/meson.build
 create mode 100644 bindings/python/meson.build
 delete mode 100644 bindings/python/setup.py
 delete mode 100644 bindings/python/tests/Makefile.am
 delete mode 100644 bindings/python/tests/gpiosim/Makefile.am
 create mode 100644 bindings/python/tests/gpiosim/meson.build
 create mode 100644 bindings/python/tests/meson.build
 delete mode 100644 bindings/rust/Makefile.am
 create mode 100644 bindings/rust/meson.build
 delete mode 100644 configure.ac
 delete mode 100644 include/Makefile.am
 create mode 100644 include/meson.build
 delete mode 100644 lib/Makefile.am
 create mode 100644 lib/meson.build
 delete mode 100644 man/Makefile.am
 create mode 100644 man/meson.build
 create mode 100644 meson.build
 create mode 100644 meson_options.txt
 delete mode 100644 tests/Makefile.am
 delete mode 100644 tests/gpiosim/Makefile.am
 create mode 100644 tests/gpiosim/meson.build
 create mode 100644 tests/meson.build
 delete mode 100644 tools/Makefile.am
 create mode 100644 tools/meson.build

-- 
2.37.2


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

end of thread, other threads:[~2022-12-08 21:51 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-12-05 13:22 [libgpiod][WIP PATCH 0/2] Convert the build from autotools to meson Andrew Jeffery
2022-12-05 13:22 ` [libgpiod][WIP PATCH 1/2] Introduce meson as a build system Andrew Jeffery
2022-12-05 13:22 ` [libgpiod][WIP PATCH 2/2] Remove autotools in favour of meson Andrew Jeffery
2022-12-05 18:55 ` [libgpiod][WIP PATCH 0/2] Convert the build from autotools to meson Bartosz Golaszewski
2022-12-05 23:42   ` Andrew Jeffery
2022-12-06  0:06   ` Viresh Kumar
2022-12-06  0:26     ` Andrew Jeffery
2022-12-06  3:40       ` Viresh Kumar
2022-12-06  3:54         ` Kent Gibson
2022-12-06 12:15           ` Miguel Ojeda
2022-12-06 14:54   ` Andy Shevchenko
2022-12-06 22:04     ` Andrew Jeffery
2022-12-06 22:21       ` Andy Shevchenko
2022-12-08  4:23   ` Andrew Jeffery
2022-12-08  9:27     ` Bartosz Golaszewski
2022-12-08 11:09       ` Andrew Jeffery
2022-12-08 18:48         ` Bartosz Golaszewski
2022-12-08 21:51           ` Andrew Jeffery

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).