Thu, 23 Apr 2009 15:16:09 +0200
Import package vendor original specs for necessary manipulations.
1 ##
2 ## spamassassin.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2009 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.2.5
26 %define V_here 3.2.5
27 %define V_sdir 3.2.5
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: 20090420
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
51 # build information
52 Prefix: %{l_prefix}
53 BuildRoot: %{l_buildroot}
54 BuildPreReq: OpenPKG, openpkg >= 20060823, perl, perl-openpkg >= 5.8.4, make
55 PreReq: OpenPKG, openpkg >= 20060823, perl
56 BuildPreReq: perl-db, perl-crypto, perl-xml, perl-dns
57 PreReq: perl-db, perl-crypto, perl-xml, perl-dns
58 %if "%{with_fsl}" == "yes"
59 BuildPreReq: fsl
60 PreReq: fsl
61 %endif
62 AutoReq: no
63 AutoReqProv: no
65 %description
66 SpamAssassin provides you with a way to reduce if not completely
67 eliminate Unsolicited Commercial Email (UCE, aka SPAM) from your
68 incoming email. It uses a genetic-algorithm evolved scoring system
69 to identify messages which look spammy, then adds headers to the
70 message so they can be filtered by the user's mail reading software.
71 This distribution includes the spamd/spamc components which create a
72 server that considerably speeds processing of mail.
74 %track
75 prog spamassassin = {
76 version = %{V_real}
77 url = http://www.apache.org/dist/spamassassin/source/
78 regex = Mail-SpamAssassin-(\d+\.\d+\.\d+)\.tar\.gz
79 }
81 %prep
82 %setup -q -n Mail-SpamAssassin-%{V_sdir}
84 %build
85 # configure package
86 %{l_prefix}/bin/perl-openpkg prepare
87 export CC="%{l_cc}"
88 export CFLAGS="%{l_cflags -O} -Ispamc %{l_cppflags}"
89 export LDFLAGS="%{l_ldflags} %{l_fsl_ldflags}"
90 export LIBS="%{l_ldflags} %{l_fsl_ldflags} %{l_fsl_libs}"
91 %{l_prefix}/bin/perl-openpkg configure \
92 -A DESTDIR="$RPM_BUILD_ROOT" \
93 -A PREFIX="%{l_prefix}" \
94 -A SYSCONFDIR="%{l_prefix}/etc/spamassassin" \
95 -A LOCALRULESDIR="%{l_prefix}/etc/spamassassin" \
96 -A DATADIR="%{l_prefix}/share/spamassassin" \
97 -A PERL_BIN="%{l_prefix}/bin/perl"
99 # build package
100 %{l_make} %{l_mflags}
102 %install
103 rm -rf $RPM_BUILD_ROOT
105 # install package
106 %{l_make} %{l_mflags} install
108 # install default configuration
109 %{l_shtool} mkdir -f -p -m 755 \
110 $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin
111 %{l_shtool} install -c -m 644 %{l_value -s -a} \
112 %{SOURCE local.cf} \
113 $RPM_BUILD_ROOT%{l_prefix}/etc/spamassassin/
115 # create directory for PID file
116 %{l_shtool} mkdir -f -p -m 755 \
117 $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin
119 # strip installation
120 chmod u+w $RPM_BUILD_ROOT%{l_prefix}/bin/*
121 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
122 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
124 # install run-command script
125 %{l_shtool} mkdir -f -p -m 755 \
126 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
127 %{l_shtool} install -c -m 755 %{l_value -s -a} \
128 %{SOURCE rc.spamassassin} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
130 # install OSSP fsl configuration
131 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
132 %{l_shtool} install -c -m 644 %{l_value -s -a} \
133 %{SOURCE fsl.spamassassin} \
134 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
136 # determine installation files
137 %{l_prefix}/bin/perl-openpkg \
138 -F perl-openpkg-files \
139 fixate cleanup
140 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
141 %{l_files_std} \
142 '%config %{l_prefix}/etc/fsl/fsl.spamassassin' \
143 '%config %{l_prefix}/etc/spamassassin/*' \
144 '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/spamassassin' \
145 '%attr(4755,%{l_rusr},%{l_mgrp}) %{l_prefix}/bin/spamc' \
146 `cat perl-openpkg-files`
148 %files -f files
150 %clean
151 rm -rf $RPM_BUILD_ROOT
153 %post
154 # after upgrade, restart service
155 [ $1 -eq 2 ] || exit 0
156 eval `%{l_rc} spamassassin status 2>/dev/null`
157 [ ".$spamassassin_active" = .yes ] && %{l_rc} spamassassin restart
158 exit 0
160 %preun
161 # before erase, stop service
162 [ $1 -eq 0 ] || exit 0
163 %{l_rc} spamassassin stop 2>/dev/null
164 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.pid >/dev/null 2>&1 || true
165 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.log* >/dev/null 2>&1 || true
166 exit 0