Name:                trace-cmd
Version:             2.9.2
Release:             12
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

Patch0001:           backport-trace-cmd-report-Fix-typos-in-error-messages.patch 
Patch0002:           backport-trace-cmd-library-Fix-version-string-memory-leak.patch
Patch0003:           backport-trace-cmd-library-Fixed-a-memory-leak-on-input-handl.patch
Patch0004:           backport-Remove-unneeded-multiply-in-events-timesta.patch 
Patch0005:           backport-Changing-default-install-path-of-plugins.patch
Patch0006:           backport-Fix-broken-profile-command.patch
Patch0007:           backport-trace-cmd-stream-Set-default-sleep-time-to-half-a-se.patch
Patch0008:           backport-trace-cmd-record-Set-sleep_time-to-zero-at-end-of-re.patch

BuildRequires:       gcc xmlto asciidoc mlocate libxml2-devel chrpath
BuildRequires:       gtk2-devel glib2-devel desktop-file-utils libtraceevent-devel
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 MANPAGE_DOCBOOK_XSL=$MANPAGE_DOCBOOK_XSL prefix=%{_prefix} all doc

%install
make V=1 DESTDIR=$RPM_BUILD_ROOT/ prefix=%{_prefix} install install_doc
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
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

chrpath -d $RPM_BUILD_ROOT%{_bindir}/trace-cmd
mkdir -p $RPM_BUILD_ROOT/etc/ld.so.conf.d
echo "%{_bindir}/%{name}" > $RPM_BUILD_ROOT/etc/ld.so.conf.d/%{name}-%{_arch}.conf

%pre

%preun

%post
/sbin/ldconfig

%postun
/sbin/ldconfig

%files
%defattr(-,root,root)
%license COPYING COPYING.LIB
%doc README
%{_bindir}/trace-cmd
%{_datadir}/applications/kernelshark.desktop
%{_sysconfdir}/bash_completion.d/trace-cmd.bash
%{_docdir}/libtracecmd-doc/libtracecmd-files.html
%{_docdir}/libtracecmd-doc/libtracecmd-instances.html
%{_docdir}/libtracecmd-doc/libtracecmd-peer.html
%{_docdir}/libtracecmd-doc/libtracecmd-record.html
%{_docdir}/libtracecmd-doc/libtracecmd.html
%config(noreplace) /etc/ld.so.conf.d/*

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

%changelog
* Tue Dec 26 2023 meiyang666 <wangmeiyang@xfusion.com>  - 2.9.2-12
- Fix spec file

* Tue Dec 26 2023 meiyang666 <wangmeiyang@xfusion.com>  - 2.9.2-11
- trace-cmd record: Set sleep_time to zero at end of recording

* Tue Dec 26 2023 meiyang666 <wangmeiyang@xfusion.com>  - 2.9.2-10
- trace-cmd stream: Set default sleep time to half a second

* Mon Jan 09 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-9
- Fix broken profile command

* Sat Jan 07 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-8
- Changing default install path of plugins

* Sat Jan 07 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-7
- Remove unneeded multiply in events timestamp reading

* Fri Jan 06 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-6
- trace-cmd library: Fixed a memory leak on input handler close

* Fri Jan 06 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-5
- trace-cmd library: Fix version string memory leak

* Fri Jan 06 2023 Bolehu <heyaohua@xfusion.com> - 2.9.2-4
- trace-cmd report: Fix typos in error messages

* Tue Dec 06 2022 yaoxin <yaoxin30@h-partners.com> - 2.9.2-3
- Add /sbin/ldconfig to post and postun

* Sat Jul 30 2022 caodongxia <caodongxia@h-hpartners.com> - 2.9.2-2
- Del rpath in some binaries.

* Tue Jan 18 2022 houyingchao <houyingchao@huawei.com> - 2.9.2-1
- Upgrade to 2.9.2 version

* Fri Jul 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
