* [PATCH 1/6] Revert "perf: hard-code NO_LIBPERL/NO_LIBPYTHON"
2012-07-11 5:29 [PATCH 0/6][3.0 KERNEL] linux-yocto-3.0 perf-scripting updates tom.zanussi
@ 2012-07-11 5:28 ` tom.zanussi
2012-07-11 5:28 ` [PATCH 2/6] perf tools: Add support to install perf python extension tom.zanussi
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tom.zanussi @ 2012-07-11 5:28 UTC (permalink / raw)
To: yocto, bruce.ashfield, richard.purdie, saul.wold
From: Tom Zanussi <tom.zanussi@intel.com>
This reverts commit 3216e7d5c3cada16161481826cdb39c930457587.
LIBPERL and LIBPYTHON can now be enabled using the 'perf-scripting'
feature.
---
tools/perf/Makefile | 82 +++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 80 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index e3eb19e..c168366 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -471,8 +471,31 @@ else
endif
endif
-BASIC_CFLAGS += -DNO_LIBPERL
-BASIC_CFLAGS += -DNO_LIBPYTHON
+ifdef NO_LIBPERL
+ BASIC_CFLAGS += -DNO_LIBPERL
+else
+ PERL_EMBED_LDOPTS = $(shell perl -MExtUtils::Embed -e ldopts 2>/dev/null)
+ PERL_EMBED_LDFLAGS = $(call strip-libs,$(PERL_EMBED_LDOPTS))
+ PERL_EMBED_LIBADD = $(call grep-libs,$(PERL_EMBED_LDOPTS))
+ PERL_EMBED_CCOPTS = `perl -MExtUtils::Embed -e ccopts 2>/dev/null`
+ FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
+
+ ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y)
+ BASIC_CFLAGS += -DNO_LIBPERL
+ else
+ ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
+ EXTLIBS += $(PERL_EMBED_LIBADD)
+ LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-perl.o
+ LIB_OBJS += $(OUTPUT)scripts/perl/Perf-Trace-Util/Context.o
+ endif
+endif
+
+disable-python = $(eval $(disable-python_code))
+define disable-python_code
+ BASIC_CFLAGS += -DNO_LIBPYTHON
+ $(if $(1),$(warning No $(1) was found))
+ $(warning Python support won't be built)
+endef
override PYTHON := \
$(call get-executable-or-default,PYTHON,python)
@@ -480,6 +503,61 @@ override PYTHON := \
ifndef PYTHON
$(call disable-python,python interpreter)
python-clean :=
+else
+
+ PYTHON_WORD := $(call shell-wordify,$(PYTHON))
+
+ python-clean := $(PYTHON_WORD) util/setup.py clean \
+ --build-lib='$(OUTPUT)python' \
+ --build-temp='$(OUTPUT)python/temp'
+
+ ifdef NO_LIBPYTHON
+ $(call disable-python)
+ else
+
+ override PYTHON_CONFIG := \
+ $(call get-executable-or-default,PYTHON_CONFIG,$(PYTHON)-config)
+
+ ifndef PYTHON_CONFIG
+ $(call disable-python,python-config tool)
+ else
+
+ PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
+
+ PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
+ PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
+ PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
+ PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+ FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
+
+ ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y)
+ $(call disable-python,Python.h (for Python 2.x))
+ else
+
+ ifneq ($(call try-cc,$(SOURCE_PYTHON_VERSION),$(FLAGS_PYTHON_EMBED)),y)
+ $(warning Python 3 is not yet supported; please set)
+ $(warning PYTHON and/or PYTHON_CONFIG appropriately.)
+ $(warning If you also have Python 2 installed, then)
+ $(warning try something like:)
+ $(warning $(and ,))
+ $(warning $(and ,) make PYTHON=python2)
+ $(warning $(and ,))
+ $(warning Otherwise, disable Python support entirely:)
+ $(warning $(and ,))
+ $(warning $(and ,) make NO_LIBPYTHON=1)
+ $(warning $(and ,))
+ $(error $(and ,))
+ else
+ ALL_LDFLAGS += $(PYTHON_EMBED_LDFLAGS)
+ EXTLIBS += $(PYTHON_EMBED_LIBADD)
+ LIB_OBJS += $(OUTPUT)util/scripting-engines/trace-event-python.o
+ LIB_OBJS += $(OUTPUT)scripts/python/Perf-Trace-Util/Context.o
+ LANG_BINDINGS += $(OUTPUT)python/perf.so
+ endif
+
+ endif
+ endif
+ endif
endif
ifdef NO_DEMANGLE
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 2/6] perf tools: Add support to install perf python extension
2012-07-11 5:29 [PATCH 0/6][3.0 KERNEL] linux-yocto-3.0 perf-scripting updates tom.zanussi
2012-07-11 5:28 ` [PATCH 1/6] Revert "perf: hard-code NO_LIBPERL/NO_LIBPYTHON" tom.zanussi
@ 2012-07-11 5:28 ` tom.zanussi
2012-07-11 5:29 ` [PATCH 3/6] perf: use pkg-config instead of python-config tom.zanussi
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tom.zanussi @ 2012-07-11 5:28 UTC (permalink / raw)
To: yocto, bruce.ashfield, richard.purdie, saul.wold
From: Jiri Olsa <jolsa@redhat.com>
Adding install-python_ext target to install python extension related
files. Installation directory is governed by python distutils package
and follows the DESTDIR variable settings.
Also moving python extension build output into '$(O)python_ext_build'
directory and making it configurable via PYTHON_EXTBUILD variable.
Keeping the '$(O)python/perf.so' file, so it could be used for testing
as of until now.
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <a.p.zijlstra@chello.nl>
Link: http://lkml.kernel.org/r/20110722113307.GA1931@jolsa.brq.redhat.com
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/Makefile | 19 +++++++++++++------
tools/perf/util/setup.py | 21 ++++++++++++++++++++-
2 files changed, 33 insertions(+), 7 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index c168366..db7ec20 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -181,9 +181,9 @@ strip-libs = $(filter-out -l%,$(1))
$(OUTPUT)python/perf.so: $(PYRF_OBJS)
$(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
- --quiet build_ext \
- --build-lib='$(OUTPUT)python' \
- --build-temp='$(OUTPUT)python/temp'
+ --quiet build_ext; \
+ mkdir -p $(OUTPUT)python && \
+ cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
#
# No Perl scripts right now:
#
@@ -507,9 +507,13 @@ else
PYTHON_WORD := $(call shell-wordify,$(PYTHON))
- python-clean := $(PYTHON_WORD) util/setup.py clean \
- --build-lib='$(OUTPUT)python' \
- --build-temp='$(OUTPUT)python/temp'
+ # python extension build directories
+ PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
+ PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/
+ PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/
+ export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP
+
+ python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so
ifdef NO_LIBPYTHON
$(call disable-python)
@@ -866,6 +870,9 @@ install: all
$(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python'
$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
+install-python_ext:
+ $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
+
install-doc:
$(MAKE) -C Documentation install
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py
index bbc982f..95d3700 100644
--- a/tools/perf/util/setup.py
+++ b/tools/perf/util/setup.py
@@ -3,9 +3,27 @@
from distutils.core import setup, Extension
from os import getenv
+from distutils.command.build_ext import build_ext as _build_ext
+from distutils.command.install_lib import install_lib as _install_lib
+
+class build_ext(_build_ext):
+ def finalize_options(self):
+ _build_ext.finalize_options(self)
+ self.build_lib = build_lib
+ self.build_temp = build_tmp
+
+class install_lib(_install_lib):
+ def finalize_options(self):
+ _install_lib.finalize_options(self)
+ self.build_dir = build_lib
+
+
cflags = ['-fno-strict-aliasing', '-Wno-write-strings']
cflags += getenv('CFLAGS', '').split()
+build_lib = getenv('PYTHON_EXTBUILD_LIB')
+build_tmp = getenv('PYTHON_EXTBUILD_TMP')
+
perf = Extension('perf',
sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c',
'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c',
@@ -21,4 +39,5 @@ setup(name='perf',
author_email='acme@redhat.com',
license='GPLv2',
url='http://perf.wiki.kernel.org',
- ext_modules=[perf])
+ ext_modules=[perf],
+ cmdclass={'build_ext': build_ext, 'install_lib': install_lib})
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 3/6] perf: use pkg-config instead of python-config
2012-07-11 5:29 [PATCH 0/6][3.0 KERNEL] linux-yocto-3.0 perf-scripting updates tom.zanussi
2012-07-11 5:28 ` [PATCH 1/6] Revert "perf: hard-code NO_LIBPERL/NO_LIBPYTHON" tom.zanussi
2012-07-11 5:28 ` [PATCH 2/6] perf tools: Add support to install perf python extension tom.zanussi
@ 2012-07-11 5:29 ` tom.zanussi
2012-07-11 5:29 ` [PATCH 4/6] perf: add 'libperl not found' warning tom.zanussi
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: tom.zanussi @ 2012-07-11 5:29 UTC (permalink / raw)
To: yocto, bruce.ashfield, richard.purdie, saul.wold
From: Tom Zanussi <tom.zanussi@intel.com>
Python has build flags available via pkg-config, use those at
build-time instead.
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
---
tools/perf/Makefile | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index db7ec20..3eda00d 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -528,10 +528,10 @@ else
PYTHON_CONFIG_SQ := $(call shell-sq,$(PYTHON_CONFIG))
- PYTHON_EMBED_LDOPTS := $(shell $(PYTHON_CONFIG_SQ) --ldflags 2>/dev/null)
+ PYTHON_EMBED_LDOPTS := $(shell pkg-config --libs python 2>/dev/null)
PYTHON_EMBED_LDFLAGS := $(call strip-libs,$(PYTHON_EMBED_LDOPTS))
PYTHON_EMBED_LIBADD := $(call grep-libs,$(PYTHON_EMBED_LDOPTS))
- PYTHON_EMBED_CCOPTS := $(shell $(PYTHON_CONFIG_SQ) --cflags 2>/dev/null)
+ PYTHON_EMBED_CCOPTS := $(shell pkg-config --cflags python 2>/dev/null)
FLAGS_PYTHON_EMBED := $(PYTHON_EMBED_CCOPTS) $(PYTHON_EMBED_LDOPTS)
ifneq ($(call try-cc,$(SOURCE_PYTHON_EMBED),$(FLAGS_PYTHON_EMBED)),y)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 4/6] perf: add 'libperl not found' warning
2012-07-11 5:29 [PATCH 0/6][3.0 KERNEL] linux-yocto-3.0 perf-scripting updates tom.zanussi
` (2 preceding siblings ...)
2012-07-11 5:29 ` [PATCH 3/6] perf: use pkg-config instead of python-config tom.zanussi
@ 2012-07-11 5:29 ` tom.zanussi
2012-07-11 5:29 ` [PATCH 5/6] perf: change --root to --prefix for python install tom.zanussi
2012-07-11 5:29 ` [PATCH 6/6] perf: add sgidefs.h to for mips builds tom.zanussi
5 siblings, 0 replies; 7+ messages in thread
From: tom.zanussi @ 2012-07-11 5:29 UTC (permalink / raw)
To: yocto, bruce.ashfield, richard.purdie, saul.wold
From: Tom Zanussi <tom.zanussi@intel.com>
If libperl isn't found, display a message to that effect along with
some hints on how to fix it.
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
---
tools/perf/Makefile | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 3eda00d..6900cda 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -481,6 +481,7 @@ else
FLAGS_PERL_EMBED=$(PERL_EMBED_CCOPTS) $(PERL_EMBED_LDOPTS)
ifneq ($(call try-cc,$(SOURCE_PERL_EMBED),$(FLAGS_PERL_EMBED)),y)
+ msg := $(warning libperl not found, disables Perl scripting support. Please install libperl-dev or perl-devel);
BASIC_CFLAGS += -DNO_LIBPERL
else
ALL_LDFLAGS += $(PERL_EMBED_LDFLAGS)
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 5/6] perf: change --root to --prefix for python install
2012-07-11 5:29 [PATCH 0/6][3.0 KERNEL] linux-yocto-3.0 perf-scripting updates tom.zanussi
` (3 preceding siblings ...)
2012-07-11 5:29 ` [PATCH 4/6] perf: add 'libperl not found' warning tom.zanussi
@ 2012-07-11 5:29 ` tom.zanussi
2012-07-11 5:29 ` [PATCH 6/6] perf: add sgidefs.h to for mips builds tom.zanussi
5 siblings, 0 replies; 7+ messages in thread
From: tom.zanussi @ 2012-07-11 5:29 UTC (permalink / raw)
To: yocto, bruce.ashfield, richard.purdie, saul.wold
From: Tom Zanussi <tom.zanussi@intel.com>
Otherwise we get the sysroot path appended to the build path, not what
we want.
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
---
tools/perf/Makefile | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/tools/perf/Makefile b/tools/perf/Makefile
index 6900cda..aa8bcd3 100644
--- a/tools/perf/Makefile
+++ b/tools/perf/Makefile
@@ -872,7 +872,7 @@ install: all
$(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin'
install-python_ext:
- $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)'
+ $(PYTHON_WORD) util/setup.py --quiet install --prefix='$(DESTDIR_SQ)/usr'
install-doc:
$(MAKE) -C Documentation install
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread* [PATCH 6/6] perf: add sgidefs.h to for mips builds
2012-07-11 5:29 [PATCH 0/6][3.0 KERNEL] linux-yocto-3.0 perf-scripting updates tom.zanussi
` (4 preceding siblings ...)
2012-07-11 5:29 ` [PATCH 5/6] perf: change --root to --prefix for python install tom.zanussi
@ 2012-07-11 5:29 ` tom.zanussi
5 siblings, 0 replies; 7+ messages in thread
From: tom.zanussi @ 2012-07-11 5:29 UTC (permalink / raw)
To: yocto, bruce.ashfield, richard.purdie, saul.wold
From: Tom Zanussi <tom.zanussi@intel.com>
Allow Python.h to find the definitions it needs on mips i.e. get rid
of the error: "_ABIN32" is not defined.
Signed-off-by: Tom Zanussi <tom.zanussi@intel.com>
---
.../perf/scripts/python/Perf-Trace-Util/Context.c | 4 ++++
.../util/scripting-engines/trace-event-python.c | 4 ++++
2 files changed, 8 insertions(+), 0 deletions(-)
diff --git a/tools/perf/scripts/python/Perf-Trace-Util/Context.c b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
index 315067b..57d3aa3 100644
--- a/tools/perf/scripts/python/Perf-Trace-Util/Context.c
+++ b/tools/perf/scripts/python/Perf-Trace-Util/Context.c
@@ -19,6 +19,10 @@
*
*/
+#ifdef __mips__
+#include <sgidefs.h>
+#endif
+
#include <Python.h>
#include "../../../perf.h"
#include "../../../util/trace-event.h"
diff --git a/tools/perf/util/scripting-engines/trace-event-python.c b/tools/perf/util/scripting-engines/trace-event-python.c
index 6ccf70e..460c474 100644
--- a/tools/perf/util/scripting-engines/trace-event-python.c
+++ b/tools/perf/util/scripting-engines/trace-event-python.c
@@ -19,6 +19,10 @@
*
*/
+#ifdef __mips__
+#include <sgidefs.h>
+#endif
+
#include <Python.h>
#include <stdio.h>
--
1.7.0.4
^ permalink raw reply related [flat|nested] 7+ messages in thread