File libspf2.spec of Package libspf2

%define realname libspf2
%define realver  1.2.10
%define srcext   tar.gz

%define sover    2

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

# Common info
Name:          %{realname}%{?sover:-%{sover}}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?rhel:.el%{rhel}}%{?fedora:.fc%{fedora}}
License:       LGPL-2.0 or BSD-2-Clause
Group:         System/Libraries
URL:           http://www.libspf2.org/
Summary:       Fully thread safe Sender Policy Framework implementation

# Build-time parameters
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://www.libspf2.org/spf/%{realname}-%{realver}%{?extraver}.%{srcext}
Patch:         gcc5-build-fix.patch

%description
libspf2 implements the Sender Policy Framework, a part of the SPF/SRS protocol
pair. libspf2 is a library which allows email systems such as Sendmail, Postfix,
Exim, Zmailer and MS Exchange to check SPF records and make sure that the email
is authorized by the domain name that it is coming from. This prevents email
forgery, commonly used by spammers, scammers and email viruses/worms.

%package -n %{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}

%description -n %{realname}-devel
Development files for %{name}

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%patch -p1

%build
%configure \
 CFLAGS="%{optflags}" \
 CXXFLAGS="%{optflags}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all"
%{__make} %{?_smp_mflags}

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

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

%files
%defattr(-,root,root)
%doc LICENSES README TODO
%{_bindir}/*
%exclude %{_bindir}/*_static
%{_libdir}/*.so.%{?sover}*

# Development stuff
%files -n %{realname}-devel
%defattr(-,root,root)
%dir %{_includedir}/spf2/
%{_includedir}/spf2/*.h
%{_libdir}/*.so
%exclude %{_libdir}/*.a
%exclude %{_libdir}/*.la

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog