Name:                trace-cmd
Version:             2.7
Release:             6
Summary:             A front-end for Ftrace
License:             GPLv2 and LGPLv2
URL:                 http://git.kernel.org/?p=linux/kernel/git/rostedt/trace-cmd.git;a=summary
Source0:             https://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git/snapshot/%{name}-v%{version}.tar.gz
Source1:             kernelshark.desktop
Patch1:              0001-trace-cmd-Figure-out-the-arch-and-install-library-to.patch
Patch2:              0002-trace-cmd-Fix-the-logic-behind-SWIG_DEFINED-in-the-M.patch
Patch3:              0001-trace-cmd-Fix-build-with-gcc-10.patch
BuildRequires:       gcc xmlto asciidoc mlocate libxml2-devel
BuildRequires:       gtk2-devel glib2-devel desktop-file-utils
Provides:            kernelshark
Obsoletes:           kernelshark
%description
This package is a user-space front-end command-line tool for Ftrace.

%package_help

%prep
%autosetup -n %{name}-v%{version} -p1

%build
MANPAGE_DOCBOOK_XSL=`rpm -ql docbook-style-xsl | grep manpages/docbook.xsl`
make V=1 CFLAGS="%{optflags} -D_GNU_SOURCE" LDFLAGS="%{build_ldflags}" \
  MANPAGE_DOCBOOK_XSL=$MANPAGE_DOCBOOK_XSL prefix=%{_prefix} all doc gui python-plugin

%install
make V=1 DESTDIR=$RPM_BUILD_ROOT/ prefix=%{_prefix} install install_doc install_gui install_python
find $RPM_BUILD_ROOT%{_mandir} -type f | xargs chmod u-x,g-x,o-x
find $RPM_BUILD_ROOT%{_datadir} -type f | xargs chmod u-x,g-x,o-x
find $RPM_BUILD_ROOT%{_libdir} -type f -iname "*.so" | xargs chmod 0755
install -d -m 755 $RPM_BUILD_ROOT/%{_datadir}/applications
install -p -m 644 %{SOURCE1} $RPM_BUILD_ROOT/%{_datadir}/applications/kernelshark.desktop
desktop-file-validate $RPM_BUILD_ROOT/%{_datadir}/applications/kernelshark.desktop

%pre

%preun

%post

%postun

%files
%defattr(-,root,root)
%license COPYING COPYING.LIB
%doc README
%{_bindir}/trace-cmd
%dir %{_libdir}/%{name}
%dir %{_libdir}/%{name}/plugins
%{_libdir}/%{name}/plugins/plugin_blk.so
%{_libdir}/%{name}/plugins/plugin_cfg80211.so
%{_libdir}/%{name}/plugins/plugin_function.so
%{_libdir}/%{name}/plugins/plugin_hrtimer.so
%{_libdir}/%{name}/plugins/plugin_jbd2.so
%{_libdir}/%{name}/plugins/plugin_kmem.so
%{_libdir}/%{name}/plugins/plugin_kvm.so
%{_libdir}/%{name}/plugins/plugin_mac80211.so
%{_libdir}/%{name}/plugins/plugin_sched_switch.so
%{_libdir}/%{name}/plugins/plugin_scsi.so
%{_libdir}/%{name}/plugins/plugin_tlb.so
%{_libdir}/%{name}/plugins/plugin_xen.so
%{_bindir}/trace-view
%{_bindir}/trace-graph
%{_bindir}/kernelshark
%{_datadir}/kernelshark
%{_datadir}/applications/kernelshark.desktop
%{_sysconfdir}/bash_completion.d/trace-cmd.bash


%files help
%{_mandir}/man1/*
%{_mandir}/man5/*

%changelog
* Fri July 30 2021 Guoxiaoqi <guoxiaoqi2@huawei.com> - 2.7-6
- Fix build with gcc-10

* Wed Oct 28 2020 Anan Fu <fuanan3@huawei.com> - 2.7-5
- disable python2

* Wed Nov 20 2019 openEuler Buildteam <buildteam@openeuler.org> - 2.7-4
- Package init
