linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] libtracefs: Makefile fixes, add uninstall and fix dependency of libtracefs.pc
@ 2020-12-16  4:38 Steven Rostedt
  2020-12-16  4:38 ` [PATCH 1/5] libtracefs: Have etcdir always be at the root directory Steven Rostedt
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-12-16  4:38 UTC (permalink / raw)
  To: linux-trace-devel


Steven Rostedt (VMware) (5):
      libtracefs: Have etcdir always be at the root directory
      libtracefs: Remove obsolete do_install_ld call
      libtracefs: Add make uninstall
      libtracefs: Update libtracefs.pc if prefix is different
      libtracefs: Keep build_install file around

----
 Makefile         | 35 +++++++++++++++++++++++++++--------
 scripts/utils.mk | 12 ++++++++++++
 2 files changed, 39 insertions(+), 8 deletions(-)

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH 1/5] libtracefs: Have etcdir always be at the root directory
  2020-12-16  4:38 [PATCH 0/5] libtracefs: Makefile fixes, add uninstall and fix dependency of libtracefs.pc Steven Rostedt
@ 2020-12-16  4:38 ` Steven Rostedt
  2020-12-16  4:38 ` [PATCH 2/5] libtracefs: Remove obsolete do_install_ld call Steven Rostedt
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-12-16  4:38 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

There's a test if prefix == /usr/local and if so, then etcdir is set to
"/etc", otherwise it is set to $(prefix)/etc, which is not correct.

Always have etcdir = "/etc".

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 4 ----
 1 file changed, 4 deletions(-)

diff --git a/Makefile b/Makefile
index 5a9d33455143..92e682b68b40 100644
--- a/Makefile
+++ b/Makefile
@@ -71,11 +71,7 @@ ifeq ("$(LIBTRACEEVENT_INCLUDES)","")
 $(error libtraceevent.so not installed)
 endif
 
-ifeq ($(prefix),/usr/local)
 etcdir ?= /etc
-else
-etcdir ?= $(prefix)/etc
-endif
 etcdir_SQ = '$(subst ','\'',$(etcdir))'
 
 export man_dir man_dir_SQ html_install html_install_SQ INSTALL
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 2/5] libtracefs: Remove obsolete do_install_ld call
  2020-12-16  4:38 [PATCH 0/5] libtracefs: Makefile fixes, add uninstall and fix dependency of libtracefs.pc Steven Rostedt
  2020-12-16  4:38 ` [PATCH 1/5] libtracefs: Have etcdir always be at the root directory Steven Rostedt
@ 2020-12-16  4:38 ` Steven Rostedt
  2020-12-16  4:38 ` [PATCH 3/5] libtracefs: Add make uninstall Steven Rostedt
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-12-16  4:38 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Now that there's a test to install the ld.so.conf.d config file only if
needed, remove the unused do_install_ld references and the variables it
used. As do_install_ld is not even defined.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/Makefile b/Makefile
index 92e682b68b40..5094966f4d06 100644
--- a/Makefile
+++ b/Makefile
@@ -89,8 +89,6 @@ HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))'
 #' emacs highlighting gets confused by the above escaped quote.
 
 BASH_COMPLETE_DIR ?= $(etcdir)/bash_completion.d
-LD_SO_CONF_DIR ?= $(etcdir)/ld.so.conf.d
-TRACE_LD_FILE ?= trace.conf
 
 # copy a bit from Linux kbuild
 
@@ -242,7 +240,6 @@ install_libs: libs install_pkgconfig
 	$(Q)$(call do_install,$(LIBTRACEFS_SHARED),$(libdir_SQ)); \
 		cp -fpR $(LIB_INSTALL) $(DESTDIR)$(libdir_SQ)
 	$(Q)$(call do_install,$(src)/include/tracefs.h,$(includedir_SQ))
-	$(Q)$(call do_install_ld,$(TRACE_LD_FILE),$(LD_SO_CONF_DIR),$(libdir_SQ))
 	$(Q)$(call install_ld_config)
 
 install: install_libs
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 3/5] libtracefs: Add make uninstall
  2020-12-16  4:38 [PATCH 0/5] libtracefs: Makefile fixes, add uninstall and fix dependency of libtracefs.pc Steven Rostedt
  2020-12-16  4:38 ` [PATCH 1/5] libtracefs: Have etcdir always be at the root directory Steven Rostedt
  2020-12-16  4:38 ` [PATCH 2/5] libtracefs: Remove obsolete do_install_ld call Steven Rostedt
@ 2020-12-16  4:38 ` Steven Rostedt
  2020-12-16  4:38 ` [PATCH 4/5] libtracefs: Update libtracefs.pc if prefix is different Steven Rostedt
  2020-12-16  4:38 ` [PATCH 5/5] libtracefs: Keep build_install file around Steven Rostedt
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-12-16  4:38 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Create the logic to remove the files that would normally be installed.

Note, this does take the DESTDIR and prefix variables into account. Where
the uninstall may only work for an install with the same variables.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile         | 22 ++++++++++++++++++++++
 scripts/utils.mk |  2 ++
 2 files changed, 24 insertions(+)

diff --git a/Makefile b/Makefile
index 5094966f4d06..653fdc448f45 100644
--- a/Makefile
+++ b/Makefile
@@ -264,6 +264,28 @@ install_doc:
 install_doc_gui:
 	$(MAKE) -C $(kshark-dir)/Documentation install
 
+define build_uninstall_script
+	$(Q)mkdir $(BUILD_OUTPUT)/tmp_build
+	$(Q)$(MAKE) -C $(src) DESTDIR=$(BUILD_OUTPUT)/tmp_build/ O=$(BUILD_OUTPUT) $1 > /dev/null
+	$(Q)find $(BUILD_OUTPUT)/tmp_build ! -type d -printf "%P\n" > $(BUILD_OUTPUT)/build_$2
+	$(Q)$(RM) -rf $(BUILD_OUTPUT)/tmp_build
+endef
+
+build_uninstall:
+	$(call build_uninstall_script,install,uninstall)
+
+$(BUILD_OUTPUT)/build_uninstall: build_uninstall
+
+define uninstall_file
+	if [ -f $(DESTDIR)/$1 -o -h $(DESTDIR)/$1 ]; then \
+		$(call print_uninstall,$(DESTDIR)/$1)$(RM) $(DESTDIR)/$1; \
+	fi;
+endef
+
+uninstall: $(BUILD_OUTPUT)/build_uninstall
+	@$(foreach file,$(shell cat $(BUILD_OUTPUT)/build_uninstall),$(call uninstall_file,$(file)))
+	$(Q)$(RM) $<
+
 PHONY += force
 force:
 
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 398b88a75bfb..74b138eefed6 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -22,6 +22,7 @@ ifeq ($(findstring 1,$(SILENT)$(VERBOSE)),1)
   print_plugin_obj_compile =
   print_plugin_build =
   print_install =
+  print_uninstall =
   print_update =
 else
   print_compile =		echo '  COMPILE            '$(GOBJ);
@@ -32,6 +33,7 @@ else
   print_plugin_build =		echo '  BUILD PLUGIN       '$(GOBJ);
   print_static_lib_build =	echo '  BUILD STATIC LIB   '$(GOBJ);
   print_install =		echo '  INSTALL     '$1'	to	$(DESTDIR_SQ)$2';
+  print_uninstall =		echo '  UNINSTALL     $(DESTDIR_SQ)$1';
   print_update =		echo '  UPDATE             '$(GOBJ);
 endif
 
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 4/5] libtracefs: Update libtracefs.pc if prefix is different
  2020-12-16  4:38 [PATCH 0/5] libtracefs: Makefile fixes, add uninstall and fix dependency of libtracefs.pc Steven Rostedt
                   ` (2 preceding siblings ...)
  2020-12-16  4:38 ` [PATCH 3/5] libtracefs: Add make uninstall Steven Rostedt
@ 2020-12-16  4:38 ` Steven Rostedt
  2020-12-16  4:38 ` [PATCH 5/5] libtracefs: Keep build_install file around Steven Rostedt
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-12-16  4:38 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

If a build is done with different DESTDIR and the prefix is changed, the
the libtracefs.pc is not updated with the new prefix, and the one used may
not work with the installation being performed.

Add a "build_prefix" dependency, that creates a file "build_prefix" that has
the last prefix used to build the library. And if a new prefix is used, then
that file gets updated and so does libtracefs.pc.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile         |  7 ++++++-
 scripts/utils.mk | 10 ++++++++++
 2 files changed, 16 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 653fdc448f45..204a4e5e6e1f 100644
--- a/Makefile
+++ b/Makefile
@@ -197,7 +197,12 @@ define do_make_pkgconfig_file
 	sed -i "s|HEADER_DIR|$(includedir)|g" ${PKG_CONFIG_FILE};
 endef
 
-$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template
+BUILD_PREFIX := $(BUILD_OUTPUT)/build_prefix
+
+$(BUILD_PREFIX): force
+	$(Q)$(call build_prefix,$(prefix))
+
+$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template $(BUILD_PREFIX)
 	$(Q) $(call do_make_pkgconfig_file,$(prefix))
 
 tags:	force
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 74b138eefed6..0d3c3194f6c5 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -113,6 +113,16 @@ define update_dir
 	fi);
 endef
 
+define build_prefix
+	(echo $1 > $@.tmp;	\
+	if [ -r $@ ] && cmp -s $@ $@.tmp; then				\
+		rm -f $@.tmp;						\
+	else								\
+		$(print_update)						\
+		mv -f $@.tmp $@;					\
+	fi);
+endef
+
 define do_install_mkdir
 	if [ ! -d '$(DESTDIR_SQ)$1' ]; then		\
 		$(INSTALL) -d -m 755 '$(DESTDIR_SQ)$1';	\
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

* [PATCH 5/5] libtracefs: Keep build_install file around
  2020-12-16  4:38 [PATCH 0/5] libtracefs: Makefile fixes, add uninstall and fix dependency of libtracefs.pc Steven Rostedt
                   ` (3 preceding siblings ...)
  2020-12-16  4:38 ` [PATCH 4/5] libtracefs: Update libtracefs.pc if prefix is different Steven Rostedt
@ 2020-12-16  4:38 ` Steven Rostedt
  4 siblings, 0 replies; 6+ messages in thread
From: Steven Rostedt @ 2020-12-16  4:38 UTC (permalink / raw)
  To: linux-trace-devel

From: "Steven Rostedt (VMware)" <rostedt@goodmis.org>

Instead of rebuilding the build_install files every time the uninstall is
created, make it depend on the prefix, as if the prefix is the same, then
the uninstall should be the same.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 204a4e5e6e1f..a7d58081bf4b 100644
--- a/Makefile
+++ b/Makefile
@@ -276,7 +276,7 @@ define build_uninstall_script
 	$(Q)$(RM) -rf $(BUILD_OUTPUT)/tmp_build
 endef
 
-build_uninstall:
+build_uninstall: $(BUILD_PREFIX)
 	$(call build_uninstall_script,install,uninstall)
 
 $(BUILD_OUTPUT)/build_uninstall: build_uninstall
@@ -289,7 +289,6 @@ endef
 
 uninstall: $(BUILD_OUTPUT)/build_uninstall
 	@$(foreach file,$(shell cat $(BUILD_OUTPUT)/build_uninstall),$(call uninstall_file,$(file)))
-	$(Q)$(RM) $<
 
 PHONY += force
 force:
-- 
2.29.2



^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2020-12-16  4:40 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16  4:38 [PATCH 0/5] libtracefs: Makefile fixes, add uninstall and fix dependency of libtracefs.pc Steven Rostedt
2020-12-16  4:38 ` [PATCH 1/5] libtracefs: Have etcdir always be at the root directory Steven Rostedt
2020-12-16  4:38 ` [PATCH 2/5] libtracefs: Remove obsolete do_install_ld call Steven Rostedt
2020-12-16  4:38 ` [PATCH 3/5] libtracefs: Add make uninstall Steven Rostedt
2020-12-16  4:38 ` [PATCH 4/5] libtracefs: Update libtracefs.pc if prefix is different Steven Rostedt
2020-12-16  4:38 ` [PATCH 5/5] libtracefs: Keep build_install file around Steven Rostedt

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).