linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] perf/jvmti: add check for java alternatives cmd in Makefile
@ 2016-02-16  6:37 Stephane Eranian
  2016-02-16 14:31 ` Arnaldo Carvalho de Melo
  2016-02-17 12:06 ` [tip:perf/core] perf jvmti: Add " tip-bot for Stephane Eranian
  0 siblings, 2 replies; 5+ messages in thread
From: Stephane Eranian @ 2016-02-16  6:37 UTC (permalink / raw)
  To: linux-kernel
  Cc: acme, peterz, mingo, ak, kan.liang, jolsa, namhyung,
	adrian.hunter, dsahern

This patch modifies the jvmti makefile to check
if /usr/sbin/java-update-alternatives is present.
If so, then use it, if not then use the altenatives
command. This helps handle the difference between
Ubuntu and Fedora Linux distributions.

Signed-off-by: Stephane Eranian <eranian@google.com>
---
 tools/perf/jvmti/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/jvmti/Makefile b/tools/perf/jvmti/Makefile
index 5968f83..0277a64 100644
--- a/tools/perf/jvmti/Makefile
+++ b/tools/perf/jvmti/Makefile
@@ -35,8 +35,12 @@ SOLIBEXT=so
 
 # The following works at least on fedora 23, you may need the next
 # line for other distros.
+ifeq (,$(wildcard /usr/sbin/update-java-alternatives))
 JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
-#JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | cut -d ' ' -f 3)
+else
+JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | cut -d ' ' -f 3)
+endif
+
 # -lrt required in 32-bit mode for clock_gettime()
 LIBS=-lelf -lrt
 INCDIR=-I $(JDIR)/include -I $(JDIR)/include/linux
-- 
2.5.0

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

* Re: [PATCH] perf/jvmti: add check for java alternatives cmd in Makefile
  2016-02-16  6:37 [PATCH] perf/jvmti: add check for java alternatives cmd in Makefile Stephane Eranian
@ 2016-02-16 14:31 ` Arnaldo Carvalho de Melo
  2016-02-16 14:36   ` Namhyung Kim
  2016-02-17 12:06 ` [tip:perf/core] perf jvmti: Add " tip-bot for Stephane Eranian
  1 sibling, 1 reply; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-02-16 14:31 UTC (permalink / raw)
  To: Stephane Eranian
  Cc: linux-kernel, peterz, mingo, ak, kan.liang, jolsa, namhyung,
	adrian.hunter, dsahern

Em Tue, Feb 16, 2016 at 07:37:41AM +0100, Stephane Eranian escreveu:
> This patch modifies the jvmti makefile to check
> if /usr/sbin/java-update-alternatives is present.
> If so, then use it, if not then use the altenatives
> command. This helps handle the difference between
> Ubuntu and Fedora Linux distributions.

Thanks, tested and applied.

We need tho to better integrate it with the 'make install' target, so
that it gets built and installed, this way it will end up packaged by
distros.

That, together with documentation should be enough as a first step to
ease usage in a more widespread way.

What do you think?

- Arnaldo

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

* Re: [PATCH] perf/jvmti: add check for java alternatives cmd in Makefile
  2016-02-16 14:31 ` Arnaldo Carvalho de Melo
@ 2016-02-16 14:36   ` Namhyung Kim
  2016-02-16 15:55     ` Arnaldo Carvalho de Melo
  0 siblings, 1 reply; 5+ messages in thread
From: Namhyung Kim @ 2016-02-16 14:36 UTC (permalink / raw)
  To: Arnaldo Carvalho de Melo
  Cc: Stephane Eranian, linux-kernel, peterz, mingo, ak, kan.liang,
	jolsa, adrian.hunter, dsahern

Hi Arnaldo and Stephane,

On Tue, Feb 16, 2016 at 12:31:26PM -0200, Arnaldo Carvalho de Melo wrote:
> Em Tue, Feb 16, 2016 at 07:37:41AM +0100, Stephane Eranian escreveu:
> > This patch modifies the jvmti makefile to check
> > if /usr/sbin/java-update-alternatives is present.
> > If so, then use it, if not then use the altenatives
> > command. This helps handle the difference between
> > Ubuntu and Fedora Linux distributions.
> 
> Thanks, tested and applied.
> 
> We need tho to better integrate it with the 'make install' target, so
> that it gets built and installed, this way it will end up packaged by
> distros.
> 
> That, together with documentation should be enough as a first step to
> ease usage in a more widespread way.

It'd be better providing a reasonable default (if possible) or guide
to how to setup the JDIR for other distro as well.

Thanks,
Namhyung

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

* Re: [PATCH] perf/jvmti: add check for java alternatives cmd in Makefile
  2016-02-16 14:36   ` Namhyung Kim
@ 2016-02-16 15:55     ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 5+ messages in thread
From: Arnaldo Carvalho de Melo @ 2016-02-16 15:55 UTC (permalink / raw)
  To: Namhyung Kim
  Cc: Stephane Eranian, linux-kernel, peterz, mingo, ak, kan.liang,
	jolsa, adrian.hunter, dsahern

Em Tue, Feb 16, 2016 at 11:36:48PM +0900, Namhyung Kim escreveu:
> Hi Arnaldo and Stephane,
> 
> On Tue, Feb 16, 2016 at 12:31:26PM -0200, Arnaldo Carvalho de Melo wrote:
> > Em Tue, Feb 16, 2016 at 07:37:41AM +0100, Stephane Eranian escreveu:
> > > This patch modifies the jvmti makefile to check
> > > if /usr/sbin/java-update-alternatives is present.
> > > If so, then use it, if not then use the altenatives
> > > command. This helps handle the difference between
> > > Ubuntu and Fedora Linux distributions.
> > 
> > Thanks, tested and applied.
> > 
> > We need tho to better integrate it with the 'make install' target, so
> > that it gets built and installed, this way it will end up packaged by
> > distros.
> > 
> > That, together with documentation should be enough as a first step to
> > ease usage in a more widespread way.
> 
> It'd be better providing a reasonable default (if possible) or guide
> to how to setup the JDIR for other distro as well.

Right, that would be even better. I.e. if it fails finding both, exit
with an error, stating that the user needs to figure out where is the
JDK files.

- Arnaldo

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

* [tip:perf/core] perf jvmti: Add check for java alternatives cmd in Makefile
  2016-02-16  6:37 [PATCH] perf/jvmti: add check for java alternatives cmd in Makefile Stephane Eranian
  2016-02-16 14:31 ` Arnaldo Carvalho de Melo
@ 2016-02-17 12:06 ` tip-bot for Stephane Eranian
  1 sibling, 0 replies; 5+ messages in thread
From: tip-bot for Stephane Eranian @ 2016-02-17 12:06 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: hpa, peterz, ak, dsahern, linux-kernel, namhyung, eranian, acme,
	mingo, jolsa, adrian.hunter, kan.liang, tglx

Commit-ID:  d646ae0a73deb0d80792a6a9c0757317ad8049c5
Gitweb:     http://git.kernel.org/tip/d646ae0a73deb0d80792a6a9c0757317ad8049c5
Author:     Stephane Eranian <eranian@google.com>
AuthorDate: Tue, 16 Feb 2016 07:37:41 +0100
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Tue, 16 Feb 2016 17:12:46 -0300

perf jvmti: Add check for java alternatives cmd in Makefile

This patch modifies the jvmti makefile to check if the
/usr/sbin/java-update-alternatives utility is present.  If so, then use
it, if not then use the altenatives command.

This helps handle the difference between Ubuntu and Fedora Linux
distributions.

Signed-off-by: Stephane Eranian <eranian@google.com>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Kan Liang <kan.liang@intel.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1455604661-9357-1-git-send-email-eranian@google.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
 tools/perf/jvmti/Makefile | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tools/perf/jvmti/Makefile b/tools/perf/jvmti/Makefile
index 5968f83..0277a64 100644
--- a/tools/perf/jvmti/Makefile
+++ b/tools/perf/jvmti/Makefile
@@ -35,8 +35,12 @@ SOLIBEXT=so
 
 # The following works at least on fedora 23, you may need the next
 # line for other distros.
+ifeq (,$(wildcard /usr/sbin/update-java-alternatives))
 JDIR=$(shell alternatives --display java | tail -1 | cut -d' ' -f 5 | sed 's%/jre/bin/java.%%g')
-#JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | cut -d ' ' -f 3)
+else
+JDIR=$(shell /usr/sbin/update-java-alternatives -l | head -1 | cut -d ' ' -f 3)
+endif
+
 # -lrt required in 32-bit mode for clock_gettime()
 LIBS=-lelf -lrt
 INCDIR=-I $(JDIR)/include -I $(JDIR)/include/linux

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

end of thread, other threads:[~2016-02-17 12:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-16  6:37 [PATCH] perf/jvmti: add check for java alternatives cmd in Makefile Stephane Eranian
2016-02-16 14:31 ` Arnaldo Carvalho de Melo
2016-02-16 14:36   ` Namhyung Kim
2016-02-16 15:55     ` Arnaldo Carvalho de Melo
2016-02-17 12:06 ` [tip:perf/core] perf jvmti: Add " tip-bot for Stephane Eranian

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