linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries
@ 2020-12-11 17:08 Steven Rostedt
  2020-12-11 17:08 ` [PATCH 01/13] trace-cmd: Add missing SPDX headers Steven Rostedt
                   ` (12 more replies)
  0 siblings, 13 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

Now that libtraceevent and libtracefs are in their separate repositories,
clean up the Makefiles for trace-cmd a bit, and even let the builder know
that libtraceevent and libtracefs are separate and where to find them.

Steven Rostedt (VMware) (13):
      trace-cmd: Add missing SPDX headers
      trace-cmd: Allow overriding of pkg-config
      trace-cmd: Use $(LIBTRACECMD_STATIC) instead of open coding in Makefile
      trace-cmd: Add versioning to libtracecmd.so
      trace-cmd: Add pkg-config configuration for libtracecmd.so
      trace-cmd: Clean up the Makefiles a little
      trace-cmd: Remove making of ld.so.conf.d/trace.conf
      trace-cmd: Install libtracecmd in the proper lib directory
      trace-cmd: Move the installing of libtracecmd to the lib/trace-cmd Makefile
      trace-cmd: Install the soft links for libtracecmd.so
      trace-cmd: Do not install libtracefs nor libtraceevent libraries
      trace-cmd: Do not build shared libraries for libtracefs and libtraceevent
      trace-cmd: Add warning if libtracefs or libtraceevent are not found

----
 Makefile                                      | 119 +++++++++++++++-----------
 features.mk                                   |   1 +
 include/linux/time64.h                        |   2 +
 lib/trace-cmd/Makefile                        |  27 ++++--
 lib/trace-cmd/include/private/trace-msg.h     |   1 +
 lib/traceevent/Makefile                       |  19 +++-
 lib/traceevent/plugins/Makefile               |   2 +
 lib/traceevent/plugins/plugin_python_loader.c |   1 +
 lib/tracefs/Makefile                          |  20 +++--
 libtracecmd.pc.template                       |  10 +++
 python/Makefile                               |   2 +
 scripts/utils.mk                              |  13 ++-
 tracecmd/Makefile                             |   1 +
 tracecmd/include/bug.h                        |   1 +
 tracecmd/trace-usage.c                        |   1 +
 utest/Makefile                                |   1 +
 16 files changed, 148 insertions(+), 73 deletions(-)
 create mode 100644 libtracecmd.pc.template

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

* [PATCH 01/13] trace-cmd: Add missing SPDX headers
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 02/13] trace-cmd: Allow overriding of pkg-config Steven Rostedt
                   ` (11 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

Some files in the directory were missing the necessary SPDX headers to
describe what license the file is under. These were added.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 features.mk                                   | 1 +
 include/linux/time64.h                        | 2 ++
 lib/trace-cmd/Makefile                        | 2 +-
 lib/trace-cmd/include/private/trace-msg.h     | 1 +
 lib/traceevent/Makefile                       | 2 +-
 lib/traceevent/plugins/Makefile               | 2 ++
 lib/traceevent/plugins/plugin_python_loader.c | 1 +
 lib/tracefs/Makefile                          | 2 +-
 python/Makefile                               | 2 ++
 scripts/utils.mk                              | 1 +
 tracecmd/Makefile                             | 1 +
 tracecmd/include/bug.h                        | 1 +
 tracecmd/trace-usage.c                        | 1 +
 utest/Makefile                                | 1 +
 14 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/features.mk b/features.mk
index 9c9d63c13a23..53f35fd4ed17 100644
--- a/features.mk
+++ b/features.mk
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 
 # taken from perf which was based on Linux Kbuild
 # try-cc
diff --git a/include/linux/time64.h b/include/linux/time64.h
index df9265483d65..3961589e7d51 100644
--- a/include/linux/time64.h
+++ b/include/linux/time64.h
@@ -1,3 +1,5 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
 #ifndef _TOOLS_LINUX_TIME64_H
 #define _TOOLS_LINUX_TIME64_H
 
diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index 666a1ebf1c19..a3a1075a7ebd 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -1,4 +1,4 @@
-
+# SPDX-License-Identifier: GPL-2.0
 
 include $(src)/scripts/utils.mk
 
diff --git a/lib/trace-cmd/include/private/trace-msg.h b/lib/trace-cmd/include/private/trace-msg.h
index aab8a69381e1..cfcf9615958c 100644
--- a/lib/trace-cmd/include/private/trace-msg.h
+++ b/lib/trace-cmd/include/private/trace-msg.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1 */
 #ifndef _TRACE_MSG_H_
 #define _TRACE_MSG_H_
 
diff --git a/lib/traceevent/Makefile b/lib/traceevent/Makefile
index c7f7cda07c91..0f9e5db8f7df 100644
--- a/lib/traceevent/Makefile
+++ b/lib/traceevent/Makefile
@@ -1,4 +1,4 @@
-
+# SPDX-License-Identifier: GPL-2.0
 
 include $(src)/scripts/utils.mk
 
diff --git a/lib/traceevent/plugins/Makefile b/lib/traceevent/plugins/Makefile
index 21e933affb12..d0afb590675a 100644
--- a/lib/traceevent/plugins/Makefile
+++ b/lib/traceevent/plugins/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
 include $(src)/scripts/utils.mk
 
 bdir:=$(obj)/lib/traceevent/plugins
diff --git a/lib/traceevent/plugins/plugin_python_loader.c b/lib/traceevent/plugins/plugin_python_loader.c
index 01bdfad341a3..c9a88e4ff44f 100644
--- a/lib/traceevent/plugins/plugin_python_loader.c
+++ b/lib/traceevent/plugins/plugin_python_loader.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: LGPL-2.1
 #include <Python.h>
 #include <stdio.h>
 #include "event-parse.h"
diff --git a/lib/tracefs/Makefile b/lib/tracefs/Makefile
index 895195172ffe..590a0ffed91a 100644
--- a/lib/tracefs/Makefile
+++ b/lib/tracefs/Makefile
@@ -1,4 +1,4 @@
-
+# SPDX-License-Identifier: LGPL-2.1
 
 include $(src)/scripts/utils.mk
 
diff --git a/python/Makefile b/python/Makefile
index deaa83ee94cc..d2906c4fd1c4 100644
--- a/python/Makefile
+++ b/python/Makefile
@@ -1,3 +1,5 @@
+# SPDX-License-Identifier: GPL-2.0
+
 include $(src)/scripts/utils.mk
 
 ifdef BUILD_PYTHON_WORKS
diff --git a/scripts/utils.mk b/scripts/utils.mk
index ccd4840f9364..5c47cb420af0 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 
 # Utils
 
diff --git a/tracecmd/Makefile b/tracecmd/Makefile
index de14176e2654..c02851a88f3e 100644
--- a/tracecmd/Makefile
+++ b/tracecmd/Makefile
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 
 VERSION := $(TC_VERSION)
 PATCHLEVEL := $(TC_PATCHLEVEL)
diff --git a/tracecmd/include/bug.h b/tracecmd/include/bug.h
index 5d5ef9f0f570..9222f935c5c0 100644
--- a/tracecmd/include/bug.h
+++ b/tracecmd/include/bug.h
@@ -1,3 +1,4 @@
+/* SPDX-License-Identifier: LGPL-2.1 */
 #ifndef __TRACE_CMD_BUG
 #define __TRACE_CMD_BUG
 
diff --git a/tracecmd/trace-usage.c b/tracecmd/trace-usage.c
index 0a338ed7d19c..1a7abd5887c1 100644
--- a/tracecmd/trace-usage.c
+++ b/tracecmd/trace-usage.c
@@ -1,3 +1,4 @@
+// SPDX-License-Identifier: GPL-2.0
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
diff --git a/utest/Makefile b/utest/Makefile
index 55828abb59e3..2cf9974591d8 100644
--- a/utest/Makefile
+++ b/utest/Makefile
@@ -1,3 +1,4 @@
+# SPDX-License-Identifier: GPL-2.0
 
 include $(src)/scripts/utils.mk
 
-- 
2.29.2



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

* [PATCH 02/13] trace-cmd: Allow overriding of pkg-config
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
  2020-12-11 17:08 ` [PATCH 01/13] trace-cmd: Add missing SPDX headers Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 03/13] trace-cmd: Use $(LIBTRACECMD_STATIC) instead of open coding in Makefile Steven Rostedt
                   ` (10 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

Change the Makefile to allow overriding of what is used for pkg-config.

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

diff --git a/Makefile b/Makefile
index 3334d92c2b85..8edd217b87b5 100644
--- a/Makefile
+++ b/Makefile
@@ -26,6 +26,7 @@ endef
 # Allow setting CC and AR, or setting CROSS_COMPILE as a prefix.
 $(call allow-override,CC,$(CROSS_COMPILE)gcc)
 $(call allow-override,AR,$(CROSS_COMPILE)ar)
+$(call allow-override,PKG_CONFIG,pkg-config)
 
 EXT = -std=gnu99
 INSTALL = install
@@ -133,7 +134,7 @@ PYTHON_VERS ?= python
 PYTHON_PKGCONFIG_VERS ?= $(PYTHON_VERS)
 
 # Can build python?
-ifeq ($(shell sh -c "pkg-config --cflags $(PYTHON_PKGCONFIG_VERS) > /dev/null 2>&1 && echo y"), y)
+ifeq ($(shell sh -c "$(PKG_CONFIG) --cflags $(PYTHON_PKGCONFIG_VERS) > /dev/null 2>&1 && echo y"), y)
 	BUILD_PYTHON := $(PYTHON)
 	BUILD_PYTHON_WORKS := 1
 else
@@ -206,9 +207,9 @@ LIBTRACEFS_DIR = $(obj)/lib/tracefs
 LIBTRACEFS_STATIC = $(LIBTRACEFS_DIR)/libtracefs.a
 LIBTRACEFS_SHARED = $(LIBTRACEFS_DIR)/libtracefs.so
 
-ifeq ($(shell sh -c "pkg-config --cflags $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y"), y)
-LIBTRACEEVENT_CFLAGS = $(shell sh -c "pkg-config --cflags $(LIBTRACEEVENT)")
-LIBTRACEEVENT_LDLAGS = $(shell sh -c "pkg-config --libs $(LIBTRACEEVENT)")
+ifeq ($(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y"), y)
+LIBTRACEEVENT_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)")
+LIBTRACEEVENT_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEEVENT)")
 else
 LIBTRACEEVENT_CFLAGS = -I$(src)/include/traceevent -I$(src)/lib/traceevent/include
 LIBTRACEEVENT_LDLAGS = -L$(LIBTRACEEVENT_DIR) -ltraceevent
@@ -218,9 +219,9 @@ endif
 
 export LIBTRACEEVENT_CFLAGS LIBTRACEEVENT_LDLAGS
 
-ifeq ($(shell sh -c "pkg-config --cflags $(LIBTRACEFS) > /dev/null 2>&1 && echo y"), y)
-LIBTRACEFS_CFLAGS = $(shell sh -c "pkg-config --cflags $(LIBTRACEFS)")
-LIBTRACEFS_LDLAGS = $(shell sh -c "pkg-config --libs $(LIBTRACEFS)")
+ifeq ($(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS) > /dev/null 2>&1 && echo y"), y)
+LIBTRACEFS_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEFS)")
+LIBTRACEFS_LDLAGS = $(shell sh -c "$(PKG_CONFIG) --libs $(LIBTRACEFS)")
 else
 LIBTRACEFS_CFLAGS = -I$(src)/include/tracefs
 LIBTRACEFS_LDLAGS = -L$(LIBTRACEFS_DIR) -ltracefs
@@ -494,10 +495,10 @@ report_nopythondev: force
 	$(Q)echo
 
 ifndef NO_PYTHON
-PYTHON_INCLUDES = `pkg-config --cflags $(PYTHON_PKGCONFIG_VERS)`
-PYTHON_LDFLAGS = `pkg-config --libs $(PYTHON_PKGCONFIG_VERS)` \
+PYTHON_INCLUDES = `$(PKG_CONFIG) --cflags $(PYTHON_PKGCONFIG_VERS)`
+PYTHON_LDFLAGS = `$(PKG_CONFIG) --libs $(PYTHON_PKGCONFIG_VERS)` \
 		$(shell $(PYTHON_VERS)-config --ldflags)
-PYGTK_CFLAGS = `pkg-config --cflags pygtk-2.0`
+PYGTK_CFLAGS = `$(PKG_CONFIG) --cflags pygtk-2.0`
 else
 PYTHON_INCLUDES =
 PYTHON_LDFLAGS =
-- 
2.29.2



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

* [PATCH 03/13] trace-cmd: Use $(LIBTRACECMD_STATIC) instead of open coding in Makefile
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
  2020-12-11 17:08 ` [PATCH 01/13] trace-cmd: Add missing SPDX headers Steven Rostedt
  2020-12-11 17:08 ` [PATCH 02/13] trace-cmd: Allow overriding of pkg-config Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 04/13] trace-cmd: Add versioning to libtracecmd.so Steven Rostedt
                   ` (9 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

In lib/trace-cmd/Makefile, the libtracecmd.a library and its build path is
open coded is a few places. Use the $(LIBTRACECMD_STATIC) variable instead.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 lib/trace-cmd/Makefile | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index a3a1075a7ebd..42f1f5c447eb 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -4,7 +4,7 @@ include $(src)/scripts/utils.mk
 
 bdir:=$(obj)/lib/trace-cmd
 
-DEFAULT_TARGET = $(bdir)/libtracecmd.a
+DEFAULT_TARGET = $(LIBTRACECMD_STATIC)
 
 OBJS =
 OBJS += trace-hash.o
@@ -35,7 +35,7 @@ $(bdir):
 $(OBJS): | $(bdir)
 $(DEPS): | $(bdir)
 
-$(bdir)/libtracecmd.a: $(OBJS)
+$(LIBTRACECMD_STATIC): $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
 LIBS = -L$(obj)/lib/traceevent -ltraceevent
-- 
2.29.2



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

* [PATCH 04/13] trace-cmd: Add versioning to libtracecmd.so
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (2 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 03/13] trace-cmd: Use $(LIBTRACECMD_STATIC) instead of open coding in Makefile Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 05/13] trace-cmd: Add pkg-config configuration for libtracecmd.so Steven Rostedt
                   ` (8 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

In preparation to installing libtracecmd.so as a system library, it is
required that it has a versioning in the name. Add three levels:

 LIBTC_VERSION : The main version level that is updated on breakage of apiS
 LIBTC_PATCHLEVEL: That is updated for new functionality
 LIBTC_EXTRAVERSION: That is updated for minor bug fixes

The main .so binary will have the full version which includes:

 libtracecmd.so.$(LIBTC_VERSION).$(LIBTC_PATCHLEVEL).$(LIBTC_EXTRAVERSION)

Then soft links will be created to this as follows:

 libtracecmd.so -> libtracecmd.so.$(LIBTC_VERSION)
 libtracecmd.so.$(LIBTC_VERSION) ->
      libtracecmd.so.$(LIBTC_VERSION).$(LIBTC_PATCHLEVEL).$(LIBTC_EXTRAVERSION)

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile               | 14 ++++++++++++--
 lib/trace-cmd/Makefile | 19 +++++++++++++++++--
 2 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index 8edd217b87b5..ea07e9ee7081 100644
--- a/Makefile
+++ b/Makefile
@@ -10,6 +10,16 @@ export TC_PATCHLEVEL
 export TC_EXTRAVERSION
 export TRACECMD_VERSION
 
+LIBTC_VERSION = 0
+LIBTC_PATCHLEVEL = 0
+LIBTC_EXTRAVERSION = 1
+LIBTRACECMD_VERSION = $(LIBTC_VERSION).$(LIBTC_PATCHLEVEL).$(LIBTC_EXTRAVERSION)
+
+export LIBTC_VERSION
+export LIBTC_PATCHLEVEL
+export LIBTC_EXTRAVERSION
+export LIBTRACECMD_VERSION
+
 MAKEFLAGS += --no-print-directory
 
 # Makefiles suck: This macro sets a default value of $(2) for the
@@ -200,7 +210,7 @@ LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so
 
 LIBTRACECMD_DIR = $(obj)/lib/trace-cmd
 LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a
-LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so
+LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so.$(LIBTRACECMD_VERSION)
 
 LIBTRACEFS=libtracefs
 LIBTRACEFS_DIR = $(obj)/lib/tracefs
@@ -347,7 +357,7 @@ $(LIBTRACECMD_STATIC): force
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd $@
 
 $(LIBTRACECMD_SHARED): force $(LIBTRACEEVENT_SHARED_BUILD)
-	$(Q)$(MAKE) -C $(src)/lib/trace-cmd $@
+	$(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so
 
 $(LIBTRACEFS_STATIC): force
 	$(Q)$(MAKE) -C $(src)/lib/tracefs $@
diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index 42f1f5c447eb..ec68831de610 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -40,7 +40,19 @@ $(LIBTRACECMD_STATIC): $(OBJS)
 
 LIBS = -L$(obj)/lib/traceevent -ltraceevent
 
-$(bdir)/libtracecmd.so: $(OBJS)
+LIBTRACECMD_SHARED_VERSION = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\.[0-9]*\).*/\1/')
+
+LIBTRACECMD_SHARED_SO = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\).*/\1/')
+
+$(LIBTRACECMD_SHARED_VERSION): $(LIBTRACECMD_SHARED)
+	@ln -sf $(<F) $@
+
+$(LIBTRACECMD_SHARED_SO): $(LIBTRACECMD_SHARED_VERSION)
+	@ln -sf $(<F) $@
+
+libtracecmd.so: force $(LIBTRACECMD_SHARED_SO)
+
+$(LIBTRACECMD_SHARED): $(OBJS)
 	$(Q)$(call do_compile_shared_library)
 
 $(bdir)/%.o: %.c
@@ -58,6 +70,9 @@ ifneq ($(dep_includes),)
 endif
 
 clean:
-	$(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d
+	$(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.so.* $(bdir)/*.o $(bdir)/.*.d
 
 .PHONY: clean
+
+PHONY += force
+force:
-- 
2.29.2



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

* [PATCH 05/13] trace-cmd: Add pkg-config configuration for libtracecmd.so
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (3 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 04/13] trace-cmd: Add versioning to libtracecmd.so Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 06/13] trace-cmd: Clean up the Makefiles a little Steven Rostedt
                   ` (7 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

Add pkg-config setup to install for pkg-config libtracecmd to return the
proper CFLAGS and LIB flags for building against libtracecmd.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile                | 24 ++++++++++++++++++++++--
 libtracecmd.pc.template | 10 ++++++++++
 scripts/utils.mk        |  8 ++++++++
 3 files changed, 40 insertions(+), 2 deletions(-)
 create mode 100644 libtracecmd.pc.template

diff --git a/Makefile b/Makefile
index ea07e9ee7081..24b2b8f652f7 100644
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,8 @@ libdir ?= $(prefix)/lib
 libdir_SQ = '$(subst ','\'',$(libdir))'
 includedir = $(prefix)/include
 includedir_SQ = '$(subst ','\'',$(includedir))'
+pkgconfig_dir ?= $(word 1,$(shell $(PKG_CONFIG) 		\
+			--variable pc_path pkg-config | tr ":" " "))
 
 ifeq ($(prefix),/usr/local)
 etcdir ?= /etc
@@ -196,6 +198,17 @@ objtree		:= $(BUILD_OUTPUT)
 src		:= $(srctree)
 obj		:= $(objtree)
 
+PKG_CONFIG_SOURCE_FILE = libtracecmd.pc
+PKG_CONFIG_FILE := $(addprefix $(BUILD_OUTPUT)/,$(PKG_CONFIG_SOURCE_FILE))
+
+define do_make_pkgconfig_file
+	cp -f $(srctree)/${PKG_CONFIG_SOURCE_FILE}.template ${PKG_CONFIG_FILE};	\
+	sed -i "s|INSTALL_PREFIX|${1}|g" ${PKG_CONFIG_FILE}; 		\
+	sed -i "s|LIB_VERSION|${LIBTRACECMD_VERSION}|g" ${PKG_CONFIG_FILE}; \
+	sed -i "s|LIB_DIR|$(libdir)|g" ${PKG_CONFIG_FILE}; \
+	sed -i "s|HEADER_DIR|$(includedir)/trace-cmd|g" ${PKG_CONFIG_FILE};
+endef
+
 kshark-dir	= $(src)/kernel-shark
 
 export prefix bindir src obj kshark-dir
@@ -331,6 +344,9 @@ CMAKE_COMMAND = /usr/bin/cmake
 # Build with "BUILD_TYPE=Release" to remove cmake debug info
 BUILD_TYPE ?= RelWithDebInfo
 
+$(PKG_CONFIG_FILE) : ${PKG_CONFIG_SOURCE_FILE}.template
+	$(Q) $(call do_make_pkgconfig_file,$(prefix))
+
 $(kshark-dir)/build/Makefile: $(kshark-dir)/CMakeLists.txt
 	$(Q) cd $(kshark-dir)/build && $(CMAKE_COMMAND) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -D_INSTALL_PREFIX=$(prefix) -D_LIBDIR=$(libdir) ..
 
@@ -435,7 +451,7 @@ install_python: force
 install_bash_completion: force
 	$(Q)$(call do_install_data,$(src)/tracecmd/trace-cmd.bash,$(BASH_COMPLETE_DIR))
 
-install_cmd: all_cmd install_plugins install_python install_bash_completion
+install_cmd: all_cmd install_plugins install_python install_bash_completion install_pkgconfig
 	$(Q)$(call do_install,$(obj)/tracecmd/trace-cmd,$(bindir_SQ))
 
 install: install_cmd
@@ -477,9 +493,13 @@ install_doc:
 install_doc_gui:
 	$(MAKE) -C $(kshark-dir)/Documentation install
 
+install_pkgconfig: $(PKG_CONFIG_FILE)
+	$(Q)$(call , $(PKG_CONFIG_FILE)) \
+		$(call do_install_pkgconfig_file,$(prefix))
+
 clean:
 	$(RM) *.o *~ *.a *.so .*.d
-	$(RM) tags TAGS cscope*
+	$(RM) tags TAGS cscope* $(PKG_CONFIG_SOURCE_FILE)
 	$(MAKE) -C $(src)/lib/traceevent clean
 	$(MAKE) -C $(src)/lib/trace-cmd clean
 	$(MAKE) -C $(src)/lib/tracefs clean
diff --git a/libtracecmd.pc.template b/libtracecmd.pc.template
new file mode 100644
index 000000000000..dc41076ece7d
--- /dev/null
+++ b/libtracecmd.pc.template
@@ -0,0 +1,10 @@
+prefix=INSTALL_PREFIX
+libdir=LIB_DIR
+includedir=HEADER_DIR
+
+Name: libtracecmd
+URL: https://git.kernel.org/pub/scm/utils/trace-cmd/trace-cmd.git/
+Description: Library for creating and reading trace-cmd data files
+Version: LIB_VERSION
+Cflags: -I${includedir}
+Libs: -L${libdir} -ltracecmd
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 5c47cb420af0..2e79f1a6ca0e 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -144,3 +144,11 @@ define do_install_ld
 		fi							\
 	fi
 endef
+
+define do_install_pkgconfig_file
+	if [ -n "${pkgconfig_dir}" ]; then 					\
+		$(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); 	\
+	else 									\
+		(echo Failed to locate pkg-config directory) 1>&2;		\
+	fi
+endef
-- 
2.29.2



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

* [PATCH 06/13] trace-cmd: Clean up the Makefiles a little
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (4 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 05/13] trace-cmd: Add pkg-config configuration for libtracecmd.so Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 07/13] trace-cmd: Remove making of ld.so.conf.d/trace.conf Steven Rostedt
                   ` (6 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

Organize the Makefiles a little:

 Move the definition of LIBTRACECMD_SHARED_VERSION and LIBTRACECMD_SHARED_SO
 to the top level Makefile.

 Move the exports for LIBTRACECMD_* right below their definitions.

 Move the LIBTRACECMD_* definitions above the LIBTRACEEVENT_* definitions,
 as LIBTRACECMD_* is the main code here.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile               | 13 ++++++++-----
 lib/trace-cmd/Makefile |  4 ----
 2 files changed, 8 insertions(+), 9 deletions(-)

diff --git a/Makefile b/Makefile
index 24b2b8f652f7..3e07be45f84e 100644
--- a/Makefile
+++ b/Makefile
@@ -215,16 +215,20 @@ export prefix bindir src obj kshark-dir
 
 LIBS = -ldl
 
+LIBTRACECMD_DIR = $(obj)/lib/trace-cmd
+LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a
+LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so.$(LIBTRACECMD_VERSION)
+LIBTRACECMD_SHARED_VERSION = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\.[0-9]*\).*/\1/')
+LIBTRACECMD_SHARED_SO = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\).*/\1/')
+
+export LIBTRACECMD_STATIC LIBTRACECMD_SHARED
+export LIBTRACECMD_SHARED_VERSION LIBTRACECMD_SHARED_SO
 
 LIBTRACEEVENT=libtraceevent
 LIBTRACEEVENT_DIR = $(obj)/lib/traceevent
 LIBTRACEEVENT_STATIC = $(LIBTRACEEVENT_DIR)/libtraceevent.a
 LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so
 
-LIBTRACECMD_DIR = $(obj)/lib/trace-cmd
-LIBTRACECMD_STATIC = $(LIBTRACECMD_DIR)/libtracecmd.a
-LIBTRACECMD_SHARED = $(LIBTRACECMD_DIR)/libtracecmd.so.$(LIBTRACECMD_VERSION)
-
 LIBTRACEFS=libtracefs
 LIBTRACEFS_DIR = $(obj)/lib/tracefs
 LIBTRACEFS_STATIC = $(LIBTRACEFS_DIR)/libtracefs.a
@@ -259,7 +263,6 @@ TRACE_LIBS = -L$(LIBTRACECMD_DIR) -ltracecmd	\
 
 export LIBS TRACE_LIBS
 export LIBTRACEEVENT_DIR LIBTRACECMD_DIR LIBTRACEFS_DIR
-export LIBTRACECMD_STATIC LIBTRACECMD_SHARED
 export Q SILENT VERBOSE EXT
 
 # Include the utils
diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index ec68831de610..cd66eaa8ea6c 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -40,10 +40,6 @@ $(LIBTRACECMD_STATIC): $(OBJS)
 
 LIBS = -L$(obj)/lib/traceevent -ltraceevent
 
-LIBTRACECMD_SHARED_VERSION = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\.[0-9]*\).*/\1/')
-
-LIBTRACECMD_SHARED_SO = $(shell echo $(LIBTRACECMD_SHARED) | sed -e 's/\(\.so\).*/\1/')
-
 $(LIBTRACECMD_SHARED_VERSION): $(LIBTRACECMD_SHARED)
 	@ln -sf $(<F) $@
 
-- 
2.29.2



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

* [PATCH 07/13] trace-cmd: Remove making of ld.so.conf.d/trace.conf
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (5 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 06/13] trace-cmd: Clean up the Makefiles a little Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 08/13] trace-cmd: Install libtracecmd in the proper lib directory Steven Rostedt
                   ` (5 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

Updating the ld.conf.d directory is an unneeded maintenance burden for
installation. Simply make the libtracecmd.so be installed in the default
lib{64} directory instead, and not in its own trace-cmd/ directory within
the lib{64} directory.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile         |  4 ----
 scripts/utils.mk | 10 ----------
 2 files changed, 14 deletions(-)

diff --git a/Makefile b/Makefile
index 3e07be45f84e..0c5da92b54b6 100644
--- a/Makefile
+++ b/Makefile
@@ -111,7 +111,6 @@ HELP_DIR_SQ = '$(subst ','\'',$(HELP_DIR))'
 
 BASH_COMPLETE_DIR ?= $(etcdir)/bash_completion.d
 LD_SO_CONF_DIR ?= $(etcdir)/ld.so.conf.d
-TRACE_LD_FILE ?= trace.conf
 
 export PLUGIN_DIR_TRACEEVENT
 export PLUGIN_DIR_TRACECMD
@@ -468,17 +467,14 @@ install_traceevent: $(LIBTRACEEVENT_STATIC_BUILD)
 	$(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)/traceevent)
 	$(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)/traceevent)
 	$(Q)$(call do_install,$(src)/include/traceevent/trace-seq.h,$(includedir_SQ)/traceevent)
-	$(Q)$(call do_install_ld,$(TRACE_LD_FILE),$(LD_SO_CONF_DIR),$(libdir_SQ)/traceevent)
 
 install_tracefs: $(LIBTRACEFS_STATIC_BUILD)
 	$(Q)$(call do_install,$(LIBTRACEFS_SHARED),$(libdir_SQ)/tracefs)
 	$(Q)$(call do_install,$(src)/include/tracefs/tracefs.h,$(includedir_SQ)/tracefs)
-	$(Q)$(call do_install_ld,$(TRACE_LD_FILE),$(LD_SO_CONF_DIR),$(libdir_SQ)/tracefs)
 
 install_libs: libs $(INSTALL_TRACEEVENT) $(INSTALL_TRACEFS)
 	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)/trace-cmd)
 	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
-	$(Q)$(call do_install_ld,$(TRACE_LD_FILE),$(LD_SO_CONF_DIR),$(libdir_SQ)/trace-cmd)
 
 doc:
 	$(MAKE) -C $(src)/Documentation all
diff --git a/scripts/utils.mk b/scripts/utils.mk
index 2e79f1a6ca0e..1d090d8ac001 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -135,16 +135,6 @@ define do_install_data
 	$(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
-
 define do_install_pkgconfig_file
 	if [ -n "${pkgconfig_dir}" ]; then 					\
 		$(call do_install,$(PKG_CONFIG_FILE),$(pkgconfig_dir),644); 	\
-- 
2.29.2



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

* [PATCH 08/13] trace-cmd: Install libtracecmd in the proper lib directory
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (6 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 07/13] trace-cmd: Remove making of ld.so.conf.d/trace.conf Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 09/13] trace-cmd: Move the installing of libtracecmd to the lib/trace-cmd Makefile Steven Rostedt
                   ` (4 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

Instead of installing libtracecmd library into its own directory under lib/,
where the dynamic linker ld has trouble finding it, use the appropriate lib
path (lib or lib64) to place libtracecmd.*

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

diff --git a/Makefile b/Makefile
index 0c5da92b54b6..041bd79b5aec 100644
--- a/Makefile
+++ b/Makefile
@@ -48,6 +48,14 @@ INSTALL = install
 DESTDIR ?=
 DESTDIR_SQ = '$(subst ','\'',$(DESTDIR))'
 
+LP64 := $(shell echo __LP64__ | ${CC} ${CFLAGS} -E -x c - | tail -n 1)
+ifeq ($(LP64), 1)
+  libdir_relative_temp = lib64
+else
+  libdir_relative_temp = lib
+endif
+
+libdir_relative ?= $(libdir_relative_temp)
 prefix ?= /usr/local
 bindir_relative = bin
 bindir = $(prefix)/$(bindir_relative)
@@ -57,7 +65,7 @@ html_install = $(prefix)/share/kernelshark/html
 html_install_SQ = '$(subst ','\'',$(html_install))'
 img_install = $(prefix)/share/kernelshark/html/images
 img_install_SQ = '$(subst ','\'',$(img_install))'
-libdir ?= $(prefix)/lib
+libdir = $(prefix)/$(libdir_relative)
 libdir_SQ = '$(subst ','\'',$(libdir))'
 includedir = $(prefix)/include
 includedir_SQ = '$(subst ','\'',$(includedir))'
@@ -473,7 +481,7 @@ install_tracefs: $(LIBTRACEFS_STATIC_BUILD)
 	$(Q)$(call do_install,$(src)/include/tracefs/tracefs.h,$(includedir_SQ)/tracefs)
 
 install_libs: libs $(INSTALL_TRACEEVENT) $(INSTALL_TRACEFS)
-	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ)/trace-cmd)
+	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ))
 	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
 
 doc:
-- 
2.29.2



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

* [PATCH 09/13] trace-cmd: Move the installing of libtracecmd to the lib/trace-cmd Makefile
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (7 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 08/13] trace-cmd: Install libtracecmd in the proper lib directory Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 10/13] trace-cmd: Install the soft links for libtracecmd.so Steven Rostedt
                   ` (3 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

As a clean up, move the installation processing of libtracecmd libraries
into the lib/trace-cmd directory.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile               | 5 ++---
 lib/trace-cmd/Makefile | 4 ++++
 2 files changed, 6 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile
index 041bd79b5aec..30528952740d 100644
--- a/Makefile
+++ b/Makefile
@@ -80,7 +80,7 @@ endif
 etcdir_SQ = '$(subst ','\'',$(etcdir))'
 
 export man_dir man_dir_SQ html_install html_install_SQ INSTALL
-export img_install img_install_SQ
+export img_install img_install_SQ libdir_SQ includedir_SQ
 export DESTDIR DESTDIR_SQ
 
 ifeq ($(prefix),$(HOME))
@@ -481,8 +481,7 @@ install_tracefs: $(LIBTRACEFS_STATIC_BUILD)
 	$(Q)$(call do_install,$(src)/include/tracefs/tracefs.h,$(includedir_SQ)/tracefs)
 
 install_libs: libs $(INSTALL_TRACEEVENT) $(INSTALL_TRACEFS)
-	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ))
-	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
+	$(Q)$(MAKE) -C $(src)/lib/trace-cmd/ $@
 
 doc:
 	$(MAKE) -C $(src)/Documentation all
diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index cd66eaa8ea6c..96acdaf9aa27 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -59,6 +59,10 @@ $(DEPS): $(bdir)/.%.d: %.c
 
 $(OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
+install_libs:
+	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ))
+	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
+
 dep_includes := $(wildcard $(DEPS))
 
 ifneq ($(dep_includes),)
-- 
2.29.2



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

* [PATCH 10/13] trace-cmd: Install the soft links for libtracecmd.so
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (8 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 09/13] trace-cmd: Move the installing of libtracecmd to the lib/trace-cmd Makefile Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 11/13] trace-cmd: Do not install libtracefs nor libtraceevent libraries Steven Rostedt
                   ` (2 subsequent siblings)
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

The libtracecmd.so.$(LIBTRACECMD_VERSION) was being installed into the lib/
directory, but that is not enough for applications to use. It also needs the
libtracecmd.so and libtracecmd.so.$(LIBTC_VERSION) soft links to be
installed too.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 lib/trace-cmd/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/lib/trace-cmd/Makefile b/lib/trace-cmd/Makefile
index 96acdaf9aa27..838a59ddf332 100644
--- a/lib/trace-cmd/Makefile
+++ b/lib/trace-cmd/Makefile
@@ -61,6 +61,8 @@ $(OBJS): $(bdir)/%.o : $(bdir)/.%.d
 
 install_libs:
 	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ))
+	cp -fpR $(LIBTRACECMD_SHARED_VERSION) $(DESTDIR)$(libdir_SQ)
+	cp -fpR $(LIBTRACECMD_SHARED_SO) $(DESTDIR)$(libdir_SQ)
 	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ)/trace-cmd)
 
 dep_includes := $(wildcard $(DEPS))
-- 
2.29.2



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

* [PATCH 11/13] trace-cmd: Do not install libtracefs nor libtraceevent libraries
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (9 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 10/13] trace-cmd: Install the soft links for libtracecmd.so Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 12/13] trace-cmd: Do not build shared libraries for libtracefs and libtraceevent Steven Rostedt
  2020-12-11 17:08 ` [PATCH 13/13] trace-cmd: Add warning if libtracefs or libtraceevent are not found Steven Rostedt
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

Now that both libtraceevent and libtracefs have their own repos and are
packaged separately from trace-cmd, do not install the libraries even if
they do not exist on the system. Anything that depends on those libraries
are require to get them from their corresponding repos and not depend on
trace-cmd for them from now on.

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

diff --git a/Makefile b/Makefile
index 30528952740d..737e54d82697 100644
--- a/Makefile
+++ b/Makefile
@@ -248,7 +248,6 @@ else
 LIBTRACEEVENT_CFLAGS = -I$(src)/include/traceevent -I$(src)/lib/traceevent/include
 LIBTRACEEVENT_LDLAGS = -L$(LIBTRACEEVENT_DIR) -ltraceevent
 LIBTRACEEVENT_STATIC_BUILD = $(LIBTRACEEVENT_STATIC)
-INSTALL_TRACEEVENT = install_traceevent
 endif
 
 export LIBTRACEEVENT_CFLAGS LIBTRACEEVENT_LDLAGS
@@ -260,7 +259,6 @@ else
 LIBTRACEFS_CFLAGS = -I$(src)/include/tracefs
 LIBTRACEFS_LDLAGS = -L$(LIBTRACEFS_DIR) -ltracefs
 LIBTRACEFS_STATIC_BUILD = $(LIBTRACEFS_STATIC)
-INSTALL_TRACEFS = install_tracefs
 endif
 
 export LIBTRACEFS_CFLAGS LIBTRACEFS_LDLAGS
@@ -471,16 +469,7 @@ install: install_cmd
 install_gui: install_cmd gui
 	$(Q)$(MAKE) $(S) -C $(kshark-dir)/build install
 
-install_traceevent: $(LIBTRACEEVENT_STATIC_BUILD)
-	$(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ)/traceevent)
-	$(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ)/traceevent)
-	$(Q)$(call do_install,$(src)/include/traceevent/trace-seq.h,$(includedir_SQ)/traceevent)
-
-install_tracefs: $(LIBTRACEFS_STATIC_BUILD)
-	$(Q)$(call do_install,$(LIBTRACEFS_SHARED),$(libdir_SQ)/tracefs)
-	$(Q)$(call do_install,$(src)/include/tracefs/tracefs.h,$(includedir_SQ)/tracefs)
-
-install_libs: libs $(INSTALL_TRACEEVENT) $(INSTALL_TRACEFS)
+install_libs: libs
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd/ $@
 
 doc:
-- 
2.29.2



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

* [PATCH 12/13] trace-cmd: Do not build shared libraries for libtracefs and libtraceevent
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (10 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 11/13] trace-cmd: Do not install libtracefs nor libtraceevent libraries Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  2020-12-11 17:08 ` [PATCH 13/13] trace-cmd: Add warning if libtracefs or libtraceevent are not found Steven Rostedt
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

As libtraceevent and libtracefs are now packaged separately and are built
from their own corresponding repos, the local copy that trace-cmd uses is
only in the case that the libraries are not present on the local system.
In this case, trace-cmd should build its wont static library and link to
that. This will be deprecated in the future and trace-cmd will eventually
depend on the external libraries for libtracefs and libtraceevent.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile                | 13 +------------
 lib/traceevent/Makefile |  5 +----
 lib/tracefs/Makefile    |  5 +----
 3 files changed, 3 insertions(+), 20 deletions(-)

diff --git a/Makefile b/Makefile
index 737e54d82697..1f7cab57cd7d 100644
--- a/Makefile
+++ b/Makefile
@@ -234,12 +234,10 @@ export LIBTRACECMD_SHARED_VERSION LIBTRACECMD_SHARED_SO
 LIBTRACEEVENT=libtraceevent
 LIBTRACEEVENT_DIR = $(obj)/lib/traceevent
 LIBTRACEEVENT_STATIC = $(LIBTRACEEVENT_DIR)/libtraceevent.a
-LIBTRACEEVENT_SHARED = $(LIBTRACEEVENT_DIR)/libtraceevent.so
 
 LIBTRACEFS=libtracefs
 LIBTRACEFS_DIR = $(obj)/lib/tracefs
 LIBTRACEFS_STATIC = $(LIBTRACEFS_DIR)/libtracefs.a
-LIBTRACEFS_SHARED = $(LIBTRACEFS_DIR)/libtracefs.so
 
 ifeq ($(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT) > /dev/null 2>&1 && echo y"), y)
 LIBTRACEEVENT_CFLAGS = $(shell sh -c "$(PKG_CONFIG) --cflags $(LIBTRACEEVENT)")
@@ -369,10 +367,6 @@ trace-cmd: force $(LIBTRACEEVENT_STATIC_BUILD) $(LIBTRACECMD_STATIC) $(LIBTRACEF
 	force $(obj)/lib/trace-cmd/plugins/tracecmd_plugin_dir
 	$(Q)$(MAKE) -C $(src)/tracecmd $(obj)/tracecmd/$@
 
-$(LIBTRACEEVENT_SHARED): force $(obj)/lib/traceevent/plugins/trace_python_dir \
-			 $(obj)/lib/traceevent/plugins/traceevent_plugin_dir
-	$(Q)$(MAKE) -C $(src)/lib/traceevent $@
-
 $(LIBTRACEEVENT_STATIC): force $(obj)/lib/traceevent/plugins/trace_python_dir \
 			 $(obj)/lib/traceevent/plugins/traceevent_plugin_dir
 	$(Q)$(MAKE) -C $(src)/lib/traceevent $@
@@ -386,17 +380,12 @@ $(LIBTRACECMD_SHARED): force $(LIBTRACEEVENT_SHARED_BUILD)
 $(LIBTRACEFS_STATIC): force
 	$(Q)$(MAKE) -C $(src)/lib/tracefs $@
 
-$(LIBTRACEFS_SHARED): force
-	$(Q)$(MAKE) -C $(src)/lib/tracefs $@
-
-libtraceevent.so: $(LIBTRACEEVENT_SHARED)
 libtraceevent.a: $(LIBTRACEEVENT_STATIC)
 libtracecmd.a: $(LIBTRACECMD_STATIC)
 libtracecmd.so: $(LIBTRACECMD_SHARED)
 libtracefs.a: $(LIBTRACEFS_STATIC)
-libtracefs.so: $(LIBTRACEFS_SHARED)
 
-libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_SHARED_BUILD) $(LIBTRACEFS_SHARED_BUILD)
+libs: $(LIBTRACECMD_SHARED) $(LIBTRACEEVENT_STATIC_BUILD) $(LIBTRACEFS_STATIC_BUILD)
 
 test: force $(LIBTRACEEVENT_STATIC_BUILD) $(LIBTRACEFS_STATIC_BUILD) $(LIBTRACECMD_STATIC)
 ifneq ($(CUNIT_INSTALLED),1)
diff --git a/lib/traceevent/Makefile b/lib/traceevent/Makefile
index 0f9e5db8f7df..edb2fccfff07 100644
--- a/lib/traceevent/Makefile
+++ b/lib/traceevent/Makefile
@@ -32,9 +32,6 @@ $(DEPS): | $(bdir)
 $(bdir)/libtraceevent.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
-$(bdir)/libtraceevent.so: $(OBJS)
-	$(Q)$(call do_compile_shared_library)
-
 $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
@@ -50,6 +47,6 @@ ifneq ($(dep_includes),)
 endif
 
 clean:
-	$(RM) -f $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d
+	$(RM) -f $(bdir)/*.a $(bdir)/*.o $(bdir)/.*.d
 
 .PHONY: clean
diff --git a/lib/tracefs/Makefile b/lib/tracefs/Makefile
index 590a0ffed91a..33112690914d 100644
--- a/lib/tracefs/Makefile
+++ b/lib/tracefs/Makefile
@@ -29,9 +29,6 @@ LIBS = -L$(obj)/lib/traceevent -ltraceevent
 $(bdir)/libtracefs.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
-$(bdir)/libtracefs.so: $(OBJS)
-	$(Q)$(call do_compile_shared_library)
-
 $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
@@ -47,6 +44,6 @@ ifneq ($(dep_includes),)
 endif
 
 clean:
-	$(RM) $(bdir)/*.a $(bdir)/*.so $(bdir)/*.o $(bdir)/.*.d
+	$(RM) $(bdir)/*.a $(bdir)/*.o $(bdir)/.*.d
 
 .PHONY: clean
-- 
2.29.2



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

* [PATCH 13/13] trace-cmd: Add warning if libtracefs or libtraceevent are not found
  2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
                   ` (11 preceding siblings ...)
  2020-12-11 17:08 ` [PATCH 12/13] trace-cmd: Do not build shared libraries for libtracefs and libtraceevent Steven Rostedt
@ 2020-12-11 17:08 ` Steven Rostedt
  12 siblings, 0 replies; 14+ messages in thread
From: Steven Rostedt @ 2020-12-11 17:08 UTC (permalink / raw)
  To: linux-trace-devel

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

Add a warning notice if either or both libtraceevent or libtracefs is not
found on the system for linking. If the local version is being built,
display a notice and show where they can get the corresponding library.

Signed-off-by: Steven Rostedt (VMware) <rostedt@goodmis.org>
---
 Makefile                |  4 ++--
 lib/traceevent/Makefile | 14 ++++++++++++++
 lib/tracefs/Makefile    | 13 +++++++++++++
 3 files changed, 29 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 1f7cab57cd7d..ab91ae777b83 100644
--- a/Makefile
+++ b/Makefile
@@ -369,7 +369,7 @@ trace-cmd: force $(LIBTRACEEVENT_STATIC_BUILD) $(LIBTRACECMD_STATIC) $(LIBTRACEF
 
 $(LIBTRACEEVENT_STATIC): force $(obj)/lib/traceevent/plugins/trace_python_dir \
 			 $(obj)/lib/traceevent/plugins/traceevent_plugin_dir
-	$(Q)$(MAKE) -C $(src)/lib/traceevent $@
+	$(Q)$(MAKE) -C $(src)/lib/traceevent libtraceevent
 
 $(LIBTRACECMD_STATIC): force
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd $@
@@ -378,7 +378,7 @@ $(LIBTRACECMD_SHARED): force $(LIBTRACEEVENT_SHARED_BUILD)
 	$(Q)$(MAKE) -C $(src)/lib/trace-cmd libtracecmd.so
 
 $(LIBTRACEFS_STATIC): force
-	$(Q)$(MAKE) -C $(src)/lib/tracefs $@
+	$(Q)$(MAKE) -C $(src)/lib/tracefs libtracefs
 
 libtraceevent.a: $(LIBTRACEEVENT_STATIC)
 libtracecmd.a: $(LIBTRACECMD_STATIC)
diff --git a/lib/traceevent/Makefile b/lib/traceevent/Makefile
index edb2fccfff07..0dcd90c13328 100644
--- a/lib/traceevent/Makefile
+++ b/lib/traceevent/Makefile
@@ -29,9 +29,23 @@ $(bdir):
 $(OBJS): | $(bdir)
 $(DEPS): | $(bdir)
 
+.PHONY: warning
+warning:
+	@echo "********************************************"
+	@echo "** NOTICE: libtraceevent not found on system"
+	@echo "**"
+	@echo "** Building obsolete local version of libtraceevent"
+	@echo "** Consider installing the latest libtraceevent"
+	@echo "**"
+	@echo "**  https://git.kernel.org/pub/scm/libs/libtrace/libtraceevent.git/ "
+	@echo "**"
+	@echo "********************************************"
+
 $(bdir)/libtraceevent.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
+libtraceevent: $(bdir)/libtraceevent.a warning
+
 $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
diff --git a/lib/tracefs/Makefile b/lib/tracefs/Makefile
index 33112690914d..021ae2b040de 100644
--- a/lib/tracefs/Makefile
+++ b/lib/tracefs/Makefile
@@ -26,9 +26,22 @@ $(DEPS): | $(bdir)
 
 LIBS = -L$(obj)/lib/traceevent -ltraceevent
 
+.PHONY: warning
+warning:
+	@echo "********************************************"
+	@echo "** NOTICE: libtracefs not found on system"
+	@echo "**"
+	@echo "** Building obsolete local version of libtracefs"
+	@echo "** Consider installing the latest libtracefs"
+	@echo "**"
+	@echo "**  https://git.kernel.org/pub/scm/libs/libtrace/libtracefs.git/ "
+	@echo "**"
+	@echo "********************************************"
+
 $(bdir)/libtracefs.a: $(OBJS)
 	$(Q)$(call do_build_static_lib)
 
+libtracefs: $(bdir)/libtracefs.a warning
 $(bdir)/%.o: %.c
 	$(Q)$(call do_fpic_compile)
 
-- 
2.29.2



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

end of thread, other threads:[~2020-12-11 18:59 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-11 17:08 [PATCH 00/13] trace-cmd: Clean ups to the Makefile for using external libraries Steven Rostedt
2020-12-11 17:08 ` [PATCH 01/13] trace-cmd: Add missing SPDX headers Steven Rostedt
2020-12-11 17:08 ` [PATCH 02/13] trace-cmd: Allow overriding of pkg-config Steven Rostedt
2020-12-11 17:08 ` [PATCH 03/13] trace-cmd: Use $(LIBTRACECMD_STATIC) instead of open coding in Makefile Steven Rostedt
2020-12-11 17:08 ` [PATCH 04/13] trace-cmd: Add versioning to libtracecmd.so Steven Rostedt
2020-12-11 17:08 ` [PATCH 05/13] trace-cmd: Add pkg-config configuration for libtracecmd.so Steven Rostedt
2020-12-11 17:08 ` [PATCH 06/13] trace-cmd: Clean up the Makefiles a little Steven Rostedt
2020-12-11 17:08 ` [PATCH 07/13] trace-cmd: Remove making of ld.so.conf.d/trace.conf Steven Rostedt
2020-12-11 17:08 ` [PATCH 08/13] trace-cmd: Install libtracecmd in the proper lib directory Steven Rostedt
2020-12-11 17:08 ` [PATCH 09/13] trace-cmd: Move the installing of libtracecmd to the lib/trace-cmd Makefile Steven Rostedt
2020-12-11 17:08 ` [PATCH 10/13] trace-cmd: Install the soft links for libtracecmd.so Steven Rostedt
2020-12-11 17:08 ` [PATCH 11/13] trace-cmd: Do not install libtracefs nor libtraceevent libraries Steven Rostedt
2020-12-11 17:08 ` [PATCH 12/13] trace-cmd: Do not build shared libraries for libtracefs and libtraceevent Steven Rostedt
2020-12-11 17:08 ` [PATCH 13/13] trace-cmd: Add warning if libtracefs or libtraceevent are not found 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).