diff mbox series

[v2,3/5] trace-cmd: Add installation of ld.conf.d file for library paths

Message ID 20200122172410.467870405@goodmis.org (mailing list archive)
State Accepted
Commit 5921e9912b757d4ba8a3d3196f5c41ce70427f92
Headers show
Series trace-cmd: A few udpates | expand

Commit Message

Steven Rostedt Jan. 22, 2020, 5:22 p.m. UTC
From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

As just installing the shared libraries is not enough to have them accessed
by the applications, ldconfig needs to also be run. To find the location of
the libraries, their paths need to be added to ld.conf.d directory
configuration file.

Cc: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile         |  4 ++++
 scripts/utils.mk | 10 ++++++++++
 2 files changed, 14 insertions(+)
diff mbox series

Patch

diff --git a/Makefile b/Makefile
index efd9ed4b296e..c22aa7847b51 100644
--- a/Makefile
+++ b/Makefile
@@ -88,6 +88,8 @@  HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))'
 #' emacs highlighting gets confused by the above escaped quote.
 
 BASH_COMPLETE_DIR ?= /etc/bash_completion.d
+LD_SO_CONF_DIR ?= /etc/ld.so.conf.d
+TRACE_LD_FILE ?= trace.conf
 
 export PLUGIN_DIR_TRACEEVENT
 export PLUGIN_DIR_TRACECMD
@@ -380,6 +382,8 @@  install_libs: libs
 	$(Q)$(call do_install,$(src)/include/traceevent/trace-seq.h,$(includedir_SQ)/traceevent)
 	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
 	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-filter-hash.h,$(includedir_SQ)/trace-cmd)
+	$(Q)$(call do_install_ld,$(TRACE_LD_FILE),$(LD_SO_CONF_DIR),$(libdir_SQ)/trace-cmd)
+	$(Q)$(call do_install_ld,$(TRACE_LD_FILE),$(LD_SO_CONF_DIR),$(libdir_SQ)/traceevent)
 
 doc:
 	$(MAKE) -C $(src)/Documentation all
diff --git a/scripts/utils.mk b/scripts/utils.mk
index d1d5135063fc..8434aea7c24f 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -133,3 +133,13 @@  define do_install_data
 	fi;						\
 	$(INSTALL) -m 644 $1 '$(DESTDIR_SQ)$2'
 endef
+
+define do_install_ld
+	if [ -d '$(DESTDIR_SQ)$2' ]; then				\
+		$(print_install)					\
+		if ! grep -q $3 $(DESTDIR_SQ)$2/$1 2>/dev/null; then	\
+			echo '$3' >> $(DESTDIR_SQ)$2/$1;		\
+			ldconfig;					\
+		fi							\
+	fi
+endef