Blame SOURCES/libtraceevent-Move-plugin_dir-define-logic-to-top-le.patch

cad6f9
From e9bd314141ee6b4556d9db854bccd34159661ffa Mon Sep 17 00:00:00 2001
cad6f9
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>
cad6f9
Date: Thu, 28 Jan 2021 16:31:35 -0500
cad6f9
Subject: [PATCH] libtraceevent: Move plugin_dir define logic to top level
cad6f9
 Makefile
cad6f9
cad6f9
The installation location of the plugin directory needs to be passed into
cad6f9
the C files via the -DPLUGIN_DIR=".." compiler option. But the logic for
cad6f9
that was only in the plugin directory, such that the main library did not
cad6f9
know where to find the plugins (as the PLUGIN_DIR macro was not set). This
cad6f9
caused the library not to load the plugins for the application.
cad6f9
cad6f9
By moving the logic to the top level Makefile and exporting the variables,
cad6f9
this fixes the issue.
cad6f9
cad6f9
Link: https://lore.kernel.org/linux-trace-devel/20210128163135.27ae85d5@gandalf.local.home
cad6f9
cad6f9
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
cad6f9
---
cad6f9
 Makefile         | 26 ++++++++++++++++++++++++++
cad6f9
 plugins/Makefile | 24 ------------------------
cad6f9
 2 files changed, 26 insertions(+), 24 deletions(-)
cad6f9
cad6f9
diff --git a/Makefile b/Makefile
cad6f9
index e4eba74..11bfe54 100644
cad6f9
--- a/Makefile
cad6f9
+++ b/Makefile
cad6f9
@@ -118,6 +118,32 @@ endif
cad6f9
 
cad6f9
 LIBS = -ldl
cad6f9
 
cad6f9
+set_plugin_dir := 1
cad6f9
+
cad6f9
+# Set plugin_dir to preffered global plugin location
cad6f9
+# If we install under $HOME directory we go under
cad6f9
+# $(HOME)/.local/lib/traceevent/plugins
cad6f9
+#
cad6f9
+# We dont set PLUGIN_DIR in case we install under $HOME
cad6f9
+# directory, because by default the code looks under:
cad6f9
+# $(HOME)/.local/lib/traceevent/plugins by default.
cad6f9
+#
cad6f9
+ifeq ($(plugin_dir),)
cad6f9
+ifeq ($(prefix),$(HOME))
cad6f9
+override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
cad6f9
+set_plugin_dir := 0
cad6f9
+else
cad6f9
+override plugin_dir = $(libdir)/traceevent/plugins
cad6f9
+endif
cad6f9
+export plugin_dir
cad6f9
+endif
cad6f9
+
cad6f9
+ifeq ($(set_plugin_dir),1)
cad6f9
+PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
cad6f9
+PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
cad6f9
+export PLUGIN_DIR PLUGIN_DIR_SQ
cad6f9
+endif
cad6f9
+
cad6f9
 # Append required CFLAGS
cad6f9
 override CFLAGS += -fPIC
cad6f9
 override CFLAGS += $(CONFIG_FLAGS) $(INCLUDES) $(PLUGIN_DIR_SQ)
cad6f9
diff --git a/plugins/Makefile b/plugins/Makefile
cad6f9
index e8b8850..b60352d 100644
cad6f9
--- a/plugins/Makefile
cad6f9
+++ b/plugins/Makefile
cad6f9
@@ -41,30 +41,6 @@ libdir_relative ?= $(libdir_relative_tmp)
cad6f9
 prefix ?= /usr/local
cad6f9
 libdir = $(prefix)/$(libdir_relative)
cad6f9
 
cad6f9
-set_plugin_dir := 1
cad6f9
-
cad6f9
-# Set plugin_dir to preffered global plugin location
cad6f9
-# If we install under $HOME directory we go under
cad6f9
-# $(HOME)/.local/lib/traceevent/plugins
cad6f9
-#
cad6f9
-# We dont set PLUGIN_DIR in case we install under $HOME
cad6f9
-# directory, because by default the code looks under:
cad6f9
-# $(HOME)/.local/lib/traceevent/plugins by default.
cad6f9
-#
cad6f9
-ifeq ($(plugin_dir),)
cad6f9
-ifeq ($(prefix),$(HOME))
cad6f9
-override plugin_dir = $(HOME)/.local/lib/traceevent/plugins
cad6f9
-set_plugin_dir := 0
cad6f9
-else
cad6f9
-override plugin_dir = $(libdir)/traceevent/plugins
cad6f9
-endif
cad6f9
-endif
cad6f9
-
cad6f9
-ifeq ($(set_plugin_dir),1)
cad6f9
-PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
cad6f9
-PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
cad6f9
-endif
cad6f9
-
cad6f9
 include ../scripts/Makefile.include
cad6f9
 
cad6f9
 # copy a bit from Linux kbuild
cad6f9
-- 
cad6f9
2.31.1
cad6f9