linux-trace-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/4] trace-cmd: Fixes for packaging
@ 2019-07-20  3:03 Patrick McLean
  2019-07-20  3:03 ` [PATCH 1/4] trace-cmd: Allow overriding of python installation directory Patrick McLean
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Patrick McLean @ 2019-07-20  3:03 UTC (permalink / raw)
  To: linux-trace-devel

These are various patches to trace-cmd I needed to use to package both
it and kernelshark on Gentoo. Some of these may not be needed by other
distros, as these are at least partially to help with building them
as completely separate packages.



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

* [PATCH 1/4] trace-cmd: Allow overriding of python installation directory
  2019-07-20  3:03 [PATCH 0/4] trace-cmd: Fixes for packaging Patrick McLean
@ 2019-07-20  3:03 ` Patrick McLean
  2019-07-20  3:03 ` [PATCH 2/4] trace-cmd: No automagic dependency on udis86 Patrick McLean
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Patrick McLean @ 2019-07-20  3:03 UTC (permalink / raw)
  To: linux-trace-devel

From: Patrick McLean <patrick.mclean@sony.com>

The current Makefile hardcodes the python module install directory, so
packages can't put them in their distro's perferred location. This
allows the directory to be overriden on the command line.

Signed-off-by: Patrick McLean <patrick.mclean@sony.com>
---
 Makefile | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index ad74a96..3579f27 100644
--- a/Makefile
+++ b/Makefile
@@ -64,7 +64,7 @@ python_dir = $(HOME)/.trace-cmd/python
 var_dir = $(HOME)/.trace-cmd/
 else
 plugin_dir = $(libdir)/trace-cmd/plugins
-python_dir = $(libdir)/trace-cmd/python
+python_dir ?= $(libdir)/trace-cmd/python
 PLUGIN_DIR = -DPLUGIN_DIR="$(plugin_dir)"
 PYTHON_DIR = -DPYTHON_DIR="$(python_dir)"
 PLUGIN_DIR_SQ = '$(subst ','\'',$(PLUGIN_DIR))'
-- 
2.22.0


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

* [PATCH 2/4] trace-cmd: No automagic dependency on udis86
  2019-07-20  3:03 [PATCH 0/4] trace-cmd: Fixes for packaging Patrick McLean
  2019-07-20  3:03 ` [PATCH 1/4] trace-cmd: Allow overriding of python installation directory Patrick McLean
@ 2019-07-20  3:03 ` Patrick McLean
  2019-07-20  3:17   ` Steven Rostedt
  2019-07-20  3:03 ` [PATCH 3/4] trace-cmd: Install all headers needed by kernelshark to proper paths Patrick McLean
  2019-07-20  3:03 ` [PATCH 4/4] trace-cmd: Set SONAME on shared libraries Patrick McLean
  3 siblings, 1 reply; 7+ messages in thread
From: Patrick McLean @ 2019-07-20  3:03 UTC (permalink / raw)
  To: linux-trace-devel

From: Patrick McLean <patrick.mclean@sony.com>

Currently if udis86 is detected on the system, trace-cmd automatically
uses it. This is generally a problem for packagers since if the build
machine happens to have udis86, now there is a dependency on it that may
or may not be tracked.

This adds a NO_UDIS86 variable that can be set by the packager to
disable using udis86 completely.

Signed-off-by: Patrick McLean <patrick.mclean@sony.com>
---
 Makefile | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 3579f27..6b85e21 100644
--- a/Makefile
+++ b/Makefile
@@ -136,8 +136,13 @@ export NO_PYTHON
 test-build = $(if $(shell sh -c 'echo "$(1)" | \
 	$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2)
 
+ifndef NO_UDIS86
 # have udis86 disassembler library?
-udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86)
+udis86-flags := -DHAVE_UDIS86
+udis86-ldflags := -ludis86
+else
+udis86-flags := -UHAVE_UDIS86
+endif # NO_UDIS86
 
 define BLK_TC_FLUSH_SOURCE
 #include <linux/blktrace_api.h>
@@ -237,6 +242,7 @@ endif
 # Append required CFLAGS
 override CFLAGS += $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR)
 override CFLAGS += $(udis86-flags) $(blk-flags)
+override LDFLAGS += $(udis86-ldflags)
 
 CMD_TARGETS = trace-cmd $(BUILD_PYTHON)
 
-- 
2.22.0


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

* [PATCH 3/4] trace-cmd: Install all headers needed by kernelshark to proper paths
  2019-07-20  3:03 [PATCH 0/4] trace-cmd: Fixes for packaging Patrick McLean
  2019-07-20  3:03 ` [PATCH 1/4] trace-cmd: Allow overriding of python installation directory Patrick McLean
  2019-07-20  3:03 ` [PATCH 2/4] trace-cmd: No automagic dependency on udis86 Patrick McLean
@ 2019-07-20  3:03 ` Patrick McLean
  2019-07-20  3:03 ` [PATCH 4/4] trace-cmd: Set SONAME on shared libraries Patrick McLean
  3 siblings, 0 replies; 7+ messages in thread
From: Patrick McLean @ 2019-07-20  3:03 UTC (permalink / raw)
  To: linux-trace-devel

From: Patrick McLean <patrick.mclean@sony.com>

The trace-cmd build system installs headers for building kernelshark,
but it is missing trace-seq.h and trace-filter-hash.h.

It additionally installs event-parse.h to the toplevel "trace-cmd"
include directory, but the generated header includes it as
"traceevent/event-parse.h" so the kernelshark build fails.

This patch installs all the headers needed to build kernelshark to the
appropiate directories.

Signed-off-by: Patrick McLean <patrick.mclean@sony.com>
---
 Makefile | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 6b85e21..3bab851 100644
--- a/Makefile
+++ b/Makefile
@@ -345,8 +345,10 @@ install_gui: install_cmd gui
 install_libs: libs
 	$(Q)$(call do_install,$(LIBTRACECMD_SHARED),$(libdir_SQ))
 	$(Q)$(call do_install,$(LIBTRACEEVENT_SHARED),$(libdir_SQ))
-	$(Q)$(call do_install,$(src)/include/traceevent/event-parse.h,$(includedir_SQ))
+	$(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,$(src)/include/trace-cmd/trace-cmd.h,$(includedir_SQ))
+	$(Q)$(call do_install,$(src)/include/trace-cmd/trace-filter-hash.h,$(includedir_SQ))
 
 doc:
 	$(MAKE) -C $(src)/Documentation all
-- 
2.22.0


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

* [PATCH 4/4] trace-cmd: Set SONAME on shared libraries
  2019-07-20  3:03 [PATCH 0/4] trace-cmd: Fixes for packaging Patrick McLean
                   ` (2 preceding siblings ...)
  2019-07-20  3:03 ` [PATCH 3/4] trace-cmd: Install all headers needed by kernelshark to proper paths Patrick McLean
@ 2019-07-20  3:03 ` Patrick McLean
  3 siblings, 0 replies; 7+ messages in thread
From: Patrick McLean @ 2019-07-20  3:03 UTC (permalink / raw)
  To: linux-trace-devel

From: Patrick McLean <patrick.mclean@sony.com>

Currently trace-cmd installs some shared libraries, but does not set a
SONAME on these. This often violates distro policies, so it should at
least set something.

This patch sets it to the name of the file, which is somewhat naieve,
but works for many libraries. Generally it should be set to have an ABI
version as the extension, so when the developer breaks ABI, they can
change the soname.

Signed-off-by: Patrick McLean <patrick.mclean@sony.com>
---
 scripts/utils.mk | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/utils.mk b/scripts/utils.mk
index 260023a..9eb127d 100644
--- a/scripts/utils.mk
+++ b/scripts/utils.mk
@@ -54,7 +54,7 @@ do_build_static_lib =				\
 
 do_compile_shared_library =			\
 	($(print_shared_lib_compile)		\
-	$(CC) --shared $^ -o $@)
+	$(CC) --shared $^ -Wl,-soname,$@ -o $@)
 
 do_compile_plugin_obj =				\
 	($(print_plugin_obj_compile)		\
-- 
2.22.0


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

* Re: [PATCH 2/4] trace-cmd: No automagic dependency on udis86
  2019-07-20  3:03 ` [PATCH 2/4] trace-cmd: No automagic dependency on udis86 Patrick McLean
@ 2019-07-20  3:17   ` Steven Rostedt
  2019-07-23 17:41     ` Patrick McLean
  0 siblings, 1 reply; 7+ messages in thread
From: Steven Rostedt @ 2019-07-20  3:17 UTC (permalink / raw)
  To: Patrick McLean; +Cc: linux-trace-devel


Hi Patrick,

Thanks for sending these. Some questions below.

On Fri, 19 Jul 2019 20:03:42 -0700
Patrick McLean <chutzpah@gentoo.org> wrote:

> From: Patrick McLean <patrick.mclean@sony.com>
> 
> Currently if udis86 is detected on the system, trace-cmd automatically
> uses it. This is generally a problem for packagers since if the build
> machine happens to have udis86, now there is a dependency on it that may
> or may not be tracked.
> 
> This adds a NO_UDIS86 variable that can be set by the packager to
> disable using udis86 completely.
> 
> Signed-off-by: Patrick McLean <patrick.mclean@sony.com>
> ---
>  Makefile | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/Makefile b/Makefile
> index 3579f27..6b85e21 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -136,8 +136,13 @@ export NO_PYTHON
>  test-build = $(if $(shell sh -c 'echo "$(1)" | \
>  	$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2)
>  
> +ifndef NO_UDIS86
>  # have udis86 disassembler library?
> -udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86)
> +udis86-flags := -DHAVE_UDIS86
> +udis86-ldflags := -ludis86

Can we keep the test here? If NO_UDIS86 is not defined. That is, if you
compile without this define, this change assumes you have it.

It's fine to force not having it, but we shouldn't force having it if
we don't.


> +else
> +udis86-flags := -UHAVE_UDIS86

I'm not sure this is needed, We shouldn't have anything defining
HAVE_UDIS86.

-- Steve


> +endif # NO_UDIS86
>  
>  define BLK_TC_FLUSH_SOURCE
>  #include <linux/blktrace_api.h>
> @@ -237,6 +242,7 @@ endif
>  # Append required CFLAGS
>  override CFLAGS += $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR)
>  override CFLAGS += $(udis86-flags) $(blk-flags)
> +override LDFLAGS += $(udis86-ldflags)
>  
>  CMD_TARGETS = trace-cmd $(BUILD_PYTHON)
>  


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

* Re: [PATCH 2/4] trace-cmd: No automagic dependency on udis86
  2019-07-20  3:17   ` Steven Rostedt
@ 2019-07-23 17:41     ` Patrick McLean
  0 siblings, 0 replies; 7+ messages in thread
From: Patrick McLean @ 2019-07-23 17:41 UTC (permalink / raw)
  To: Steven Rostedt; +Cc: linux-trace-devel

On Fri, 19 Jul 2019 23:17:01 -0400
Steven Rostedt <rostedt@goodmis.org> wrote:
> Hi Patrick,
> 
> Thanks for sending these. Some questions below.
> 
> On Fri, 19 Jul 2019 20:03:42 -0700
> Patrick McLean <chutzpah@gentoo.org> wrote:
> 
> > From: Patrick McLean <patrick.mclean@sony.com>
> > 
> > Currently if udis86 is detected on the system, trace-cmd
> > automatically uses it. This is generally a problem for packagers
> > since if the build machine happens to have udis86, now there is a
> > dependency on it that may or may not be tracked.
> > 
> > This adds a NO_UDIS86 variable that can be set by the packager to
> > disable using udis86 completely.
> > 
> > Signed-off-by: Patrick McLean <patrick.mclean@sony.com>
> > ---
> >  Makefile | 8 +++++++-
> >  1 file changed, 7 insertions(+), 1 deletion(-)
> > 
> > diff --git a/Makefile b/Makefile
> > index 3579f27..6b85e21 100644
> > --- a/Makefile
> > +++ b/Makefile
> > @@ -136,8 +136,13 @@ export NO_PYTHON
> >  test-build = $(if $(shell sh -c 'echo "$(1)" | \
> >  	$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'),
> > $2) 
> > +ifndef NO_UDIS86
> >  # have udis86 disassembler library?
> > -udis86-flags := $(call test-build,\#include
> > <udis86.h>,-DHAVE_UDIS86 -ludis86) +udis86-flags := -DHAVE_UDIS86
> > +udis86-ldflags := -ludis86  
> 
> Can we keep the test here? If NO_UDIS86 is not defined. That is, if
> you compile without this define, this change assumes you have it.
> 
> It's fine to force not having it, but we shouldn't force having it if
> we don't.

That sounds good to me, preserve the current behaviour if nothing is
defined. I will attach an updated patch.

> > +else
> > +udis86-flags := -UHAVE_UDIS86  
> 
> I'm not sure this is needed, We shouldn't have anything defining
> HAVE_UDIS86.

Sure, I will drop it.


From: Patrick McLean <patrick.mclean@sony.com>

Currently if udis86 is detected on the system, trace-cmd automatically
uses it. This is generally a problem for packagers since if the build
machine happens to have udis86, now there is a dependency on it that may
or may not be tracked.

This adds a NO_UDIS86 variable that can be set by the packager to
disable using udis86 completely.

Signed-off-by: Patrick McLean <patrick.mclean@sony.com>
---
 Makefile | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/Makefile b/Makefile
index 3579f27..ee3d8d9 100644
--- a/Makefile
+++ b/Makefile
@@ -136,8 +136,11 @@ export NO_PYTHON
 test-build = $(if $(shell sh -c 'echo "$(1)" | \
 	$(CC) -o /dev/null -c -x c - > /dev/null 2>&1 && echo y'), $2)
 
+ifndef NO_UDIS86
 # have udis86 disassembler library?
 udis86-flags := $(call test-build,\#include <udis86.h>,-DHAVE_UDIS86 -ludis86)
+udis86-ldflags := -ludis86
+endif # NO_UDIS86
 
 define BLK_TC_FLUSH_SOURCE
 #include <linux/blktrace_api.h>
@@ -237,6 +240,7 @@ endif
 # Append required CFLAGS
 override CFLAGS += $(INCLUDES) $(PLUGIN_DIR_SQ) $(VAR_DIR)
 override CFLAGS += $(udis86-flags) $(blk-flags)
+override LDFLAGS += $(udis86-ldflags)
 
 CMD_TARGETS = trace-cmd $(BUILD_PYTHON)
 
-- 
2.22.0


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

end of thread, other threads:[~2019-07-23 17:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-20  3:03 [PATCH 0/4] trace-cmd: Fixes for packaging Patrick McLean
2019-07-20  3:03 ` [PATCH 1/4] trace-cmd: Allow overriding of python installation directory Patrick McLean
2019-07-20  3:03 ` [PATCH 2/4] trace-cmd: No automagic dependency on udis86 Patrick McLean
2019-07-20  3:17   ` Steven Rostedt
2019-07-23 17:41     ` Patrick McLean
2019-07-20  3:03 ` [PATCH 3/4] trace-cmd: Install all headers needed by kernelshark to proper paths Patrick McLean
2019-07-20  3:03 ` [PATCH 4/4] trace-cmd: Set SONAME on shared libraries Patrick McLean

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).