diff mbox series

babeltrace2: don't install static modules

Message ID 20250821115829.2243247-1-ross.burton@arm.com
State New
Headers show
Series babeltrace2: don't install static modules | expand

Commit Message

Ross Burton Aug. 21, 2025, 11:58 a.m. UTC
There's no point building or installing static plugins, so apply a patch
to only build shared plugins.

Poky passes --disable-static via no-static-libs.inc, but anyone building
babeltrace2 with nodistro or another distro that doesn't use
no-static-libs.inc will fail to build babeltrace2 because of packaging
errors around the static version of the python plugin.

Signed-off-by: Ross Burton <ross.burton@arm.com>
---
 ...explicitly-only-build-shared-plugins.patch | 70 +++++++++++++++++++
 .../recipes-kernel/lttng/babeltrace2_2.1.1.bb |  2 +-
 2 files changed, 71 insertions(+), 1 deletion(-)
 create mode 100644 meta/recipes-kernel/lttng/babeltrace2/0001-src-explicitly-only-build-shared-plugins.patch
diff mbox series

Patch

diff --git a/meta/recipes-kernel/lttng/babeltrace2/0001-src-explicitly-only-build-shared-plugins.patch b/meta/recipes-kernel/lttng/babeltrace2/0001-src-explicitly-only-build-shared-plugins.patch
new file mode 100644
index 00000000000..7f8d5c7df33
--- /dev/null
+++ b/meta/recipes-kernel/lttng/babeltrace2/0001-src-explicitly-only-build-shared-plugins.patch
@@ -0,0 +1,70 @@ 
+From 3f43a0554c73287973047b44ae5e196b7c995c60 Mon Sep 17 00:00:00 2001
+From: Ross Burton <ross.burton@arm.com>
+Date: Thu, 21 Aug 2025 12:42:20 +0100
+Subject: [PATCH] src: explicitly only build shared plugins
+
+For some reason, libtool builds static libraries for libs which have
+been marked as modules. These are pointless: you can't dlopen() a static
+library.
+
+Avoid wasting compile time and disk space by passing -shared to libtool
+so that the static libraries are not built.
+
+Upstream-Status: Submitted [https://github.com/efficios/babeltrace/pull/121]
+Signed-off-by: Ross Burton <ross.burton@arm.com>
+---
+ src/Makefile.am | 10 +++++-----
+ 1 file changed, 5 insertions(+), 5 deletions(-)
+
+diff --git a/src/Makefile.am b/src/Makefile.am
+index 0567131b..7aa46b20 100644
+--- a/src/Makefile.am
++++ b/src/Makefile.am
+@@ -619,7 +619,7 @@ nodist_EXTRA_python_plugin_provider_babeltrace2_python_plugin_provider_la_SOURCE
+ python_plugin_provider_babeltrace2_python_plugin_provider_la_LDFLAGS = \
+ 	$(AM_LDFLAGS) \
+ 	$(LT_NO_UNDEFINED) \
+-	-avoid-version -module \
++	-avoid-version -module -shared \
+ 	$(PYTHON_LDFLAGS)
+ 
+ python_plugin_provider_babeltrace2_python_plugin_provider_la_CPPFLAGS = \
+@@ -669,7 +669,7 @@ plugins_utils_babeltrace_plugin_utils_la_SOURCES = \
+ plugins_utils_babeltrace_plugin_utils_la_LDFLAGS = \
+ 	$(AM_LDFLAGS) \
+ 	$(LT_NO_UNDEFINED) \
+-	-avoid-version -module $(LD_NOTEXT)
++	-avoid-version -module -shared $(LD_NOTEXT)
+ 
+ plugins_utils_babeltrace_plugin_utils_la_LIBADD = \
+ 	plugins/common/muxing/libmuxing.la
+@@ -775,7 +775,7 @@ plugins_ctf_babeltrace_plugin_ctf_la_SOURCES = \
+ plugins_ctf_babeltrace_plugin_ctf_la_LDFLAGS = \
+ 	$(AM_LDFLAGS) \
+ 	$(LT_NO_UNDEFINED) \
+-	-avoid-version -module $(LD_NOTEXT)
++	-avoid-version -module -shared $(LD_NOTEXT)
+ 
+ plugins_ctf_babeltrace_plugin_ctf_la_LIBADD = \
+ 	plugins/ctf/common/metadata/libctf-parser.la \
+@@ -816,7 +816,7 @@ plugins_text_babeltrace_plugin_text_la_SOURCES = \
+ plugins_text_babeltrace_plugin_text_la_LDFLAGS = \
+ 	$(AM_LDFLAGS) \
+ 	$(LT_NO_UNDEFINED) \
+-	-avoid-version -module $(LD_NOTEXT)
++	-avoid-version -module -shared $(LD_NOTEXT)
+ 
+ plugins_text_babeltrace_plugin_text_la_LIBADD =
+ 
+@@ -840,7 +840,7 @@ plugins_lttng_utils_babeltrace_plugin_lttng_utils_la_SOURCES = \
+ plugins_lttng_utils_babeltrace_plugin_lttng_utils_la_LDFLAGS = \
+ 	$(AM_LDFLAGS) \
+ 	$(LT_NO_UNDEFINED) \
+-	-avoid-version -module $(LD_NOTEXT) \
++	-avoid-version -module -shared $(LD_NOTEXT) \
+ 	$(ELFUTILS_LIBS)
+ 
+ plugins_lttng_utils_babeltrace_plugin_lttng_utils_la_LIBADD = \
+-- 
+2.43.0
+
diff --git a/meta/recipes-kernel/lttng/babeltrace2_2.1.1.bb b/meta/recipes-kernel/lttng/babeltrace2_2.1.1.bb
index 52768f6ce3c..1dc8cd8a498 100644
--- a/meta/recipes-kernel/lttng/babeltrace2_2.1.1.bb
+++ b/meta/recipes-kernel/lttng/babeltrace2_2.1.1.bb
@@ -14,6 +14,7 @@  SRC_URI = "git://git.efficios.com/babeltrace.git;branch=stable-2.1;protocol=http
            file://0001-tests-set-the-correct-plugin-directory.patch \
            file://0001-Make-bt_field_blob_get_length-return-size_t-instead-.patch \
            file://external-python-tests.patch \
+           file://0001-src-explicitly-only-build-shared-plugins.patch \
            "
 SRCREV = "7f2f8cd6dac497cbb466efb31219b531c62013f5"
 UPSTREAM_CHECK_GITTAGREGEX = "v(?P<pver>2(\.\d+)+)$"
@@ -27,7 +28,6 @@  export DISTSETUPOPTS = " --install-lib=${PYTHON_SITEPACKAGES_DIR}"
 PACKAGECONFIG ??= "manpages"
 PACKAGECONFIG[manpages] = ", --disable-man-pages, asciidoc-native xmlto-native"
 
-FILES:${PN}-staticdev += "${libdir}/babeltrace2/plugins/*.a"
 FILES:${PN} += "${libdir}/babeltrace2/plugins/*.so ${PYTHON_SITEPACKAGES_DIR}/*"
 
 ASNEEDED = ""