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

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