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 ## bacula.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 # MSvB:
25 # MSvB: Note, see http://www.bacula.org/en/?page=news
26 # MSvB: for information on new configuration options.
27 # MSvB: Warning! -L /pfx/lib is placed before locally
28 # MSvB: built libraries (bacula-<ver>/src/cats...)
29 # MSvB: which causes the old version of bacula to
30 # MSvB: supply logic to the new version build!
31 # MSvB:
33 # package information
34 Name: bacula
35 Summary: Network Backup Tool
36 URL: http://www.bacula.org/
37 Vendor: Kern Sibbald
38 Packager: OpenPKG Foundation e.V.
39 Distribution: OpenPKG Community
40 Class: PLUS
41 Group: System
42 License: GPL
43 Version: 3.0.3
44 Release: 20091028
46 # package options
47 %option with_server yes
48 %option with_ssl yes
49 %option with_wrap no
50 %option with_dvd no
51 %option with_mtx no
52 %option with_python no
53 %option with_dbback sqlite
55 # list of sources
56 Source0: http://switch.dl.sourceforge.net/bacula/bacula-%{version}.tar.gz
57 Source1: rc.bacula
58 Source2: bexec.sh
59 Patch0: bacula.patch
61 # build information
62 Prefix: %{l_prefix}
63 BuildRoot: %{l_buildroot}
64 BuildPreReq: OpenPKG, openpkg >= 20060823, make, gcc, gcc::with_cxx = yes
65 PreReq: OpenPKG, openpkg >= 20060823
66 BuildPreReq: ncurses, readline, zlib, gawk
67 PreReq: ncurses, readline, zlib, gawk
68 %if "%{with_ssl}" == "yes"
69 BuildPreReq: openssl >= 0.9.8, openssl::with_threads = yes
70 PreReq: openssl >= 0.9.8, openssl::with_threads = yes
71 %endif
72 %if "%{with_wrap}" == "yes"
73 BuildPreReq: tcpwrappers
74 PreReq: tcpwrappers
75 %endif
76 %if "%{with_dbback}" == "sqlite"
77 BuildPreReq: sqlite
78 PreReq: sqlite
79 %endif
80 %if "%{with_dbback}" == "mysql"
81 BuildPreReq: mysql
82 PreReq: mysql
83 %endif
84 %if "%{with_dbback}" == "postgresql"
85 BuildPreReq: postgresql
86 PreReq: postgresql
87 %endif
88 %if "%{with_dvd}" == "yes"
89 BuildPreReq: dvdrw-tools
90 PreReq: dvdrw-tools
91 %endif
92 %if "%{with_mtx}" == "yes"
93 BuildPreReq: mtx
94 PreReq: mtx
95 %endif
96 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
97 BuildPreReq: python
98 PreReq: python
99 %endif
100 AutoReq: no
101 AutoReqProv: no
103 %description
104 Bacula is a set of computer programs that permit you (or the system
105 administrator) to manage backup, recovery, and verification of
106 computer data across a network of computers of different kinds. In
107 technical terms, it is a network client/server based backup program.
108 Bacula is relatively easy to use and efficient, while offering many
109 advanced storage management features that make it easy to find and
110 recover lost or damaged files.
112 %track
113 prog bacula = {
114 version = %{version}
115 url = http://prdownloads.sourceforge.net/bacula/
116 regex = bacula-(\d+\.\d*[02468]\.\d+)\.tar\.gz
117 }
119 %prep
120 %setup -q
121 %patch -p0
122 rm -f src/lib/tcpd.h
124 %build
125 # generate a random director password
126 password="`openssl rand -base64 33`"
128 # for the same reason remove version informations from config files
129 %{l_shtool} subst \
130 -e "s;For Bacula release @VERSION@ .*;;" \
131 `find . -name "*.conf.in"`
133 # help specific platforms find fdatasync(3)
134 libs=""
135 case "%{l_platform -t}" in
136 *-sunos* ) libs="-lrt" ;;
137 esac
139 # use localhost as default host
140 %{l_shtool} subst \
141 -e 's;hostname=.*;hostname=localhost;g' \
142 -e 's;\(CONS_LIBS="-lreadline.*\)-ltermcap;\1-lncurses;g' \
143 configure
145 # configure
146 LIBS=
147 case "%{l_platform -t}" in
148 *-linux*) LIBS="-L/usr/lib/termcap";;
149 esac
150 CC="%{l_cc}" \
151 CFLAGS="%{l_cflags -O}" \
152 CPPFLAGS="%{l_cppflags ncurses}" \
153 LDFLAGS="%{l_ldflags} $LIBS" \
154 LIBS="$libs" \
155 GREP="grep" \
156 ./configure \
157 --prefix=%{l_prefix} \
158 --with-dir-user=%{l_rusr} \
159 --with-dir-group=%{l_rgrp} \
160 --with-sd-user=%{l_rusr} \
161 --with-sd-group=%{l_rgrp} \
162 --with-fd-user=%{l_susr} \
163 --with-fd-group=%{l_sgrp} \
164 --with-dir-password="$password" \
165 --with-fd-password="$password" \
166 --with-sd-password="$password" \
167 --with-mon-dir-password="$password" \
168 --with-mon-fd-password="$password" \
169 --with-mon-sd-password="$password" \
170 --disable-conio \
171 --enable-readline \
172 --with-readline=%{l_prefix} \
173 %if "%{with_server}" != "yes"
174 --enable-client-only \
175 %endif
176 %if "%{with_ssl}" == "yes"
177 --with-openssl=%{l_prefix} \
178 %endif
179 %if "%{with_wrap}" == "yes"
180 --with-tcp-wrappers=yes \
181 %endif
182 %if "%{with_dbback}" == "sqlite"
183 --with-sqlite3=%{l_prefix} \
184 %endif
185 %if "%{with_dbback}" == "mysql"
186 --with-mysql=%{l_prefix} \
187 %endif
188 %if "%{with_dbback}" == "postgresql"
189 --with-postgresql=%{l_prefix} \
190 %endif
191 %if "%{with_python}" == "yes" || "%{with_dvd}" == "yes"
192 --with-python=%{l_prefix} \
193 %endif
194 --enable-wx-console=no \
195 --sysconfdir=%{l_prefix}/etc/bacula \
196 --libexecdir=%{l_prefix}/libexec/bacula \
197 --mandir=%{l_prefix}/man \
198 --with-scriptdir=%{l_prefix}/libexec/bacula \
199 --with-working-dir=%{l_prefix}/var/bacula \
200 --with-pid-dir=%{l_prefix}/var/bacula/run \
201 --with-subsys-dir=%{l_prefix}/var/bacula/run/subsys \
202 --with-archivedir=/tmp \
203 --with-sbin-perm=0755 \
204 --disable-shared \
205 --disable-libtool \
206 --disable-nls
208 # build
209 %{l_make} %{l_mflags -O}
211 %install
212 rm -rf $RPM_BUILD_ROOT
214 # create installation hierarchy
215 %{l_shtool} mkdir -f -p -m 755 \
216 $RPM_BUILD_ROOT%{l_prefix}/bin \
217 $RPM_BUILD_ROOT%{l_prefix}/sbin \
218 $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula \
219 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula \
220 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/clients \
221 $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/scripts \
222 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
223 $RPM_BUILD_ROOT%{l_prefix}/var/bacula \
224 $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run \
225 $RPM_BUILD_ROOT%{l_prefix}/var/bacula/run/subsys \
226 $RPM_BUILD_ROOT%{l_prefix}/man/man1 \
227 $RPM_BUILD_ROOT%{l_prefix}/man/man8
229 # install
230 %{l_make} %{l_mflags} install DESTDIR=$RPM_BUILD_ROOT
232 # strip down installation
233 strip $RPM_BUILD_ROOT%{l_prefix}/sbin/* 2>/dev/null || true
234 ( cd $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula &&
235 for unwanted in startmysql stopmysql; do
236 rm -f $unwanted
237 done
238 ) || exit $?
240 # install additional files
241 %{l_shtool} install -c -m 754 %{l_value -s -a} \
242 %{SOURCE bexec.sh} $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec
243 %{l_shtool} install -c -m 640 \
244 src/console/bconsole.conf $RPM_BUILD_ROOT%{l_prefix}/etc/bacula/
246 ## wrap binaries to avoid to specify "-c" for each run
247 #( cd $RPM_BUILD_ROOT%{l_prefix}/sbin
248 # for bin in bacula-dir bacula-fd bacula-sd \
249 # bconsole bcopy bextract bls bscan dbcheck \
250 # tray-monitor wx-console; do
251 # if [ -x $bin ]; then
252 # mv $bin $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula
253 # ln $RPM_BUILD_ROOT%{l_prefix}/libexec/bacula/bexec ./$bin
254 # fi
255 # done
256 #) || exit $?
258 # install runcommand script
259 %{l_shtool} install -c -m 755 %{l_value -s -a} \
260 -e 's,@with_server@,%{with_server},g' \
261 %{SOURCE rc.bacula} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
263 # determine installation files
264 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
265 %{l_files_std} \
266 '%config(noreplace) %{l_prefix}/etc/bacula/*.conf' \
267 %if "%{with_server}" == "yes"
268 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-dir.conf' \
269 '%attr(-,%{l_musr},%{l_rgrp}) %config(noreplace) %{l_prefix}/etc/bacula/bacula-sd.conf' \
270 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/delete_catalog_backup' \
271 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/make_catalog_backup' \
272 %endif
273 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/dvd-handler' \
274 '%attr(-,%{l_musr},%{l_rgrp}) %{l_prefix}/libexec/bacula/mtx-changer' \
275 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run/subsys' \
276 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula/run' \
277 '%attr(700,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/bacula'
279 %files -f files
281 %clean
282 rm -rf $RPM_BUILD_ROOT
284 %post
285 # create initial database
286 if [ ! -f $RPM_INSTALL_PREFIX/var/bacula/bacula.db ]; then
287 $RPM_INSTALL_PREFIX/libexec/bacula/make_bacula_tables
288 chmod 600 $RPM_INSTALL_PREFIX/var/bacula/bacula.db
289 chown %{l_rusr}:%{l_rgrp} $RPM_INSTALL_PREFIX/var/bacula/bacula.db
290 fi
292 # after upgrade, restart service
293 [ $1 -eq 2 ] || exit 0
294 eval `%{l_rc} bacula status 2>/dev/null`
295 [ ".$bacula_active" = .yes ] && %{l_rc} bacula restart
296 exit 0
298 %preun
299 # before erase, stop service and remove working files
300 [ $1 -eq 0 ] || exit 0
301 %{l_rc} bacula stop 2>/dev/null
302 rm -rf $RPM_INSTALL_PREFIX/var/bacula/*
303 exit 0