diff options
author | Jiri Olsa <jolsa@redhat.com> | 2011-07-22 07:33:07 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2011-08-08 11:54:26 -0400 |
commit | 9941c96ad869d10f7e34e03990ce450ab8fcb83d (patch) | |
tree | df08be9a56eccc1c7cf184d19e66b2a24192c318 | |
parent | aba8d056078e47350d85b06a9cabd5afcc4b72ea (diff) |
perf tools: Add support to install perf python extension
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>
-rw-r--r-- | tools/perf/Makefile | 19 | ||||
-rw-r--r-- | tools/perf/util/setup.py | 21 |
2 files changed, 33 insertions, 7 deletions
diff --git a/tools/perf/Makefile b/tools/perf/Makefile index 5bf48fcc6768..822f967433a6 100644 --- a/tools/perf/Makefile +++ b/tools/perf/Makefile | |||
@@ -178,9 +178,9 @@ strip-libs = $(filter-out -l%,$(1)) | |||
178 | 178 | ||
179 | $(OUTPUT)python/perf.so: $(PYRF_OBJS) | 179 | $(OUTPUT)python/perf.so: $(PYRF_OBJS) |
180 | $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ | 180 | $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ |
181 | --quiet build_ext \ | 181 | --quiet build_ext; \ |
182 | --build-lib='$(OUTPUT)python' \ | 182 | mkdir -p $(OUTPUT)python && \ |
183 | --build-temp='$(OUTPUT)python/temp' | 183 | cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/ |
184 | # | 184 | # |
185 | # No Perl scripts right now: | 185 | # No Perl scripts right now: |
186 | # | 186 | # |
@@ -506,9 +506,13 @@ else | |||
506 | 506 | ||
507 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) | 507 | PYTHON_WORD := $(call shell-wordify,$(PYTHON)) |
508 | 508 | ||
509 | python-clean := $(PYTHON_WORD) util/setup.py clean \ | 509 | # python extension build directories |
510 | --build-lib='$(OUTPUT)python' \ | 510 | PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/ |
511 | --build-temp='$(OUTPUT)python/temp' | 511 | PYTHON_EXTBUILD_LIB := $(PYTHON_EXTBUILD)lib/ |
512 | PYTHON_EXTBUILD_TMP := $(PYTHON_EXTBUILD)tmp/ | ||
513 | export PYTHON_EXTBUILD_LIB PYTHON_EXTBUILD_TMP | ||
514 | |||
515 | python-clean := rm -rf $(PYTHON_EXTBUILD) $(OUTPUT)python/perf.so | ||
512 | 516 | ||
513 | ifdef NO_LIBPYTHON | 517 | ifdef NO_LIBPYTHON |
514 | $(call disable-python) | 518 | $(call disable-python) |
@@ -865,6 +869,9 @@ install: all | |||
865 | $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' | 869 | $(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' |
866 | $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' | 870 | $(INSTALL) scripts/python/bin/* -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python/bin' |
867 | 871 | ||
872 | install-python_ext: | ||
873 | $(PYTHON_WORD) util/setup.py --quiet install --root='/$(DESTDIR_SQ)' | ||
874 | |||
868 | install-doc: | 875 | install-doc: |
869 | $(MAKE) -C Documentation install | 876 | $(MAKE) -C Documentation install |
870 | 877 | ||
diff --git a/tools/perf/util/setup.py b/tools/perf/util/setup.py index bbc982f5dd8b..95d370074928 100644 --- a/tools/perf/util/setup.py +++ b/tools/perf/util/setup.py | |||
@@ -3,9 +3,27 @@ | |||
3 | from distutils.core import setup, Extension | 3 | from distutils.core import setup, Extension |
4 | from os import getenv | 4 | from os import getenv |
5 | 5 | ||
6 | from distutils.command.build_ext import build_ext as _build_ext | ||
7 | from distutils.command.install_lib import install_lib as _install_lib | ||
8 | |||
9 | class build_ext(_build_ext): | ||
10 | def finalize_options(self): | ||
11 | _build_ext.finalize_options(self) | ||
12 | self.build_lib = build_lib | ||
13 | self.build_temp = build_tmp | ||
14 | |||
15 | class install_lib(_install_lib): | ||
16 | def finalize_options(self): | ||
17 | _install_lib.finalize_options(self) | ||
18 | self.build_dir = build_lib | ||
19 | |||
20 | |||
6 | cflags = ['-fno-strict-aliasing', '-Wno-write-strings'] | 21 | cflags = ['-fno-strict-aliasing', '-Wno-write-strings'] |
7 | cflags += getenv('CFLAGS', '').split() | 22 | cflags += getenv('CFLAGS', '').split() |
8 | 23 | ||
24 | build_lib = getenv('PYTHON_EXTBUILD_LIB') | ||
25 | build_tmp = getenv('PYTHON_EXTBUILD_TMP') | ||
26 | |||
9 | perf = Extension('perf', | 27 | perf = Extension('perf', |
10 | sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c', | 28 | sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c', |
11 | 'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c', | 29 | 'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c', |
@@ -21,4 +39,5 @@ setup(name='perf', | |||
21 | author_email='acme@redhat.com', | 39 | author_email='acme@redhat.com', |
22 | license='GPLv2', | 40 | license='GPLv2', |
23 | url='http://perf.wiki.kernel.org', | 41 | url='http://perf.wiki.kernel.org', |
24 | ext_modules=[perf]) | 42 | ext_modules=[perf], |
43 | cmdclass={'build_ext': build_ext, 'install_lib': install_lib}) | ||