Fix: force _lttng python binding to be linked with g++
[lttng-tools.git] / extras / bindings / swig / python / Makefile.am
index a3557b8b076aac7dbdae782bc810b59896840ddb..d9cdd680d52756541314116896996ee02a5c500f 100644 (file)
@@ -1,27 +1,45 @@
-lttng.i: lttng.i.in
-       sed "s/LTTNG_VERSION_STR/LTTng $(PACKAGE_VERSION)/g" <lttng.i.in >lttng.i
-
-AM_CFLAGS = -I$(PYTHON_INCLUDE) -I$(top_srcdir)/lib/lttng-ctl -I../common \
-              $(BUDDY_CFLAGS)
+# SPDX-License-Identifier: GPL-2.0-only
 
-EXTRA_DIST = lttng.i
-python_PYTHON = lttng.py
+lttng.i: lttng.i.in
+       $(SED) "s/LTTNG_VERSION_STR/LTTng $(PACKAGE_VERSION)/g" < $(srcdir)/lttng.i.in >lttng.i
+
+# Some versions of SWIG (like 3.0.12) generate code where a parameter called
+# `swig_this` shadows a global of the same name.  Later versions (like 4.0.1)
+# have renamed this global to `Swig_This_global`.
+#
+# Disable some warning flags for that file.
+AM_CFLAGS += \
+       -Wno-cast-function-type \
+       -Wno-missing-field-initializers \
+       -Wno-null-dereference \
+       -Wno-redundant-decls \
+       -Wno-shadow \
+       -Wno-unused-parameter
+
+# Swig regularily changes and generates code that results warnings which break
+# Werror builds. Disable that option for this sub-project.
+AM_CFLAGS += -Wno-error
+
+AM_CPPFLAGS += $(PYTHON_INCLUDE)
+
+EXTRA_DIST = lttng.i.in
+nodist_python_PYTHON = lttng.py
 pyexec_LTLIBRARIES = _lttng.la
 
 MAINTAINERCLEANFILES = lttng_wrap.c lttng.py
 
-_lttng_la_SOURCES = lttng_wrap.c
-
+nodist__lttng_la_SOURCES = lttng_wrap.c
 _lttng_la_LDFLAGS = -module
+_lttng_la_LIBADD =     $(top_builddir)/src/lib/lttng-ctl/liblttng-ctl.la               \
+                       $(top_builddir)/src/common/libsessiond-comm.la          \
+                       $(top_builddir)/src/common/libcommon-gpl.la
 
-_lttng_la_LIBADD =     $(top_srcdir)/src/lib/lttng-ctl/liblttng-ctl.la                 \
-                       $(top_srcdir)/src/common/sessiond-comm/libsessiond-comm.la
+# Use this fake source file to force the link mode of the library
+# from gcc to g++. The library contains only C code, but depends on
+# libstdc++.
+nodist_EXTRA__lttng_la_SOURCES = dummy.cpp
 
-# SWIG 'warning md variable unused' fixed after SWIG build:
 lttng_wrap.c: lttng.i
        $(SWIG) -python -I. -I$(top_srcdir)/src/common/sessiond-comm lttng.i
-       sed -i "s/PyObject \*m, \*d, \*md;/PyObject \*m, \*d;\n#if defined(SWIGPYTHON_BUILTIN)\nPyObject *md;\n#endif/g" lttng_wrap.c
-       sed -i "s/md = d/d/g" lttng_wrap.c
-       sed -i "s/(void)public_symbol;/(void)public_symbol;\n  md = d;/g" lttng_wrap.c
 
-CLEANFILES = lttng.i lttng.py lttng_wrap.c
+CLEANFILES = lttng.i lttng.py lttng_wrap.c lttng.pyc
This page took 0.023859 seconds and 4 git commands to generate.