1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-27 18:50:07 +03:00

meson: Fix Python module build

This commit is contained in:
Jan Alexander Steffens (heftig) 2025-02-20 13:52:40 +01:00 committed by Nick Wellnhofer
parent c2e2d76211
commit 064a02114a

View File

@ -3,20 +3,57 @@ pymod = import('python')
py = pymod.find_installation('python3', required: false)
if py.found() == true
r = run_command(py, 'generator.py', meson.current_source_dir(), check: true)
message('Installing python modules to', py.get_install_dir())
libxml2mod_src = ['libxml.c', 'libxml2-py.c', 'types.c']
pygenerated = custom_target(
'Python generated files',
input: files('generator.py'),
depend_files: files(
'..' / 'doc' / 'libxml2-api.xml',
'libxml2-python-api.xml',
),
output: [
'libxml2-py.h',
'libxml2-export.c',
'libxml2-py.c',
'libxml2class.py',
'libxml2class.txt',
],
command: [py, '@INPUT@', meson.current_build_dir()],
)
pygenerated_dep = declare_dependency(
sources : [pygenerated[0]],
)
message(py.get_install_dir())
libxml2_py = custom_target(
'libxml2.py',
input: [files('libxml.py'), pygenerated[3]],
output: 'libxml2.py',
command: [find_program('cat'), '@INPUT@'],
capture: true,
install: true,
install_dir: py.get_install_dir(),
)
libxml2mod_src = [
files('libxml.c', 'types.c'),
pygenerated[2],
]
py.extension_module(
'libxml2mod',
files(libxml2mod_src),
dependencies: [py.dependency(), xml_dep],
include_directories: [config_dir],
libxml2mod_src,
dependencies: [
py.dependency(),
xml_dep,
pygenerated_dep,
],
include_directories: [config_dir, '.'],
install: true,
)
py.install_sources(files('drv_libxml2.py'))
setup_py = configuration_data()
setup_py.set('prefix', get_option('prefix'))
setup_py.set('LIBXML_VERSION', meson.project_version())