File jemalloc.spec of Package jemalloc

%define realname jemalloc
%define realver  5.2.1
%define srcext   tar.bz2

%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: pkg-config
BuildRoot:     %{_tmppath}/%{name}-root
Source:        https://github.com/jemalloc/jemalloc/releases/download/%{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}

%build
%configure \
 --disable-initial-exec-tls \
 CFLAGS="%{optflags} %{?gcc_lto}" \
 CXXFLAGS="%{optflags} %{?gcc_lto}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,now -Wl,-z,relro %{?gcc_lto}"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot}

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc COPYING README
%{_bindir}/jemalloc.sh
%{_bindir}/jeprof
%exclude %{_datadir}/doc/jemalloc/*

# Shared library
%files -n lib%{name}%{?so_ver}
%defattr(-,root,root)
%doc COPYING README
%{_libdir}/lib%{name}.so.%{?so_ver}*

# Development stuff
%files devel
%defattr(-,root,root)
%doc COPYING 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)
%doc COPYING 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
openSUSE Build Service is sponsored by