xref: /linux/tools/perf/util/setup.py (revision 6a5c13aff49ac9b3fea38d5f84b436718cb2780d)
1877108e4SArnaldo Carvalho de Melo#!/usr/bin/python2
2877108e4SArnaldo Carvalho de Melo
3877108e4SArnaldo Carvalho de Melofrom distutils.core import setup, Extension
41b7155f7SRobert Richterfrom os import getenv
51b7155f7SRobert Richter
69941c96aSJiri Olsafrom distutils.command.build_ext   import build_ext   as _build_ext
79941c96aSJiri Olsafrom distutils.command.install_lib import install_lib as _install_lib
89941c96aSJiri Olsa
99941c96aSJiri Olsaclass build_ext(_build_ext):
109941c96aSJiri Olsa    def finalize_options(self):
119941c96aSJiri Olsa        _build_ext.finalize_options(self)
129941c96aSJiri Olsa        self.build_lib  = build_lib
139941c96aSJiri Olsa        self.build_temp = build_tmp
149941c96aSJiri Olsa
159941c96aSJiri Olsaclass install_lib(_install_lib):
169941c96aSJiri Olsa    def finalize_options(self):
179941c96aSJiri Olsa        _install_lib.finalize_options(self)
189941c96aSJiri Olsa        self.build_dir = build_lib
199941c96aSJiri Olsa
209941c96aSJiri Olsa
211b7155f7SRobert Richtercflags = ['-fno-strict-aliasing', '-Wno-write-strings']
221b7155f7SRobert Richtercflags += getenv('CFLAGS', '').split()
23877108e4SArnaldo Carvalho de Melo
249941c96aSJiri Olsabuild_lib = getenv('PYTHON_EXTBUILD_LIB')
259941c96aSJiri Olsabuild_tmp = getenv('PYTHON_EXTBUILD_TMP')
269941c96aSJiri Olsa
27*6a5c13afSNamhyung Kimext_sources = [f.strip() for f in file('util/python-ext-sources')
28*6a5c13afSNamhyung Kim				if len(f.strip()) > 0 and f[0] != '#']
29*6a5c13afSNamhyung Kim
30877108e4SArnaldo Carvalho de Meloperf = Extension('perf',
31*6a5c13afSNamhyung Kim		  sources = ext_sources,
32f6bbc1daSArnaldo Carvalho de Melo		  include_dirs = ['util/include'],
331b7155f7SRobert Richter		  extra_compile_args = cflags,
341b7155f7SRobert Richter                 )
35877108e4SArnaldo Carvalho de Melo
36877108e4SArnaldo Carvalho de Melosetup(name='perf',
37877108e4SArnaldo Carvalho de Melo      version='0.1',
38877108e4SArnaldo Carvalho de Melo      description='Interface with the Linux profiling infrastructure',
39877108e4SArnaldo Carvalho de Melo      author='Arnaldo Carvalho de Melo',
40877108e4SArnaldo Carvalho de Melo      author_email='acme@redhat.com',
41877108e4SArnaldo Carvalho de Melo      license='GPLv2',
42877108e4SArnaldo Carvalho de Melo      url='http://perf.wiki.kernel.org',
439941c96aSJiri Olsa      ext_modules=[perf],
449941c96aSJiri Olsa      cmdclass={'build_ext': build_ext, 'install_lib': install_lib})
45