Tue, 29 Mar 2011 20:04:34 +0200
Rework package yet again, correcting and introducing new buildconf logic:
Conditionally disable bootstrap stage comparison correctly, correct
english grammar, better find system as(1) and ld(1), indotruce detailed
optimization option messages, more completely guess cpu types, allow
profiled bootstrapping without a preinstalled GCC because many other
compilers have long since implemented 64-bit arithmetic, instruct make
to build sequentially (not in sparallel) when building a profiled
bootstrap as GCC online documents recommend, and generally improve
comment blocks.
The single most important correction in this changeset relates to the
GCC changed optimization policy since at least GCC 4.5, in which -march
is always passed and not always correctly guessed. In the case of this
package, allowing GCC to guess the architecture leads to wild build
errors at various subcomponents (zlib, libgcc, libiberty...) and
bootstrap stages. It seems quite platform specific, and the safest
approach to correcting this seems to be explicitly always specifying the
-march argument when bootstrapping GCC. Because the best choice 'native'
is not available when bootstrapping using a foreign (non GCC) compiler,
a guess is made according to rpmmacros l_platform in that case.
It is questionable as to whether these recent optimization changes
on the part of GCC or this package are compatible with each other,
or if either are complete or correct at all. At least applying these
corrections allows this package to build again in most cases test.
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 directories for PID file and virtual users
116 %{l_shtool} mkdir -f -p -m 755 \
117 $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin \
118 $RPM_BUILD_ROOT%{l_prefix}/var/spamassassin/spool
120 # strip installation
121 chmod u+w $RPM_BUILD_ROOT%{l_prefix}/bin/*
122 strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
123 rm -rf $RPM_BUILD_ROOT%{l_prefix}/man/man3
125 # install runcommand script
126 %{l_shtool} mkdir -f -p -m 755 \
127 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
128 %{l_shtool} install -c -m 755 %{l_value -s -a} \
129 %{SOURCE rc.spamassassin} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
131 # install OSSP fsl configuration
132 %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
133 %{l_shtool} install -c -m 644 %{l_value -s -a} \
134 %{SOURCE fsl.spamassassin} \
135 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
137 # determine installation files
138 %{l_prefix}/bin/perl-openpkg \
139 -F perl-openpkg-files \
140 fixate cleanup
141 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
142 %{l_files_std} \
143 '%config %{l_prefix}/etc/fsl/fsl.spamassassin' \
144 '%config %{l_prefix}/etc/spamassassin/*' \
145 '%attr(775,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/spamassassin' \
146 '%attr(755,%{l_susr},%{l_sgrp}) %{l_prefix}/var/spamassassin/spool' \
147 '%attr(4755,%{l_rusr},%{l_mgrp}) %{l_prefix}/bin/spamc' \
148 `cat perl-openpkg-files`
150 %files -f files
152 %clean
153 rm -rf $RPM_BUILD_ROOT
155 %post
156 # after upgrade, restart service
157 [ $1 -eq 2 ] || exit 0
158 eval `%{l_rc} spamassassin status 2>/dev/null`
159 [ ".$spamassassin_active" = .yes ] && %{l_rc} spamassassin restart
160 exit 0
162 %preun
163 # before erase, stop service
164 [ $1 -eq 0 ] || exit 0
165 %{l_rc} spamassassin stop 2>/dev/null
166 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.pid >/dev/null 2>&1 || true
167 rm -f $RPM_INSTALL_PREFIX/var/spamassassin/*.log* >/dev/null 2>&1 || true
168 exit 0