Commit 9941c96a authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

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.comSigned-off-by: default avatarJiri Olsa <jolsa@redhat.com>
Signed-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent aba8d056
...@@ -178,9 +178,9 @@ strip-libs = $(filter-out -l%,$(1)) ...@@ -178,9 +178,9 @@ strip-libs = $(filter-out -l%,$(1))
$(OUTPUT)python/perf.so: $(PYRF_OBJS) $(OUTPUT)python/perf.so: $(PYRF_OBJS)
$(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \ $(QUIET_GEN)CFLAGS='$(BASIC_CFLAGS)' $(PYTHON_WORD) util/setup.py \
--quiet build_ext \ --quiet build_ext; \
--build-lib='$(OUTPUT)python' \ mkdir -p $(OUTPUT)python && \
--build-temp='$(OUTPUT)python/temp' cp $(PYTHON_EXTBUILD_LIB)perf.so $(OUTPUT)python/
# #
# No Perl scripts right now: # No Perl scripts right now:
# #
...@@ -506,9 +506,13 @@ else ...@@ -506,9 +506,13 @@ else
PYTHON_WORD := $(call shell-wordify,$(PYTHON)) PYTHON_WORD := $(call shell-wordify,$(PYTHON))
python-clean := $(PYTHON_WORD) util/setup.py clean \ # python extension build directories
--build-lib='$(OUTPUT)python' \ PYTHON_EXTBUILD := $(OUTPUT)python_ext_build/
--build-temp='$(OUTPUT)python/temp' 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 ifdef NO_LIBPYTHON
$(call disable-python) $(call disable-python)
...@@ -865,6 +869,9 @@ install: all ...@@ -865,6 +869,9 @@ install: all
$(INSTALL) scripts/python/*.py -t '$(DESTDIR_SQ)$(perfexec_instdir_SQ)/scripts/python' $(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) 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: install-doc:
$(MAKE) -C Documentation install $(MAKE) -C Documentation install
......
...@@ -3,9 +3,27 @@ ...@@ -3,9 +3,27 @@
from distutils.core import setup, Extension from distutils.core import setup, Extension
from os import getenv 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 = ['-fno-strict-aliasing', '-Wno-write-strings']
cflags += getenv('CFLAGS', '').split() cflags += getenv('CFLAGS', '').split()
build_lib = getenv('PYTHON_EXTBUILD_LIB')
build_tmp = getenv('PYTHON_EXTBUILD_TMP')
perf = Extension('perf', perf = Extension('perf',
sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c', sources = ['util/python.c', 'util/ctype.c', 'util/evlist.c',
'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c', 'util/evsel.c', 'util/cpumap.c', 'util/thread_map.c',
...@@ -21,4 +39,5 @@ setup(name='perf', ...@@ -21,4 +39,5 @@ setup(name='perf',
author_email='acme@redhat.com', author_email='acme@redhat.com',
license='GPLv2', license='GPLv2',
url='http://perf.wiki.kernel.org', url='http://perf.wiki.kernel.org',
ext_modules=[perf]) ext_modules=[perf],
cmdclass={'build_ext': build_ext, 'install_lib': install_lib})
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment