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 ## mailman.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2008 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 information
25 Name: mailman
26 Summary: Mailing List Management System
27 URL: http://www.list.org/
28 Vendor: John Viega et al.
29 Packager: OpenPKG Foundation e.V.
30 Distribution: OpenPKG Community
31 Class: EVAL
32 Group: Mail
33 License: GPL
34 Version: 2.1.11
35 Release: 20090420
37 # list of sources
38 Source0: http://switch.dl.sourceforge.net/mailman/mailman-%{version}.tgz
39 Source1: manpages.tar.gz
40 Source2: mailman-sendmail.m4
41 Source3: mailman-apache.conf
42 Source4: rc.mailman
43 Patch0: mailman.patch
45 # build information
46 Prefix: %{l_prefix}
47 BuildRoot: %{l_buildroot}
48 BuildPreReq: OpenPKG, openpkg >= 20060823, python, make
49 PreReq: OpenPKG, openpkg >= 20060823, python, MTA
50 AutoReq: no
51 AutoReqProv: no
53 %description
54 Mailman is software to help manage email discussion lists, much
55 like Majordomo and Smartmail. Unlike most similar products, Mailman
56 gives each mailing list a webpage, and allows users to subscribe,
57 unsubscribe, etc. over the Web. Even the list manager can administer
58 his or her list entirely from the Web. Mailman also integrates most
59 things people want to do with mailing lists, including archiving,
60 mail/news gateways, and so on.
62 %track
63 prog mailman = {
64 version = %{version}
65 url = http://prdownloads.sourceforge.net/mailman/
66 regex = mailman-(\d+\.\d+\.\d+)\.tgz
67 }
69 %prep
70 %setup -q
71 %setup -q -D -T -a 1
72 %patch -p0
74 %build
75 # configure package
76 CC="%{l_cc}" \
77 CFLAGS="%{l_cflags -O}" \
78 CPPFLAGS="%{l_cppflags}" \
79 LDFLAGS="%{l_ldflags}" \
80 ./configure \
81 --prefix=%{l_prefix}/libexec/mailman \
82 --exec-prefix=%{l_prefix}/libexec/mailman \
83 --sysconfdir=%{l_prefix}/etc/mailman \
84 --with-var-prefix=%{l_prefix}/var/mailman \
85 --with-username=%{l_nusr} \
86 --with-groupname=%{l_ngrp} \
87 --with-cgi-gid=%{l_ngrp} \
88 --with-mail-gid=%{l_ngrp} \
89 --with-cgi-ext="" \
90 --with-urlhost="localhost" \
91 --with-mailhost="localhost" \
92 --without-permcheck \
93 --enable-static
95 # build package
96 %{l_make} %{l_mflags -O}
98 %install
99 # install package
100 rm -rf $RPM_BUILD_ROOT
101 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT DIRSETGID=true
103 # create additional directories
104 %{l_shtool} mkdir -f -p -m 755 \
105 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
106 $RPM_BUILD_ROOT%{l_prefix}/etc/mailman \
107 $RPM_BUILD_ROOT%{l_prefix}/man/man8
109 # strip down installation tree
110 rm -rf $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/tests
112 # install Sendmail mailer handler
113 %{l_shtool} install -c -m 755 \
114 -e 's;#!/usr/local/bin/perl;#!%{l_prefix}/bin/perl;' \
115 -e 's;/home/mailman/mail/mailman;%{l_prefix}/libexec/mailman/mail/mailman;' \
116 -e 's;/home/mailman/lists;%{l_prefix}/var/mailman/lists;' \
117 -e 's;/usr/lib/sendmail;%{l_prefix}/sbin/sendmail;' \
118 contrib/mm-handler \
119 $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/mail/mailman-sendmail
121 # install Apache and Sendmail configurations
122 %{l_shtool} install -c -m 644 %{l_value -s -a} \
123 %{SOURCE mailman-sendmail.m4} %{SOURCE mailman-apache.conf} \
124 $RPM_BUILD_ROOT%{l_prefix}/etc/mailman/
126 # install manual pages
127 %{l_shtool} install -c -m 644 \
128 man8/*.8 $RPM_BUILD_ROOT%{l_prefix}/man/man8/
130 # post-adjust default configuration
131 mv $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/Mailman/mm_cfg.py \
132 $RPM_BUILD_ROOT%{l_prefix}/etc/mailman/mailman.cfg
133 ln -s %{l_prefix}/etc/mailman/mailman.cfg \
134 $RPM_BUILD_ROOT%{l_prefix}/libexec/mailman/Mailman/mm_cfg.py
135 ( echo ""
136 echo "DEFAULT_EMAIL_HOST = 'host.example.com'"
137 echo "DEFAULT_URL_HOST = 'host.example.com'"
138 echo "IMAGE_LOGOS = '/mailman/icons/'"
139 echo "PUBLIC_ARCHIVE_URL = '/mailman/pipermail/%%(listname)s'"
140 echo "MAILMAN_USER = '%{l_nusr}'"
141 echo "MAILMAN_GROUP = '%{l_ngrp}'"
142 echo "DEFAULT_SERVER_LANGUAGE = 'en'"
143 echo "VERP_PASSWORD_REMINDERS = 1"
144 echo "VERP_PERSONALIZED_DELIVERIES = 1"
145 echo "VERP_CONFIRMATIONS = 1"
146 echo "VERP_DELIVERY_INTERVAL = 1"
147 echo ""
148 echo "# For available options and their descriptions see:"
149 echo "# %{l_prefix}/libexec/mailman/Mailman/Defaults.py"
150 echo ""
151 ) >>$RPM_BUILD_ROOT%{l_prefix}/etc/mailman/mailman.cfg
153 # install run-command script
154 %{l_shtool} install -c -m 755 %{l_value -s -a} \
155 %{SOURCE rc.mailman} ${RPM_BUILD_ROOT}%{l_prefix}/etc/rc.d/
157 # avoid root permissions on log file creation
158 touch ${RPM_BUILD_ROOT}%{l_prefix}/var/mailman/logs/error
160 # determine installation files
161 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
162 %{l_files_std} \
163 '%dir %attr(2700,%{l_nusr},%{l_mgrp}) %{l_prefix}/libexec/mailman/mail/mailman-sendmail' \
164 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman' \
165 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/logs' \
166 '%dir %attr(644,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/logs/*' \
167 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/spam' \
168 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/qfiles' \
169 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/locks' \
170 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/lists' \
171 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/archives' \
172 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/archives/*' \
173 '%dir %attr(2775,%{l_nusr},%{l_mgrp}) %{l_prefix}/var/mailman/data' \
174 '%config %attr(0640,%{l_nusr},%{l_mgrp}) %{l_prefix}/etc/mailman/mailman.cfg' \
175 '%config %{l_prefix}/etc/mailman/*'
177 %files -f files
179 %clean
180 rm -rf $RPM_BUILD_ROOT
182 %post
183 # add hook to MTA configuration
184 if [ $1 -eq 1 ]; then
185 aliases_file=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_file`
186 update_command=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_update`
187 if [ ".$aliases_file" != . ]; then
188 ( echo "mailman: postmaster"
189 echo "mailman-owner: postmaster"
190 ) |\
191 $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
192 -a -i "$RPM_INSTALL_PREFIX:mailman" $aliases_file
193 fi
194 if [ ".$update_command" != . ]; then
195 eval $update_command
196 fi
197 fi
199 # after upgrade, restart service
200 [ $1 -eq 2 ] || exit 0
201 $RPM_INSTALL_PREFIX/libexec/mailman/bin/update
202 eval `%{l_rc} mailman status 2>/dev/null`
203 [ ".$mailman_active" = .yes ] && %{l_rc} mailman restart
204 exit 0
206 %preun
207 # before erase, stop service (and remove files)
208 [ $1 -eq 0 ] || exit 0
209 rm -f $RPM_INSTALL_PREFIX/libexec/mailman/bin/paths.pyc >/dev/null 2>&1 || true
210 rm -f $RPM_INSTALL_PREFIX/libexec/mailman/cron/paths.pyc >/dev/null 2>&1 || true
211 rm -f $RPM_INSTALL_PREFIX/libexec/mailman/scripts/paths.pyc >/dev/null 2>&1 || true
212 %{l_rc} mailman stop 2>/dev/null
213 exit 0
215 %postun
216 # remove hook from MTA configuration
217 [ $1 -eq 0 ] || exit 0
218 aliases_file=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_file`
219 update_command=`$RPM_INSTALL_PREFIX/bin/openpkg rc --query MTA_aliases_update`
220 if [ ".$aliases_file" != . ]; then
221 $RPM_INSTALL_PREFIX/lib/openpkg/rpmtool config \
222 -r -i "$RPM_INSTALL_PREFIX:mailman" $aliases_file
223 fi
224 if [ ".$update_command" != . ]; then
225 eval $update_command
226 fi