Fri, 03 Aug 2012 16:45:20 +0200
Ignore underlying platform provided curses(3), prefering ncurses(3).
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.1
26 %define V_here 3.3.1
27 %define V_sdir 3.3.1
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: 20110914
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.gz
47 Source1: rc.spamassassin
48 Source2: local.cf
49 Source3: fsl.spamassassin
50 Patch0: spamassassin.patch
52 # build information
53 Prefix: %{l_prefix}
54 BuildRoot: %{l_buildroot}
55 BuildPreReq: OpenPKG, openpkg >= 20060823, perl, perl-openpkg >= 5.8.4, make
56 PreReq: OpenPKG, openpkg >= 20060823, perl, gnupg
57 BuildPreReq: perl-db, perl-crypto, perl-xml, perl-dns, perl-locale, perl-www
58 PreReq: perl-db, perl-crypto, perl-xml, perl-dns, perl-locale, perl-www
59 %if "%{with_fsl}" == "yes"
60 BuildPreReq: fsl
61 PreReq: fsl
62 %endif
63 AutoReq: no
64 AutoReqProv: no
66 %description
67 SpamAssassin provides you with a way to reduce if not completely
68 eliminate Unsolicited Commercial Email (UCE, aka SPAM) from your
69 incoming email. It uses a genetic-algorithm evolved scoring system
70 to identify messages which look spammy, then adds headers to the
71 message so they can be filtered by the user's mail reading software.
72 This distribution includes the spamd/spamc components which create a
73 server that considerably speeds processing of mail.
75 %track
76 prog spamassassin = {
77 version = %{V_real}
78 url = http://www.apache.org/dist/spamassassin/source/
79 regex = Mail-SpamAssassin-(\d+\.\d+\.\d+)\.tar\.gz
80 }
82 %prep
83 %setup -q -n Mail-SpamAssassin-%{V_sdir}
84 %patch -p0
86 %build
87 # configure package
88 %{l_prefix}/bin/perl-openpkg prepare
89 export CC="%{l_cc}"
90 export CFLAGS="%{l_cflags -O} -Ispamc %{l_cppflags}"
91 export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}"
92 export LIBS="%{l_ldflags} %{l_fsl_ldflags} %{l_fsl_libs}"
93 %{l_prefix}/bin/perl-openpkg configure \
94 -A DESTDIR="$RPM_BUILD_ROOT" \
95 -A PREFIX="%{l_prefix}" \
96 -A SYSCONFDIR="%{l_prefix}/etc/spamassassin" \
97 -A LOCALRULESDIR="%{l_prefix}/etc/spamassassin" \
98 -A DATADIR="%{l_prefix}/share/spamassassin" \
99 -A PERL_BIN="%{l_prefix}/bin/perl"
101 # build package
102 %{l_make} %{l_mflags}
104 %install
105 rm -rf $RPM_BUILD_ROOT
107 # install package
108 %{l_make} %{l_mflags} install
110 # install default configuration
111 %{l_shtool} mkdir -f -p -m 755 \
112 $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin
113 %{l_shtool} install -c -m 644 %{l_value -s -a} \
114 %{SOURCE local.cf} \
115 $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin/
117 # create directories for PID file and virtual users
118 %{l_shtool} mkdir -f -p -m 755 \
119 $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin/spool
121 # strip installation
122 chmod u+w $RPM_BUILD_ROOT%{l_prefix}/bin/*
123 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
124 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
126 # install runcommand script
127 %{l_shtool} mkdir -f -p -m 755 \
128 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
129 %{l_shtool} install -c -m 755 %{l_value -s -a} \
130 %{SOURCE rc.spamassassin} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
132 # install OSSP fsl configuration
133 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
134 %{l_shtool} install -c -m 644 %{l_value -s -a} \
135 %{SOURCE fsl.spamassassin} \
136 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
138 # determine installation files
139 %{l_prefix}/bin/perl-openpkg \
140 -F perl-openpkg-files \
141 fixate cleanup
142 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
143 %{l_files_std} \
144 '%config %{l_prefix}/etc/fsl/fsl.spamassassin' \
145 '%config %{l_prefix}/etc/spamassassin/*' \
146 '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/spamassassin' \
147 '%attr(755,%{l_susr},%{l_sgrp}) %{l_prefix}/var/spamassassin/spool' \
148 '%attr(4755,%{l_rusr},%{l_mgrp}) %{l_prefix}/bin/spamc' \
149 `cat perl-openpkg-files`
151 %files -f files
153 %clean
154 rm -rf $RPM_BUILD_ROOT
156 %post
157 # after upgrade, restart service
158 [ $1 -eq 2 ] || exit 0
159 eval `%{l_rc} spamassassin status 2>/dev/null`
160 [ ".$spamassassin_active" = .yes ] && %{l_rc} spamassassin restart
161 exit 0
163 %preun
164 # before erase, stop service
165 [ $1 -eq 0 ] || exit 0
166 %{l_rc} spamassassin stop 2>/dev/null
167 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.pid >/dev/null 2>&1 || true
168 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.log* >/dev/null 2>&1 || true
169 exit 0