1
0
mirror of https://gitlab.gnome.org/GNOME/libxml2.git synced 2025-03-14 22:50:08 +03:00
libxml2/python/Makefile.am
Sam James a0f9211b52 python/Makefile.am: use *_LIBADD, not *_LDFLAGS for LIBS
This fixes over-linking in the built Python modules with various libraries.

*_LIBADD is intended for adding additional libraries for linking, while
*_LDFLAGS is for miscellaneous extra flags (possibly user-supplied).

If using -Wl,-as-needed within user-supplied LDFLAGS, it is passed too
late (after the library link line) and therefore has no effect.

Notes:

* Noticed while working on Gentoo's migration to libxcrypt because
libxml2's Python modules were linking to libcrypt (and other libraries)
unexpectedly.

* It was suggested we could actually stop linking explicitly with all
of Python's libraries / don't copy its LDFLAGS, but this resolves
the original issue downstream and is a separate discussion. I couldn't
find any clear documentation for/against such a change.

Bug: https://bugs.gentoo.org/798942
Signed-off-by: Sam James <sam@gentoo.org>
2022-01-16 13:58:43 +01:00

56 lines
1.4 KiB
Makefile

# Makefile for libxml2 python library
AUTOMAKE_OPTIONS = 1.4 foreign
SUBDIRS = . tests
docsdir = $(datadir)/doc/libxml2-python-$(LIBXML_VERSION)
dist_docs_DATA = TODO
EXTRA_DIST = \
setup.py \
generator.py \
libxml.py \
libxml2-export.c \
libxml2-python-api.xml \
libxml2class.py \
libxml2class.txt
if WITH_PYTHON
AM_CPPFLAGS = \
-I$(top_builddir)/include \
-I$(top_srcdir)/include \
-I$(PYTHON_INCLUDES)
python_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)
BUILT_SOURCES = libxml2-export.c libxml2-py.h libxml2-py.c
# libxml.c #includes libxml2-export.c
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 = \
drv_libxml2.py \
libxml2.py
CLEANFILES = *.pyc
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): $(srcdir)/generator.py $(API_DESC)
$(PYTHON) $(srcdir)/generator.py $(srcdir)
endif
tests test: all
cd tests && $(MAKE) tests