Mon, 28 Jan 2013 17:37:18 +0100
Correct socket error reporting improvement with IPv6 portable code,
after helpful recommendation by Saúl Ibarra Corretgé on OSips devlist.
1 ##
2 ## spamassassin.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2011 OpenPKG Foundation e.V. <http://openpkg.net/>
4 ##
5 ## Permission to use, copy, modify, and distribute this software for
6 ## any purpose with or without fee is hereby granted, provided that
7 ## the above copyright notice and this permission notice appear in all
8 ## copies.
9 ##
10 ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
11 ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
12 ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
13 ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
14 ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
15 ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
16 ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
17 ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
18 ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
19 ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
20 ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
21 ## SUCH DAMAGE.
22 ##
24 # package version
25 %define V_real 3.3.2
26 %define V_here 3.3.2
27 %define V_sdir 3.3.2
29 # package information
30 Name: spamassassin
31 Summary: Mail Filter Identifying Spam
32 URL: http://spamassassin.apache.org/
33 Vendor: Justin Mason
34 Packager: OpenPKG Foundation e.V.
35 Distribution: OpenPKG Community
36 Class: BASE
37 Group: Mail
38 License: ASF
39 Version: %{V_here}
40 Release: 20120800
42 # package options
43 %option with_fsl yes
45 # list of sources
46 Source0: http://www.apache.org/dist/spamassassin/source/Mail-SpamAssassin-%{V_real}.tar.bz2
47 Source1: rc.spamassassin
48 Source2: local.cf
49 Source3: fsl.spamassassin
51 # build information
52 BuildPreReq: OpenPKG, openpkg >= 20100101, perl, perl-openpkg >= 5.8.4, make
53 PreReq: OpenPKG, openpkg >= 20100101, perl, gnupg
54 BuildPreReq: perl-db, perl-crypto, perl-xml, perl-dns, perl-locale, perl-www
55 PreReq: perl-db, perl-crypto, perl-xml, perl-dns, perl-locale, perl-www
56 %if "%{with_fsl}" == "yes"
57 BuildPreReq: fsl
58 PreReq: fsl
59 %endif
61 %description
62 SpamAssassin provides you with a way to reduce if not completely
63 eliminate Unsolicited Commercial Email (UCE, aka SPAM) from your
64 incoming email. It uses a genetic-algorithm evolved scoring system
65 to identify messages which look spammy, then adds headers to the
66 message so they can be filtered by the user's mail reading software.
67 This distribution includes the spamd/spamc components which create a
68 server that considerably speeds processing of mail.
70 %track
71 prog spamassassin = {
72 version = %{V_real}
73 url = http://www.apache.org/dist/spamassassin/source/
74 regex = Mail-SpamAssassin-(\d+\.\d+\.\d+)\.tar\.bz2
75 }
77 %prep
78 %setup -q -n Mail-SpamAssassin-%{V_sdir}
80 %build
81 # configure package
82 %{l_prefix}/bin/perl-openpkg prepare
83 export CC="%{l_cc}"
84 export CFLAGS="%{l_cflags -O} -Ispamc %{l_cppflags}"
85 export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}"
86 export LIBS="%{l_ldflags} %{l_fsl_ldflags} %{l_fsl_libs}"
87 %{l_prefix}/bin/perl-openpkg configure \
88 -A DESTDIR="$RPM_BUILD_ROOT" \
89 -A PREFIX="%{l_prefix}" \
90 -A SYSCONFDIR="%{l_prefix}/etc/spamassassin" \
91 -A LOCALRULESDIR="%{l_prefix}/etc/spamassassin" \
92 -A DATADIR="%{l_prefix}/share/spamassassin" \
93 -A PERL_BIN="%{l_prefix}/bin/perl"
95 # build package
96 %{l_make} %{l_mflags -O}
98 %install
99 # install package
100 %{l_make} %{l_mflags} install
102 # install default configuration
103 %{l_shtool} mkdir -f -p -m 755 \
104 $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin
105 %{l_shtool} install -c -m 644 %{l_value -s -a} \
106 %{SOURCE local.cf} \
107 $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin/
109 # create directories for PID file and virtual users
110 %{l_shtool} mkdir -f -p -m 755 \
111 $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin/spool
113 # strip installation
114 chmod u+w $RPM_BUILD_ROOT%{l_prefix}/bin/*
115 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
116 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
118 # install runcommand script
119 %{l_shtool} mkdir -f -p -m 755 \
120 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
121 %{l_shtool} install -c -m 755 %{l_value -s -a} \
122 %{SOURCE rc.spamassassin} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
124 # install OSSP fsl configuration
125 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
126 %{l_shtool} install -c -m 644 %{l_value -s -a} \
127 %{SOURCE fsl.spamassassin} \
128 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
130 # determine installation files
131 %{l_prefix}/bin/perl-openpkg \
132 -F perl-openpkg-files \
133 fixate cleanup
134 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
135 %{l_files_std} \
136 '%config %{l_prefix}/etc/fsl/fsl.spamassassin' \
137 '%config %{l_prefix}/etc/spamassassin/*' \
138 '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/spamassassin' \
139 '%attr(755,%{l_susr},%{l_sgrp}) %{l_prefix}/var/spamassassin/spool' \
140 '%attr(4755,%{l_rusr},%{l_mgrp}) %{l_prefix}/bin/spamc' \
141 `cat perl-openpkg-files`
143 %files -f files
145 %clean
147 %post
148 # after upgrade, restart service
149 [ $1 -eq 2 ] || exit 0
150 eval `%{l_rc} spamassassin status 2>/dev/null`
151 [ ".$spamassassin_active" = .yes ] && %{l_rc} spamassassin restart
152 exit 0
154 %preun
155 # before erase, stop service
156 [ $1 -eq 0 ] || exit 0
157 %{l_rc} spamassassin stop 2>/dev/null
158 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.pid >/dev/null 2>&1 || true
159 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.log* >/dev/null 2>&1 || true
160 exit 0