| 1 | # NOTE THAT THE TEST SUITE IS CURRENTLY BROKEN
|
|---|
| 2 | # USE rpmbuild --with checks TO SEE THIS FOR YOURSELF
|
|---|
| 3 |
|
|---|
| 4 | # Each change to the spec requires a bump to version/release of both library and perlmod
|
|---|
| 5 | %global library_version 1.2.9
|
|---|
| 6 | %global library_release 1%{?dist}
|
|---|
| 7 | %global perlmod_version 0.01
|
|---|
| 8 | %global perlmod_release 0%{?dist}
|
|---|
| 9 |
|
|---|
| 10 | # Set to 1 for a compat-libspf2 package
|
|---|
| 11 | %global compat 0
|
|---|
| 12 |
|
|---|
| 13 | # graphviz needed to build API docs, only available from Fedora 3, RHEL 4
|
|---|
| 14 | %if 0%{?fedora} >= 3 || 0%{?rhel} >= 4
|
|---|
| 15 | %global build_apidocs 1
|
|---|
| 16 | %else
|
|---|
| 17 | %global build_apidocs 0
|
|---|
| 18 | %endif
|
|---|
| 19 | # Fedora 10, RHEL 6 onwards support noarch subpackages
|
|---|
| 20 | %if 0%{?fedora} > 9 || 0%{?rhel} >= 6
|
|---|
| 21 | %global build_apidocs_noarch 1
|
|---|
| 22 | %endif
|
|---|
| 23 |
|
|---|
| 24 | # Use rpmbuild --with checks to try running the broken test suite (disabled by default)
|
|---|
| 25 | %{!?_without_checks: %{!?_with_checks: %global _without_checks --without-checks}}
|
|---|
| 26 | %{?_with_checks: %global enable_checks 1}
|
|---|
| 27 | %{?_without_checks: %global enable_checks 0}
|
|---|
| 28 |
|
|---|
| 29 | # Macros that need defining for older distributions
|
|---|
| 30 | %{!?perl_vendorarch: %global perl_vendorarch %(eval "`%{__perl} -V:installvendorarch`"; echo $installvendorarch)}
|
|---|
| 31 | %{!?__id_u: %global __id_u %([ -x /bin/id ]&&echo /bin/id||([ -x /usr/bin/id ]&&echo /usr/bin/id||echo /bin/true)) -u}
|
|---|
| 32 |
|
|---|
| 33 | %if %{compat}
|
|---|
| 34 | Name: compat-libspf2
|
|---|
| 35 | %else
|
|---|
| 36 | Name: libspf2
|
|---|
| 37 | %endif
|
|---|
| 38 | Version: %{library_version}
|
|---|
| 39 | Release: %{library_release}
|
|---|
| 40 | Summary: An implementation of the SPF specification
|
|---|
| 41 | License: BSD or LGPLv2+
|
|---|
| 42 | Group: System Environment/Libraries
|
|---|
| 43 | Url: http://www.libspf2.org/
|
|---|
| 44 | Source0: http://www.libspf2.org/spf/libspf2-%{version}.tar.gz
|
|---|
| 45 |
|
|---|
| 46 | Patch1: libspf2-os2.diff
|
|---|
| 47 |
|
|---|
| 48 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
|---|
| 49 |
|
|---|
| 50 | %if %{build_apidocs}
|
|---|
| 51 | # For API docs
|
|---|
| 52 | BuildRequires: doxygen, graphviz
|
|---|
| 53 | %endif
|
|---|
| 54 | # For perl bindings (Makefile.PL claims Mail::SPF is needed, but it isn't)
|
|---|
| 55 | #BuildRequires: perl(ExtUtils::MakeMaker)
|
|---|
| 56 | # For perl test suite
|
|---|
| 57 | #BuildRequires: perl(Test::Pod), perl(String::Escape)
|
|---|
| 58 | # POD Coverage is non-existent, causes test suite to fail
|
|---|
| 59 | #BuildConflicts: perl(Test::Pod::Coverage)
|
|---|
| 60 | # Perl module fails the standard test suite
|
|---|
| 61 | #BuildConflicts: perl(Mail::SPF::Test)
|
|---|
| 62 | %if %{compat}
|
|---|
| 63 | Provides: libspf2 = %{version}-%{release}
|
|---|
| 64 | %endif
|
|---|
| 65 |
|
|---|
| 66 | %description
|
|---|
| 67 | libspf2 is an implementation of the SPF (Sender Policy Framework)
|
|---|
| 68 | specification as found at:
|
|---|
| 69 | http://www.ietf.org/internet-drafts/draft-mengwong-spf-00.txt
|
|---|
| 70 | SPF allows email systems to check SPF DNS records and make sure that
|
|---|
| 71 | an email is authorized by the administrator of the domain name that
|
|---|
| 72 | it is coming from. This prevents email forgery, commonly used by
|
|---|
| 73 | spammers, scammers, and email viruses/worms.
|
|---|
| 74 |
|
|---|
| 75 | A lot of effort has been put into making it secure by design, and a
|
|---|
| 76 | great deal of effort has been put into the regression tests.
|
|---|
| 77 |
|
|---|
| 78 | %if ! %{compat}
|
|---|
| 79 | %package devel
|
|---|
| 80 | Summary: Development tools needed to build programs that use libspf2
|
|---|
| 81 | Group: Development/Libraries
|
|---|
| 82 | Version: %{library_version}
|
|---|
| 83 | Release: %{library_release}
|
|---|
| 84 | Requires: %{name} = %{version}-%{release}
|
|---|
| 85 |
|
|---|
| 86 | %description devel
|
|---|
| 87 | The libspf2-devel package contains the header files and static
|
|---|
| 88 | libraries necessary for developing programs using the libspf2 (Sender
|
|---|
| 89 | Policy Framework) library.
|
|---|
| 90 |
|
|---|
| 91 | If you want to develop programs that will look up and process SPF records,
|
|---|
| 92 | you should install libspf2-devel.
|
|---|
| 93 |
|
|---|
| 94 | %if %{build_apidocs}
|
|---|
| 95 | API documentation is in the separate libspf2-apidocs package.
|
|---|
| 96 |
|
|---|
| 97 | %package apidocs
|
|---|
| 98 | Summary: API documentation for the libspf2 library
|
|---|
| 99 | Group: Documentation
|
|---|
| 100 | Version: %{library_version}
|
|---|
| 101 | Release: %{library_release}
|
|---|
| 102 | %{?build_apidocs_noarch:BuildArch: noarch}
|
|---|
| 103 |
|
|---|
| 104 | %description apidocs
|
|---|
| 105 | The libspf2-apidocs package contains the API documentation for creating
|
|---|
| 106 | applications that use the libspf2 (Sender Policy Framework) library.
|
|---|
| 107 | %endif
|
|---|
| 108 |
|
|---|
| 109 | %package -n perl-Mail-SPF_XS
|
|---|
| 110 | Summary: An XS implementation of Mail::SPF
|
|---|
| 111 | Group: Development/Libraries
|
|---|
| 112 | License: GPL+ or Artistic
|
|---|
| 113 | Version: %{perlmod_version}
|
|---|
| 114 | Release: %{perlmod_release}
|
|---|
| 115 | Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
|
|---|
| 116 |
|
|---|
| 117 | %description -n perl-Mail-SPF_XS
|
|---|
| 118 | This is an interface to the C library libspf2 for the purpose of
|
|---|
| 119 | testing. While it can be used as an SPF implementation, you can also
|
|---|
| 120 | use Mail::SPF, which is a little more perlish.
|
|---|
| 121 |
|
|---|
| 122 | %package progs
|
|---|
| 123 | Summary: Programs for making SPF queries using libspf2
|
|---|
| 124 | Group: Applications/Internet
|
|---|
| 125 | Version: %{library_version}
|
|---|
| 126 | Release: %{library_release}
|
|---|
| 127 | Requires: %{name} = %{version}-%{release}
|
|---|
| 128 |
|
|---|
| 129 | #Requires(post): /usr/sbin/alternatives
|
|---|
| 130 | #Requires(preun): /usr/sbin/alternatives
|
|---|
| 131 | #Requires(postun): /usr/sbin/alternatives, /usr/bin/readlink
|
|---|
| 132 |
|
|---|
| 133 | %description progs
|
|---|
| 134 | Programs for making SPF queries and checking their results using libspf2.
|
|---|
| 135 | %endif
|
|---|
| 136 |
|
|---|
| 137 | %prep
|
|---|
| 138 | %setup -q -n libspf2-%{version}
|
|---|
| 139 | %patch001 -p1 -b .os2~
|
|---|
| 140 |
|
|---|
| 141 | %build
|
|---|
| 142 | # The configure script checks for the existence of __ns_get16 and uses the
|
|---|
| 143 | # system-supplied version if found, otherwise one from src/libreplace.
|
|---|
| 144 | # However, this function is marked GLIBC_PRIVATE in recent versions of glibc
|
|---|
| 145 | # and shouldn't be called even if the configure script finds it. So we make
|
|---|
| 146 | # sure that the configure script always uses the version in src/libreplace.
|
|---|
| 147 | # This prevents us getting an unresolvable dependency in the built RPM.
|
|---|
| 148 | ac_cv_func___ns_get16=no
|
|---|
| 149 | export ac_cv_func___ns_get16
|
|---|
| 150 |
|
|---|
| 151 | export CONFIG_SHELL="/bin/sh" ; \
|
|---|
| 152 | export LDFLAGS="-Zbin-files -Zhigh-mem -Zomf -Zargs-wild -Zargs-resp" ; \
|
|---|
| 153 | export LIBS="-lurpo -lmmap -lpthread" ; \
|
|---|
| 154 | %configure \
|
|---|
| 155 | --enable-shared --disable-static \
|
|---|
| 156 | "--cache-file=%{_topdir}/cache/%{name}-%{_target_cpu}.cache"
|
|---|
| 157 |
|
|---|
| 158 | # Kill bogus RPATHs
|
|---|
| 159 | %{__sed} -i 's|^sys_lib_dlsearch_path_spec="/lib /usr/lib|sys_lib_dlsearch_path_spec="/%{_lib} %{_libdir}|' libtool
|
|---|
| 160 |
|
|---|
| 161 | %{__make} %{?_smp_mflags} CFLAGS="%{optflags} -fno-strict-aliasing"
|
|---|
| 162 |
|
|---|
| 163 | %if %{build_apidocs}
|
|---|
| 164 | # Generate API docs
|
|---|
| 165 | %{__sed} -i -e 's/\(SHORT_NAMES[[:space:]]*=[[:space:]]*\)NO/\1YES/' Doxyfile
|
|---|
| 166 | /usr/bin/doxygen
|
|---|
| 167 | %endif
|
|---|
| 168 |
|
|---|
| 169 | %install
|
|---|
| 170 | #PERL_INSTALL_ROOT=$(%{__grep} DESTDIR perl/Makefile &> /dev/null && echo "" || echo %{buildroot})
|
|---|
| 171 | %{__rm} -rf %{buildroot}
|
|---|
| 172 | %{__make} \
|
|---|
| 173 | DESTDIR=%{buildroot} \
|
|---|
| 174 | INSTALLDIRS=vendor \
|
|---|
| 175 | INSTALL="%{__install} -p" \
|
|---|
| 176 | install
|
|---|
| 177 |
|
|---|
| 178 | cp src/libspf2/.libs/spf2.a %{buildroot}%{_libdir}
|
|---|
| 179 |
|
|---|
| 180 | # Clean up after impure perl installation
|
|---|
| 181 | #/usr/bin/find %{buildroot} \( -name perllocal.pod -o -name .packlist \) -exec %{__rm} {} ';'
|
|---|
| 182 | #/usr/bin/find %{buildroot} -type f -name '*.bs' -a -size 0 -exec %{__rm} -f {} ';'
|
|---|
| 183 | #/usr/bin/find %{buildroot} -depth -type d -exec /bin/rmdir {} 2>/dev/null ';'
|
|---|
| 184 | #%{__chmod} -R u+w %{buildroot}/*
|
|---|
| 185 |
|
|---|
| 186 | # Don't want statically-linked binaries
|
|---|
| 187 | %{__rm} -f %{buildroot}%{_bindir}/spf*_static.exe
|
|---|
| 188 |
|
|---|
| 189 | # Rename binaries that will be accessed via alternatives
|
|---|
| 190 | %{__mv} -f %{buildroot}%{_bindir}/spfquery.exe %{buildroot}%{_bindir}/spfquery_libspf2.exe
|
|---|
| 191 | %{__mv} -f %{buildroot}%{_bindir}/spfd.exe %{buildroot}%{_bindir}/spfd_libspf2.exe
|
|---|
| 192 |
|
|---|
| 193 | # Remove files not needed for compat package
|
|---|
| 194 | %if %{compat}
|
|---|
| 195 | %{__rm} -rf %{buildroot}%{_bindir}
|
|---|
| 196 | %{__rm} -rf %{buildroot}%{_includedir}/spf2
|
|---|
| 197 | %{__rm} -rf %{buildroot}%{_libdir}/*.a
|
|---|
| 198 | %{__rm} -rf %{buildroot}%{_libdir}/*.la
|
|---|
| 199 | %{__rm} -rf %{buildroot}%{_libdir}/*.so
|
|---|
| 200 | %{__rm} -rf %{buildroot}%{_mandir}/man3
|
|---|
| 201 | %{__rm} -rf %{buildroot}%{perl_vendorarch}
|
|---|
| 202 | %endif
|
|---|
| 203 |
|
|---|
| 204 | #%check
|
|---|
| 205 | #%if %{enable_checks}
|
|---|
| 206 | #%{__make} -C tests check
|
|---|
| 207 | #%endif
|
|---|
| 208 | #LD_PRELOAD=$(pwd)/src/libspf2/.libs/libspf2.so %{__make} -C perl test
|
|---|
| 209 |
|
|---|
| 210 | %clean
|
|---|
| 211 | %{__rm} -rf %{buildroot}
|
|---|
| 212 |
|
|---|
| 213 | #%post -p /sbin/ldconfig
|
|---|
| 214 |
|
|---|
| 215 | #%postun -p /sbin/ldconfig
|
|---|
| 216 |
|
|---|
| 217 | %if ! %{compat}
|
|---|
| 218 | %post progs
|
|---|
| 219 | /usr/sbin/alternatives --install %{_bindir}/spfquery spf %{_bindir}/spfquery.libspf2 20 \
|
|---|
| 220 | --slave %{_bindir}/spfd spf-daemon %{_bindir}/spfd.libspf2
|
|---|
| 221 | exit 0
|
|---|
| 222 |
|
|---|
| 223 | #%preun progs
|
|---|
| 224 | #if [ $1 = 0 ]; then
|
|---|
| 225 | # /usr/sbin/alternatives --remove spf %{_bindir}/spfquery.libspf2
|
|---|
| 226 | #fi
|
|---|
| 227 | #exit 0
|
|---|
| 228 |
|
|---|
| 229 | #%postun progs
|
|---|
| 230 | #if [ "$1" -ge "1" ]; then
|
|---|
| 231 | # spf=`readlink /etc/alternatives/spf`
|
|---|
| 232 | # if [ "$spf" == "%{_bindir}/spfquery.libspf2" ]; then
|
|---|
| 233 | # /usr/sbin/alternatives --set spf %{_bindir}/spfquery.libspf2
|
|---|
| 234 | # fi
|
|---|
| 235 | #fi
|
|---|
| 236 | #exit 0
|
|---|
| 237 |
|
|---|
| 238 | #%triggerpostun -- libspf2-progs <= 1.0.4-3
|
|---|
| 239 | #/usr/sbin/alternatives --auto spf
|
|---|
| 240 | %endif
|
|---|
| 241 |
|
|---|
| 242 | %files
|
|---|
| 243 | %defattr(-,root,root,-)
|
|---|
| 244 | %{_libdir}/spf2.dll
|
|---|
| 245 | %doc README INSTALL LICENSES TODO
|
|---|
| 246 | #%doc docs/*.txt
|
|---|
| 247 |
|
|---|
| 248 | %if ! %{compat}
|
|---|
| 249 | %files devel
|
|---|
| 250 | %defattr(-,root,root,-)
|
|---|
| 251 | %{_includedir}/spf2/spf*.h
|
|---|
| 252 | %{_libdir}/spf2.a
|
|---|
| 253 | %{_libdir}/spf2.dll
|
|---|
| 254 |
|
|---|
| 255 | %if %{build_apidocs}
|
|---|
| 256 | %files apidocs
|
|---|
| 257 | %defattr(-,root,root,-)
|
|---|
| 258 | %doc doxygen/html
|
|---|
| 259 | %endif
|
|---|
| 260 |
|
|---|
| 261 | %files progs
|
|---|
| 262 | %defattr(-,root,root,-)
|
|---|
| 263 | %{_bindir}/spfd_libspf2.exe
|
|---|
| 264 | %{_bindir}/spfquery_libspf2.exe
|
|---|
| 265 | %{_bindir}/spftest.exe
|
|---|
| 266 | %{_bindir}/spf_example.exe
|
|---|
| 267 |
|
|---|
| 268 | #%files -n perl-Mail-SPF_XS
|
|---|
| 269 | #%defattr(-,root,root,-)
|
|---|
| 270 | #%{perl_vendorarch}/Mail/
|
|---|
| 271 | #%{perl_vendorarch}/auto/Mail/
|
|---|
| 272 | #%{_mandir}/man3/Mail::SPF_XS.3pm*
|
|---|
| 273 | %endif
|
|---|
| 274 |
|
|---|
| 275 | %changelog
|
|---|