# This package used to be called "google-perftools", but it was renamed on 2012-02-03.
%{!?_pkgdocdir: %global _pkgdocdir %{_docdir}/%{name}-%{version}}
Name: gperftools
Version: 2.7.90
Release: 1%{?dist}
License: BSD
Summary: Very fast malloc and performance analysis tools
URL: https://github.com/gperftools/gperftools
Source0: https://github.com/gperftools/gperftools/releases/download/%{name}-%{version}/%{name}-%{version}.tar.gz
# Conditionalize generic dynamic tls model
Patch1: gperftools-2.7.90-disable-generic-dynamic-tls.patch
ExcludeArch: s390
BuildRequires: gcc-c++
%ifnarch s390x
BuildRequires: libunwind-devel
%endif
BuildRequires: perl-generators
BuildRequires: autoconf, automake, libtool
BuildRequires: make
Requires: gperftools-devel = %{version}-%{release}
Requires: pprof = %{version}-%{release}
%description
Perf Tools is a collection of performance analysis tools, including a
high-performance multi-threaded malloc() implementation that works
particularly well with threads and STL, a thread-friendly heap-checker,
a heap profiler, and a cpu-profiler.
This is a metapackage which pulls in all of the gperftools (and pprof)
binaries, libraries, and development headers, so that you can use them.
%package devel
Summary: Development libraries and headers for gperftools
Requires: %{name}-libs%{?_isa} = %{version}-%{release}
Provides: google-perftools-devel = %{version}-%{release}
Obsoletes: google-perftools-devel < 2.0
%description devel
Libraries and headers for developing applications that use gperftools.
%package libs
Summary: Libraries provided by gperftools
Provides: google-perftools-libs = %{version}-%{release}
Obsoletes: google-perftools-libs < 2.0
%description libs
Libraries provided by gperftools, including libtcmalloc and libprofiler.
%package -n pprof
Summary: CPU and Heap Profiler tool
Requires: gv, graphviz
BuildArch: noarch
Provides: google-perftools = %{version}-%{release}
Obsoletes: google-perftools < 2.0
%description -n pprof
Pprof is a heap and CPU profiler tool, part of the gperftools suite.
%prep
%setup -q
%patch1 -p1 -b .dynload
# Fix end-of-line encoding
sed -i 's/\r//' README_windows.txt
# No need to have exec permissions on source code
chmod -x src/*.h src/*.cc
autoreconf -ifv
%build
CFLAGS=`echo $RPM_OPT_FLAGS -fno-strict-aliasing -Wno-unused-local-typedefs -DTCMALLOC_LARGE_PAGES | sed -e 's|-fexceptions||g'`
CXXFLAGS=`echo $RPM_OPT_FLAGS -fno-strict-aliasing -Wno-unused-local-typedefs -DTCMALLOC_LARGE_PAGES | sed -e 's|-fexceptions||g'`
%configure \
%ifarch s390x aarch64
--disable-general-dynamic-tls \
%endif
--disable-dynamic-sized-delete-support \
--disable-static
# Bad rpath!
sed -i 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec=""|g' libtool
sed -i 's|^runpath_var=LD_RUN_PATH|runpath_var=DIE_RPATH_DIE|g' libtool
# Can't build with smp_mflags
make
%install
make DESTDIR=%{buildroot} docdir=%{_pkgdocdir}/ install
find %{buildroot} -type f -name "*.la" -exec rm -f {} ';'
# Delete useless files
rm -rf %{buildroot}%{_pkgdocdir}/INSTALL
%check
# http://code.google.com/p/google-perftools/issues/detail?id=153
%ifnarch ppc
# Their test suite is almost always broken.
# LD_LIBRARY_PATH=./.libs make check
%endif
%ldconfig_scriptlets libs
%files
%files -n pprof
%{_bindir}/pprof
%{_bindir}/pprof-symbolize
%{_mandir}/man1/*
%files devel
%{_pkgdocdir}/
%{_includedir}/google/
%{_includedir}/gperftools/
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%files libs
%{_libdir}/*.so.*
%changelog
* Thu May 27 2021 Kaleb S. KEITHLEY <kkeithle[at]redhat.com> - 2.7.90-1
- Ceph Octopus
* Thu Jul 25 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.7-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild