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 ## davical.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2000-2010 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_opkg 0.9.9.3
26 %define V_davical 0.9.9.3
27 %define V_awl 0.45
29 # package information
30 Name: davical
31 Summary: CalDAV Server
32 URL: http://rscds.sourceforge.net/
33 Vendor: Andrew McMillan
34 Packager: OpenPKG Foundation e.V.
35 Distribution: OpenPKG Community
36 Class: EVAL
37 Group: Network
38 License: GPL
39 Version: %{V_opkg}
40 Release: 20101124
42 # package options
43 %define with_ssl no
45 # list of sources
46 Source0: http://debian.mcmillan.net.nz/packages/davical/davical-%{V_davical}.tar.gz
47 Source1: http://debian.mcmillan.net.nz/packages/awl/awl-%{V_awl}.tar.gz
48 Source2: davical-config.php
49 Source3: davical-apache.conf
50 Source4: davical-setup.sh
51 Source5: rc.davical
52 Patch0: davical.patch
54 # build information
55 Prefix: %{l_prefix}
56 BuildRoot: %{l_buildroot}
57 BuildPreReq: OpenPKG, openpkg >= 20060823
58 PreReq: OpenPKG, openpkg >= 20060823
59 PreReq: pcre, pcre::with_utf8
60 PreReq: apache
61 %if "%{with_ssl}" == "yes"
62 PreReq: apache::with_mod_ssl = yes, x509
63 %endif
64 PreReq: apache-php
65 PreReq: apache-php::with_pgsql = yes
66 PreReq: apache-php::with_gettext = yes
67 PreReq: apache-php::with_iconv = yes
68 PreReq: postgresql
69 PreReq: apg
71 %description
72 The DAViCal CalDAV Server is a repository for calendar, schedule,
73 todo and journal entries which may be accessed with CalDAV capable
74 client software.
76 %track
77 prog davical:davical = {
78 version = %{V_davical}
79 url = http://debian.mcmillan.net.nz/packages/davical/
80 regex = davical-(__VER__)\.tar\.gz
81 }
82 prog davical:awl = {
83 version = %{V_awl}
84 url = http://debian.mcmillan.net.nz/packages/awl/
85 regex = awl_(__VER__)\.tar\.gz
86 }
88 %prep
89 %setup -q -c
90 %setup -q -T -D -a 1
91 %patch -p0
93 %build
94 cd davical-%{V_davical} && %{l_make} %{l_mflags} htdocs/always.php
96 %install
97 # create installation hierarchy
98 %{l_shtool} mkdir -f -p -m 755 \
99 $RPM_BUILD_ROOT%{l_prefix}/sbin \
100 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
101 $RPM_BUILD_ROOT%{l_prefix}/etc/davical \
102 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical \
103 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl \
104 $RPM_BUILD_ROOT%{l_prefix}/var/davical/db \
105 $RPM_BUILD_ROOT%{l_prefix}/var/davical/run \
106 $RPM_BUILD_ROOT%{l_prefix}/var/davical/log
108 # install program components
109 find . -name "*.orig" -print | xargs rm -f
110 cp -r \
111 awl-%{V_awl}/dba \
112 awl-%{V_awl}/inc \
113 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/
114 rm -f davical-%{V_davical}/inc/always.php.in
115 %{l_shtool} subst %{l_value -s -a} \
116 davical-%{V_davical}/htdocs/always.php
117 cp -r \
118 davical-%{V_davical}/dba \
119 davical-%{V_davical}/inc \
120 davical-%{V_davical}/htdocs \
121 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/
123 # install DAViCal application configuration file
124 %{l_shtool} install -c -m 644 %{l_value -s -a} \
125 %{SOURCE davical-config.php} \
126 $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
128 # install DAViCal Apache configuration file
129 %{l_shtool} install -c -m 644 %{l_value -s -a} \
130 %{SOURCE davical-apache.conf} \
131 $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
133 # install run-command script
134 %if "%{with_ssl}" == "yes"
135 with_ssl="-DSSL"
136 %else
137 with_ssl=""
138 %endif
139 %{l_shtool} install -c -m 755 %{l_value -s -a} \
140 -e "s;@with_ssl@;$with_ssl;" \
141 %{SOURCE rc.davical} \
142 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
144 # install RDBMS setup script
145 %{l_shtool} install -c -m 755 %{l_value -s -a} \
146 %{SOURCE davical-setup.sh} \
147 $RPM_BUILD_ROOT%{l_prefix}/sbin/davical-setup
149 # determine installation files
150 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
151 %{l_files_std} \
152 '%config %{l_prefix}/etc/davical/*' \
153 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical' \
154 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical/*'
156 %files -f files
158 %clean
159 rm -rf $RPM_BUILD_ROOT
161 %post
162 if [ $1 -eq 1 ]; then
163 # display final hints on initial installation
164 ( echo "1. To complete this installation of DAViCal please start"
165 echo " PostgreSQL and initialize the DAViCal database like this:"
166 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
167 echo " \$ $RPM_INSTALL_PREFIX/sbin/davical-setup install"
168 echo ""
169 echo "2. By default, DAViCal runs its own SSL/TLS based Apache server"
170 echo " under 127.0.0.1, TCP port 8443. Please change this by editing"
171 echo " the \"Listen 127.0.0.1:8443\" directive in:"
172 echo " $RPM_INSTALL_PREFIX/etc/davical/davical-apache.conf"
173 echo ""
174 echo "3. Now start DAViCal by running the command"
175 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc davical start"
176 echo " and connect with a browser to the URL"
177 %if "%{with_ssl}" == "yes"
178 echo " https://127.0.0.1:8443/"
179 %else
180 echo " https://127.0.0.1:8080/"
181 %endif
182 echo " and create user accounts."
183 echo ""
184 echo "4. Now you are able to subscribe to user \"example\"'s \"home\""
185 echo " calendar with a CalDAV client through the URL"
186 %if "%{with_ssl}" == "yes"
187 echo " https://127.0.0.1:8443/caldav/example/home"
188 %else
189 echo " http://127.0.0.1:8080/caldav/example/home"
190 %endif
191 ) | %{l_rpmtool} msg -b -t notice
192 fi
193 if [ $1 -eq 2 ]; then
194 # after upgrade, restart service
195 eval `%{l_rc} davical status 2>/dev/null`
196 [ ".$davical_active" = .yes ] && %{l_rc} davical restart
197 fi
198 exit 0
200 %preun
201 if [ $1 -eq 0 ]; then
202 # before erase, stop service and remove log files
203 %{l_rc} davical stop 2>/dev/null
204 $RPM_INSTALL_PREFIX/sbin/davical-setup uninstall >/dev/null 2>&1 || true
205 rm -f $RPM_INSTALL_PREFIX/var/davical/log/* >/dev/null 2>&1 || true
206 rm -f $RPM_INSTALL_PREFIX/var/davical/run/* >/dev/null 2>&1 || true
207 rm -f $RPM_INSTALL_PREFIX/var/davical/db/* >/dev/null 2>&1 || true
208 fi
209 exit 0