meson: port python bindings to build natively via meson and meson-python

We get full build parallelism and fewer confusing ancient distutils
paths. The python wheels build fully standalone, including linking
libfdt as a static library.

For convenience, when running pip install a meson option is passed that
prevents building tools or installing headers/pkgconfig files.
meson-python would otherwise include them in the wheel itself, in case
they are needed, but this is essentially a bit useless so don't bother.

The old setuptools-based build is now redundant and goes away.

Signed-off-by: Eli Schwartz <eschwartz@gentoo.org>
Message-ID: <20250430152601.43554-3-eschwartz@gentoo.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
Eli Schwartz 2025-04-30 11:25:26 -04:00 committed by David Gibson
parent 7ebfcac852
commit ecb21febfd
9 changed files with 73 additions and 213 deletions

View file

@ -31,7 +31,7 @@ libfdt = library(
version: meson.project_version(),
link_args: link_args,
link_depends: 'version.lds',
install: true,
install: get_option('default_library') != 'static' or not wheel_only,
)
libfdt_inc = include_directories('.')
@ -41,20 +41,22 @@ libfdt_dep = declare_dependency(
link_with: libfdt,
)
install_headers(
files(
'fdt.h',
'libfdt.h',
'libfdt_env.h',
if not wheel_only
install_headers(
files(
'fdt.h',
'libfdt.h',
'libfdt_env.h',
)
)
)
pkgconfig = import('pkgconfig')
pkgconfig = import('pkgconfig')
pkgconfig.generate(
libraries: libfdt,
version: meson.project_version(),
filebase: 'libfdt',
name: 'libfdt',
description: 'Flat Device Tree manipulation',
)
pkgconfig.generate(
libraries: libfdt,
version: meson.project_version(),
filebase: 'libfdt',
name: 'libfdt',
description: 'Flat Device Tree manipulation',
)
endif