%define compat 0 %define libver 1.0.4 %define rpmrel 11 # Use rpmbuild --without checks to disable running the test suite (enabled by default) # This will be necessary for rpm-build < 4.1.1, which does not understand the %%check macro %{!?_with_checks: %{!?_without_checks: %define _with_checks --with-checks}} %{?_with_checks: %define enable_checks 1} %{?_without_checks: %define enable_checks 0} # Put `mdk' at end of release name for builds on Mandrake %define is_mandrake %(if %{__grep} '^Mandrake *[Ll]inux' /etc/redhat-release >/dev/null 2>&1; then echo 1; else echo 0; fi) %if %{is_mandrake} %define rpmrelease %{rpmrel}mdk %else %define rpmrelease %{rpmrel} %endif %if %{compat} Name: compat-libspf2 %else Name: libspf2 %endif Version: %{libver} Release: %{rpmrelease} Summary: libspf2 is an implementation of the SPF specification License: Dual BSD/LGPL Group: System Environment/Libraries Url: http://www.libspf2.org/ Patch0: libspf2-1.0.4-case-insensitive.patch Patch1: libspf2-resolv.patch Patch2: libspf2-resolv-binary.patch Source: http://www.libspf2.org/spf/libspf2-%{version}.tar.gz BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: glibc-devel, make %if %{enable_checks} # rpmbuild < 4.1.1 does not support %%check; see below BuildRequires: rpm-build >= 4.1.1, perl %endif Provides: spf %description libspf2 is an implementation of the SPF (Sender Policy Framework) specification as found at: http://www.ietf.org/internet-drafts/draft-mengwong-spf-00.txt SPF allows email systems to check SPF DNS records and make sure that an email is authorized by the administrator of the domain name that it is coming from. This prevents email forgery, commonly used by spammers, scammers, and email viruses/worms. A lot of effort has been put into making it secure by design, and a great deal of effort has been put into the regression tests. %if ! %{compat} %package devel Summary: Development tools needed to build programs that use libspf2 Group: Development/Libraries Requires: %{name} = %{version}-%{release} %description devel The libspf2-devel package contains the header files and static libraries necessary for developing programs using the libspf2 (Sender Policy Framework) library. If you want to develop programs that will look up and process SPF records, you should install libspf2-devel. You also need to install the libspf2 package. %package progs Summary: Programs for making SPF queries using libspf2 Group: Applications/Internet Requires: %{name} = %{version}-%{release} Prereq: /usr/sbin/alternatives %description progs Programs for making SPF queries and checking their results using libspf2. %endif %prep %setup -q -n libspf2-%{version} %patch0 -p0 # This huge patch saves us needing GNU autotools on build system %patch2 -p1 /bin/touch configure %build # The configure script checks for the existence of __ns_get16 and uses the # system-supplied version if found, otherwise one from src/libreplace. # However, this function is marked GLIBC_PRIVATE in recent versions of glibc # and shouldn't be called even if the configure script finds it. So we make # sure that the configure script always uses the version in src/libreplace. # This prevents us getting an unresolvable dependency in the built RPM. ac_cv_func___ns_get16=no export ac_cv_func___ns_get16 ./configure --prefix=%{_prefix} --libdir=%{_libdir} --bindir=%{_bindir} --includedir=%{_includedir} %{__make} %{?_smp_mflags} %install [ "$RPM_BUILD_ROOT" != "/" -a -n "$RPM_BUILD_ROOT" ] && %{__rm} -rf $RPM_BUILD_ROOT %{__make} DESTDIR=$RPM_BUILD_ROOT install %{__rm} -f $RPM_BUILD_ROOT/%{_bindir}/spf*_static %{__mv} -f $RPM_BUILD_ROOT/%{_bindir}/spfquery $RPM_BUILD_ROOT/%{_bindir}/spfquery.libspf2 %{__mv} -f $RPM_BUILD_ROOT/%{_bindir}/spfd $RPM_BUILD_ROOT/%{_bindir}/spfd.libspf2 # Remove files not needed for compat package %if %{compat} %{__rm} -rf $RPM_BUILD_ROOT/%{_bindir} %{__rm} -rf $RPM_BUILD_ROOT/%{_includedir}/spf2 %{__rm} -rf $RPM_BUILD_ROOT/%{_libdir}/*.a %{__rm} -rf $RPM_BUILD_ROOT/%{_libdir}/*.la %{__rm} -rf $RPM_BUILD_ROOT/%{_libdir}/*.so %endif %if %{enable_checks} # Delete the following line for legacy RPM versions (older than 4.1.1) if you wish to enable checks %check %{__make} check %endif %clean [ "$RPM_BUILD_ROOT" != "/" -a -n "$RPM_BUILD_ROOT" ] && %{__rm} -rf $RPM_BUILD_ROOT %post -p /sbin/ldconfig %postun -p /sbin/ldconfig %if ! %{compat} %post progs /usr/sbin/alternatives --install %{_bindir}/spfquery spf %{_bindir}/spfquery.libspf2 20 \ --slave %{_bindir}/spfd spf-daemon %{_bindir}/spfd.libspf2 exit 0 %preun progs if [ $1 = 0 ]; then /usr/sbin/alternatives --remove spf %{_bindir}/spfquery.libspf2 fi exit 0 %postun progs if [ "$1" -ge "1" ]; then spf=`readlink /etc/alternatives/spf` if [ "$spf" == "%{_bindir}/spfquery.libspf2" ]; then /usr/sbin/alternatives --set spf %{_bindir}/spfquery.libspf2 fi fi exit 0 %triggerpostun -- libspf2-progs <= 1.0.4-3 /usr/sbin/alternatives --auto spf %endif %files %defattr(-,root,root) %{_libdir}/libspf2.so.* %doc README Changelog docs/*.txt INSTALL LICENSES TODO %if ! %{compat} %files devel %defattr(-,root,root) %{_includedir}/spf2/spf*.h %{_libdir}/libspf2.a %{_libdir}/libspf2.la %{_libdir}/libspf2.so %doc docs/API %files progs %defattr(-,root,root) %{_bindir}/spfd.libspf2 %{_bindir}/spfquery.libspf2 %{_bindir}/spftest %{_bindir}/spf_example %{_bindir}/spf_example_2mx %endif %changelog * Sun Mar 26 2006 Petr Krištof 1.0.4-11 - Rebuild on FC-5 * Thu Feb 24 2005 Paul Howarth 1.0.4-10 - Remove Provides: libspf2 in compat mode, which creates implicit conflicts with other libspf2 packages - Further tweaks to detection of Mandrake build system - Update patch for res_query detection * Sun Feb 20 2005 Paul Howarth 1.0.4-9 - Enhance detection of Mandrake build system - Add support for building compat-libspf2 package - alternatives is a prerequisite for the -progs subpackage only * Thu Oct 28 2004 Paul Howarth 1.0.4-8 - Downgrade alternatives priority to 20 so that other implementations of spfquery will be preferred; there is still a case-sensitivity bug in libspf2 and no sign of an imminent fix. * Mon Aug 16 2004 Paul Howarth 1.0.4-7 - Configure fix to find -lresolv on x64_64 - Portability fixes for x64_64 * Sun Aug 1 2004 Paul Howarth 1.0.4-6 - Fix case-sensitivity bug. * Wed Jul 28 2004 Paul Howarth 1.0.4-5 - Revert -pthread option as it didn't improve anything. * Tue Jul 27 2004 Paul Howarth 1.0.4-4 - Use `alternatives' so that the spfquery and spfd programs can co-exist with versions from other implementations. - Ensure thread-safe operation by building with -pthread. * Thu Jul 15 2004 Paul Howarth 1.0.4-3 - Install the libtool library in the devel package so that dependent libraries are found properly. - Use the libtool supplied with the package rather than the system libtool. * Tue Jul 13 2004 Paul Howarth 1.0.4-2 - Cosmetic changes for building on Mandrake Linux - Require rpm-build >= 4.1.1 for building to avoid strange error messages from old versions of rpm when they see %%check - Require glibc-devel and make for building - Require perl for building with checks enabled - Improved description text for the packages * Fri Jul 09 2004 Paul Howarth 1.0.4-1 - Update to 1.0.4 - Added facility to build without running test suite (rpmbuild --without checks) * Sat Jul 03 2004 Paul Howarth 1.0.3-1 - Initial RPM build.