File gperftools.spec of Package gperftools
%define realname gperftools
%define srcext tar.gz
%define profiler_so_ver 0
%define tcmalloc_so_ver 4
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}
Version: 2.8.1
Release: %{?extraver:0.}1%{?dist}
License: BSD-3-Clause
Group: Development/Languages/C and C++
URL: https://github.com/gperftools/gperftools
Summary: Fast, multi-threaded malloc() and nifty performance analysis tools
# Install-time parameters
Provides: google-perftools = %{version}
Requires: perl%{?suse_version:-base}
Requires: libprofiler%{?profiler_so_ver}
Requires: libtcmalloc%{?tcmalloc_so_ver}
# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: gcc-c++
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-root
Source: https://github.com/gperftools/gperftools/releases/download/%{realname}-%{version}/%{realname}-%{version}.%{srcext}
%description
Perftools is a collection of a high-performance multi-threaded malloc()
implementation, plus some pretty nifty performance analysis tools.
%package devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: %{name} = %{version}
Requires: libprofiler%{?profiler_so_ver} = %{version}
Requires: libtcmalloc%{?tcmalloc_so_ver} = %{version}
Provides: libprofiler-devel = %{version}
Provides: libtcmalloc-devel = %{version}
Provides: libtcmalloc_minimal-devel = %{version}
Provides: libprofiler%{?profiler_so_ver}-devel = %{version}
Provides: libtcmalloc%{?tcmalloc_so_ver}-devel = %{version}
Provides: libtcmalloc_minimal%{?tcmalloc_so_ver}-devel = %{version}
Provides: google-perftools-devel = %{version}
%description devel
Files needed for development with use of Google Perfomance Tools
%package -n libtcmalloc%{?tcmalloc_so_ver}
Group: Development/Languages/C and C++
Summary: Thread-Caching Malloc
Provides: libtcmalloc_minimal%{?tcmalloc_so_ver} = %{version}
%description -n libtcmalloc%{?tcmalloc_so_ver}
Thread-Caching Malloc
%package -n libprofiler%{?profiler_so_ver}
Group: Development/Languages/C and C++
Summary: Gperftools CPU Profiler
%description -n libprofiler%{?profiler_so_ver}
This is the CPU profiler we use at Google. There are three parts
to using it: linking the library into an application, running the
code, and analyzing the output.
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{version}%{?extraver}
test -x configure || autoreconf --force --install
%build
_CFLAGS='%{optflags} %{?gcc_lto} -fno-common -ffat-lto-objects'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%configure \
--disable-static \
--enable-frame-pointers \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS" \
NM='nm --plugin ""'
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}%{_datadir}/doc
# Fix shebang
%{__sed} -ri '1 s|^.+$|#!%{_bindir}/perl|' %{buildroot}%{_bindir}/pprof*
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license COPYING
%doc AUTHORS NEWS README TODO
%{_bindir}/pprof*
%doc %{_mandir}/man1/pprof.1*
%files devel
%defattr(-,root,root)
%doc docs/*
%{_includedir}/google/
%{_includedir}/gperftools/
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%exclude %{_libdir}/*.la
%files -n libtcmalloc%{?tcmalloc_so_ver}
%defattr(-,root,root)
%{_libdir}/libtcmalloc*.so.%{?tcmalloc_so_ver}*
%files -n libprofiler%{?profiler_so_ver}
%defattr(-,root,root)
%{_libdir}/libprofiler.so.%{?profiler_so_ver}*
%post -n libtcmalloc%{?tcmalloc_so_ver} -p /sbin/ldconfig
%postun -n libtcmalloc%{?tcmalloc_so_ver} -p /sbin/ldconfig
%post -n libprofiler%{?profiler_so_ver} -p /sbin/ldconfig
%postun -n libprofiler%{?profiler_so_ver} -p /sbin/ldconfig
%changelog