File jemalloc.spec of Package jemalloc
%define realname jemalloc
%define realver 5.3.0
%define srcext tar.gz
%define so_ver 2
# turn off the generation of debuginfo rpm (RH9) ??
%global debug_package %{nil}
# Common info
Name: %{realname}
Version: %{realver}
Release: %{?extraver:0.}1%{?dist}
License: BSD-2-Clause
Group: Development/Languages/C and C++
URL: http://jemalloc.net/
Summary: General purpose malloc(3) implementation
# Build-time parameters
BuildRequires: autoconf automake libtool
BuildRequires: pkg-config
BuildRoot: %{_tmppath}/%{name}-root
Source: https://codeload.github.com/jemalloc/jemalloc/%{srcext}/refs/tags/%{realver}#/%{realname}-%{realver}%{?extraver}.%{srcext}
%description
jemalloc is a general purpose malloc(3) implementation that emphasizes
fragmentation avoidance and scalable concurrency support.
%package -n lib%{name}%{?so_ver}
Group: System/Libraries
Summary: Shared library for %{name}
Provides: lib%{name} = %{version}
%description -n lib%{name}%{?so_ver}
Shared library for %{name}
%package devel
Group: Development/Languages/C and C++
Summary: Development files for %{name}
Requires: lib%{name}%{?so_ver} = %{version}
Provides: lib%{name}%{?so_ver}-devel = %{version}
Provides: lib%{name}-devel = %{version}
%description devel
Development files for %{name}
%package devel-static
Group: Development/Languages/C and C++
Summary: Static library for %{name}
Requires: %{name}-devel = %{version}
Provides: lib%{name}-devel-static = %{version}
%description devel-static
Static library for %{name}
# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
echo '%{version}' > VERSION
%{__sed} -ri '/JEMALLOC_UAF_DETECTION/ s/\]\)/], [ ])/' configure.ac
test -x configure || autoreconf --install
%build
_CFLAGS='%{optflags} %{?gcc_lto}'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro %{?gcc_lto}'
%configure \
CFLAGS="$_CFLAGS" \
CXXFLAGS="$_CFLAGS" \
LDFLAGS="$_LDFLAGS"
%{__make} %{?_smp_mflags}
%install
%{__make} install DESTDIR=%{buildroot}
%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
%files
%defattr(-,root,root)
%license COPYING
%doc README TUNING.md
%{_bindir}/jemalloc.sh
%{_bindir}/jeprof
%exclude %{_datadir}/doc/jemalloc/*
# Shared library
%files -n lib%{name}%{?so_ver}
%defattr(-,root,root)
%license COPYING
%doc README TUNING.md
%{_libdir}/lib%{name}.so.%{?so_ver}*
# Development stuff
%files devel
%defattr(-,root,root)
%license COPYING
%doc README doc/jemalloc.html
%{_bindir}/jemalloc-config
%{_libdir}/pkgconfig/%{name}.pc
%dir %{_includedir}/%{name}/
%{_includedir}/%{name}/*.h
%{_libdir}/lib%{name}.so
%doc %{_mandir}/man3/*
# Static library
%files devel-static
%defattr(-,root,root)
%license COPYING
%doc README
%attr(0644,root,root) %{_libdir}/lib%{name}.a
%attr(0644,root,root) %{_libdir}/lib%{name}_pic.a
%post -n lib%{name}%{?so_ver} -p /sbin/ldconfig
%postun -n lib%{name}%{?so_ver} -p /sbin/ldconfig
%changelog