Blob Blame History Raw
# TODO: reenable once we get a basic build working
# https://fedoraproject.org/wiki/Changes/SetBuildFlagsBuildCheck
# see build and install -- CXXFLAGS and LDFLAGS are enough
# still need to debug
#undefine _auto_set_build_flags

%bcond_without manpages

%if 0%{?facebook}
%bcond_with perl
%else
%bcond_without perl
%endif

Name:           perf
Version:        6.9.0
Release:        %autorelease
Summary:        Performance monitoring for the Linux kernel

License:        GPL-2.0-only
URL:            https://perf.wiki.kernel.org/
Source:         https://mirrors.edge.kernel.org/pub/linux/kernel/tools/perf/v%{version}/perf-%{version}.tar.xz 

BuildRequires:  make
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  clang
BuildRequires:  gcc
BuildRequires:  llvm-devel
BuildRequires:  binutils-devel
BuildRequires:  capstone-devel
BuildRequires:  elfutils-devel
BuildRequires:  elfutils-libelf-devel
BuildRequires:  java-devel
BuildRequires:  libbabeltrace-devel
BuildRequires:  libcap-devel
BuildRequires:  libtraceevent-devel
BuildRequires:  libunwind-devel
BuildRequires:  libbabeltrace-devel
BuildRequires:  libpfm-devel
BuildRequires:  libstdc++-devel
BuildRequires:  libunwind-devel
BuildRequires:  numactl-devel
BuildRequires:  python-devel
BuildRequires:  python3dist(setuptools)
BuildRequires:  openssl-devel
%if %{with perl}
BuildRequires:  perl-devel
BuildRequires:  perl-interpreter
BuildRequires:  perl-ExtUtils-Embed
%endif
BuildRequires:  systemtap-sdt-devel
BuildRequires:  slang-devel
BuildRequires:  zlib-devel
%if %{with manpages}
BuildRequires:  asciidoc
BuildRequires:  xmlto
%endif

%description
This package contains the perf tool, which enables performance monitoring
of the Linux kernel.


%package -n libperf
Summary:        The perf library from kernel source

%description -n libperf
This package contains the kernel source perf library.


%package -n libperf-devel
Summary:        Development files for the perf library from kernel source
Requires:       libperf%{?_isa} = %{version}-%{release}

%description -n libperf-devel
This package includes libraries and header files needed for development
of applications which use perf library from kernel source.


%package -n python3-perf
Summary:        Python bindings for apps which will manipulate perf events

%description -n python3-perf
The python3-perf package contains a module that permits applications
written in the Python programming language to use the interface
to manipulate perf events.


%prep
%autosetup


%build
unset CXXFLAGS
unset LDFLAGS

# /usr/bin/ld: perf-in.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
#global optflags %{optflags} -fPIE

%make_build -C tools/perf

%make_build -C tools/lib/perf

%install
unset CXXFLAGS
unset LDFLAGS

%make_install -C tools/perf \
  prefix=%{_prefix}

%make_install -C tools/lib/perf \
  prefix=%{_prefix}

# python-perf extension
%make_install -C tools/perf \
  prefix=%{_prefix} \
  install-python_ext

# remove the 'trace' symlink.
rm %{buildroot}%{_bindir}/trace

rm -f %{buildroot}%{_libdir}/libperf.a

%if %{without perl}
rm %{buildroot}%{_libexecdir}/perf-core/tests/shell/common/*.pl
%endif

# TODO - make this customizable upstream
mkdir -p %{buildroot}%{bash_completions_dir}
mv %{buildroot}%{_sysconfdir}/bash_completion.d/perf %{buildroot}%{bash_completions_dir}/
rmdir %{buildroot}%{_sysconfdir}/bash_completion.d
rmdir %{buildroot}%{_sysconfdir}/


%files
# license add-license-file-here
%doc tools/perf/CREDITS
%{_bindir}/perf
%{_datadir}/perf-core
# tips.txt is both human readable and used by perf
# and really hard to override
%{_docdir}/perf-tip
%dir %{_includedir}/perf
%{_includedir}/perf/perf_dlfilter.h
%{_libdir}/libperf-jvmti.so
%{_libexecdir}/perf-core
%{bash_completions_dir}/perf
%if %{with manpages}
%{_mandir}/man1/perf*.1*
%endif

%files -n libperf
%{_libdir}/libperf.so.0
%{_libdir}/libperf.so.0.0.1

%files -n libperf-devel
%{_libdir}/libperf.so
%{_libdir}/pkgconfig/libperf.pc
%{_includedir}/internal/*.h
%{_includedir}/perf/bpf_perf.h
%{_includedir}/perf/core.h
%{_includedir}/perf/cpumap.h
%{_includedir}/perf/event.h
%{_includedir}/perf/evlist.h
%{_includedir}/perf/evsel.h
%{_includedir}/perf/mmap.h
%{_includedir}/perf/threadmap.h
%{_mandir}/man3/libperf.3.gz
%{_mandir}/man7/libperf-counting.7.gz
%{_mandir}/man7/libperf-sampling.7.gz
%{_docdir}/libperf/examples/sampling.c
%{_docdir}/libperf/examples/counting.c
%{_docdir}/libperf/html/libperf.html
%{_docdir}/libperf/html/libperf-counting.html
%{_docdir}/libperf/html/libperf-sampling.html

%files -n python3-perf
%{python3_sitearch}/*


%changelog
%autochangelog
-