File perf.spec of Package perf.1054

#
# spec file for package perf
#
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


Name:           perf
%define version %(rpm -q --qf '%{VERSION}' kernel-source)
Version:        %{version}
Release:        0
Summary:        Performance Monitoring Tools for Linux
License:        GPL-2.0
Group:          Development/Tools/Debuggers
BuildRequires:  asciidoc
BuildRequires:  audit-devel
BuildRequires:  binutils-devel
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gtk2-devel
BuildRequires:  kernel-source >= 2.6.31
BuildRequires:  libdw-devel
BuildRequires:  libelf-devel
%ifarch s390x s390
%define         _perf_unwind NO_LIBUNWIND=1
%else
%define         _perf_unwind %{nil}
BuildRequires:  libunwind-devel
%endif
BuildRequires:  newt-devel
BuildRequires:  openssl-devel
BuildRequires:  xmlto
BuildRequires:  zlib-devel
%{perl_requires}
%{?libperl_requires}
Patch1:         perf-probe-ppc64le-prefer-symbol-table-lookup-over-dwarf.patch

Requires:       kernel >= 2.6.31
BuildRoot:      %{_tmppath}/%{name}-%{version}-build

%description
This package provides a userspace tool 'perf', which monitors performance for
either unmodified binaries or the entire system. It requires a Linux kernel
which includes the Performance Counters for Linux (PCL) subsystem (>= 2.6.31).
This subsystem utilizes the Performance Monitoring Unit (PMU) / hardware
counters of the underlying cpu architecture (if supported).

%prep
# copy necessary files from kernel-source since we need to modify them
(cd /usr/src/linux ; tar -cf - COPYING CREDITS README tools include scripts Kbuild Makefile arch/*/{include,lib,Makefile} lib) | tar -xf - 
chmod +x tools/perf/util/generate-cmdlist.sh

%patch1 -p1

%build
cd tools/perf
# PASS rpm optflags as EXTRA_FLAGS,  passing as CFLAGS overrides and breaks build
make EXTRA_CFLAGS="%{optflags}" ASCIIDOC8=1 all doc prefix=/usr perfexecdir=%{_libexecdir}/%{name} %{_perf_unwind}

%install
cd tools/perf
make EXTRA_CFLAGS="%{optflags}" install install-doc prefix=/usr perfexecdir=%{_libexecdir}/%{name} DESTDIR=%{buildroot} %{_perf_unwind}

%clean
rm -rf %{buildroot}

%files
%defattr(-, root, root)
%doc COPYING CREDITS README tools/perf/design.txt
%{_bindir}/perf
%{_sysconfdir}/bash_completion.d/perf
%{_libexecdir}/%{name}
%{_mandir}/man1/perf*

%changelog
openSUSE Build Service is sponsored by