File libspf2.spec of Package libspf2

%define realname libspf2
%define realver  d14abff4b544cfc53a8b5ef54cbc2353866b5081
%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:       1.2.11
Release:       %{?extraver:0.}1%{?rhel:.el%{rhel}}%{?fedora:.fc%{fedora}}
License:       LGPL-2.0 or BSD-2-Clause
Group:         System/Libraries
URL:           https://www.libspf2.net/
Summary:       Fully thread safe Sender Policy Framework implementation

# Build-time parameters
BuildRequires: autoconf automake libtool
Source:        https://codeload.github.com/shevek/libspf2/%{srcext}/%{realver}#/%{realname}-%{realver}%{?extraver}.%{srcext}
Patch1:        libspf2-1.2.11-undefined-dn_.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 -p1
autoreconf -f -i

%build
_CFLAGS='%{optflags} -std=gnu89'
_LDFLAGS='-Wl,--as-needed -Wl,--strip-all -Wl,--no-undefined -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
%if 0%{?rhel}
_LDFLAGS+=' -lresolv'
%endif
%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 LICENSES
%doc 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
openSUSE Build Service is sponsored by