[libgpiod][WIP PATCH 0/2] Convert the build from autotools to meson

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxxxxxx/

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




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux