1
0
mirror of https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git synced 2026-10-24 00:48:53 +03:00
Files
libgpiod/docs/building.rst
Bartosz Golaszewski 97bab4cc87 build: replace autotools with meson & ninja
Port the project from autotools to meson. All build options are
preserved with the same semantics.

The goal of this change is to produce the same set of files as the
current autotools approach: libraries with correct SONAME/version,
headers, pkg-config files, GObject introspection data, Python extension
modules, D-Bus interface and configuration files. This is done to enable
a one-liner test command running all available test suites.

The only thing we drop is the `make docs` target as it's rarely used and
docs can be generated easily with sphinx directly. They are also not
required for testing.

The Rust workspace is built via a custom target that invokes cargo and
uses SYSTEM_DEPS_* environment variables to point the libgpiod-sys and
gpiosim-sys crates at the locally built C libraries.

In addition to porting the build files to meson, update the docs, remove
unneded items from .gitignore files (or remove them entirely if they're
no longer needed) and update the shunit2 test scripts to no longer care
about source directories.

Tested-by: Erik Wierich <erik@riscstar.com>
Tested-by: Vincent Fazio <vfazio@xes-inc.com>
Link: https://patch.msgid.link/20260428-meson-build-v3-1-8da6976fb0a2@oss.qualcomm.com
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
2026-05-04 09:51:03 +02:00

2.3 KiB

Downloading, building & installing

Downloading

Libgpiod is packaged by several linux distributions. You should typically be able to install it using your package manager. If you want to build libgpiod from sources, the upstream git repository for libgpiod is hosted at kernel.org. together with release tarballs.

Building

The core C library does not have any external dependencies other than the standard C library with GNU extensions.

The project is built using the meson build system. In the general case, the steps needed to download a source tarball, unpack it, build the library together with the command-line tools and install the resulting binaries are as follows:

wget https://mirrors.edge.kernel.org/pub/software/libs/libgpiod/libgpiod-x.y.z.tar.xz
tar -xvf ./libgpiod-x.y.z.tar.xz
cd ./libgpiod-x.y.z/
mkdir build
cd build
meson setup .. -Dtools=enabled
ninja
sudo ninja install

The build system requires the following packages to be installed on the host system for the basic build:

  • meson
  • ninja-build
  • pkg-config

Note

Development files for additional libraries may be required depending on selected options. Meson will report any missing additional required dependencies at configuration stage.

Note

The command-line tools optionally depend on libedit for the interactive feature.

The project can also be built directly from the git repository.

For all configure features, use: meson introspect --buildoptions or see the contents of the meson_options.txt file in the top-level directory of the repository.

Installing

To install the project run:

ninja install

Note

The above may require superuser privileges.

This will install libgpiod under the default system paths. If you want to install it under non-standard path, pass the --prefix=<install path> option to meson setup.