1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-10-21 14:53:44 +03:00

Use AM_PATH_PYTHON/PKG_CHECK_MODULES for python bindings

* `AM_PATH_PYTHON` is a much more common idiom for building
  and installing python modules than writing your own.
* It also makes cross-compiling the python bindings possible.
  Previously the `PYTHON_CFLAGS`/`PYTHON_LIBS` would have been
  based on the `--build` python and not the `--host` python.
  By using `pkg-config`, we can always redirect the python-X.Y.pc.

Bug: https://bugs.gentoo.org/582130
This commit is contained in:
David Seifert
2022-03-29 13:37:16 +02:00
parent 9684954429
commit d9335077dd
5 changed files with 26 additions and 119 deletions

View File

@@ -19,14 +19,13 @@ if WITH_PYTHON
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(PYTHON_INCLUDES)
$(PYTHON_CFLAGS)
python_LTLIBRARIES = libxml2mod.la
pyexec_LTLIBRARIES = libxml2mod.la
libxml2mod_la_SOURCES = libxml.c libxml_wrap.h libxml2-py.h libxml2-py.c types.c
libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version \
$(top_builddir)/libxml2.la
libxml2mod_la_LIBADD = $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS)
libxml2mod_la_LDFLAGS = $(CYGWIN_EXTRA_LDFLAGS) $(WIN32_EXTRA_LDFLAGS) -module -avoid-version
libxml2mod_la_LIBADD = $(top_builddir)/libxml2.la $(CYGWIN_EXTRA_PYTHON_LIBADD) $(WIN32_EXTRA_PYTHON_LIBADD) $(PYTHON_LIBS)
BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
@@ -36,10 +35,10 @@ libxml.$(OBJEXT): libxml2-export.c
libxml2.py: $(srcdir)/libxml.py libxml2class.py
cat $(srcdir)/libxml.py `test -f libxml2class.py || echo $(srcdir)/`libxml2class.py > $@
dist_python_DATA = \
python_PYTHON = \
drv_libxml2.py \
libxml2.py
CLEANFILES = *.pyc
MAINTAINERCLEANFILES = libxml2.py libxml2class.*
@@ -47,6 +46,9 @@ MAINTAINERCLEANFILES = libxml2.py libxml2class.*
API_DESC = $(top_srcdir)/doc/libxml2-api.xml $(srcdir)/libxml2-python-api.xml
GENERATED = libxml2class.py libxml2class.txt $(BUILT_SOURCES)
# Generated sources
all-local: drv_libxml2.py libxml2.py
$(GENERATED): $(srcdir)/generator.py $(API_DESC)
$(PYTHON) $(srcdir)/generator.py $(srcdir)
endif