2025-10-03 16:17:33 +02:00
|
|
|
# SPDX-License-Identifier: LGPL-2.1-or-later
|
|
|
|
|
|
2025-06-30 12:07:47 +07:00
|
|
|
project(
|
|
|
|
|
'python-systemd',
|
|
|
|
|
'c',
|
|
|
|
|
version: '236',
|
|
|
|
|
license: 'LGPL-2.1-or-later',
|
|
|
|
|
default_options: ['warning_level=2', 'c_std=c99'],
|
|
|
|
|
meson_version: '>= 1.8.0',
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
|
python = import('python').find_installation('python3', pure: false)
|
|
|
|
|
python_dep = python.dependency()
|
|
|
|
|
|
2025-10-15 10:42:21 +02:00
|
|
|
fs = import('fs')
|
|
|
|
|
|
2025-06-30 12:07:47 +07:00
|
|
|
libsystemd_dep = dependency('libsystemd')
|
|
|
|
|
|
2025-10-12 13:09:52 +02:00
|
|
|
add_project_arguments(
|
2025-10-12 13:11:54 +02:00
|
|
|
'-D_GNU_SOURCE=1',
|
2025-06-30 12:07:47 +07:00
|
|
|
'-DPACKAGE_VERSION="@0@"'.format(meson.project_version()),
|
|
|
|
|
'-DLIBSYSTEMD_VERSION=@0@'.format(libsystemd_dep.version()),
|
2026-06-18 15:00:35 +02:00
|
|
|
'-Wno-unused-parameter',
|
2025-10-12 13:09:52 +02:00
|
|
|
language : 'c',
|
|
|
|
|
)
|
2025-06-30 12:07:47 +07:00
|
|
|
|
2025-10-03 18:09:00 +02:00
|
|
|
update_constants_py = files('update-constants.py')
|
|
|
|
|
|
2025-10-03 14:36:25 +02:00
|
|
|
subdir('src/systemd')
|
2025-10-03 18:09:00 +02:00
|
|
|
|
2025-10-15 16:33:18 +02:00
|
|
|
test(
|
|
|
|
|
'unit',
|
|
|
|
|
find_program(python.full_path()),
|
|
|
|
|
args: [
|
|
|
|
|
'-m', 'pytest',
|
|
|
|
|
'-v',
|
|
|
|
|
python_test_dir,
|
|
|
|
|
],
|
|
|
|
|
env: { 'PYTHONPATH': meson.current_build_dir() / 'src' },
|
|
|
|
|
)
|
|
|
|
|
|
2025-10-03 18:09:00 +02:00
|
|
|
alias_target('update-constants', update_constants)
|
2025-10-03 21:08:09 +02:00
|
|
|
|
|
|
|
|
# Docs
|
|
|
|
|
sphinx_build = find_program('sphinx-build', disabler: true, required: get_option('docs'))
|
|
|
|
|
sphinx_args = ['-Dversion=' + meson.project_version(), '-Drelease=' + meson.project_version()]
|
|
|
|
|
|
|
|
|
|
input_dir = meson.current_source_dir() / 'docs'
|
|
|
|
|
output_dir = meson.current_build_dir() / 'html'
|
|
|
|
|
doc_target = custom_target('html',
|
|
|
|
|
output: 'html',
|
|
|
|
|
input: files('docs/conf.py',
|
|
|
|
|
'docs/daemon.rst', 'docs/id128.rst',
|
|
|
|
|
'docs/journal.rst', 'docs/login.rst',
|
|
|
|
|
'docs/layout.html', 'docs/default.css'),
|
|
|
|
|
command: [sphinx_build, '-b', 'html', sphinx_args, input_dir, output_dir],
|
|
|
|
|
env: { 'PYTHONPATH': meson.current_build_dir() / 'src' },
|
|
|
|
|
build_by_default: get_option('docs'),
|
|
|
|
|
install: get_option('docs'),
|
|
|
|
|
install_dir: get_option('datadir') / 'doc' / meson.project_name()
|
|
|
|
|
)
|