Mon, 22 Nov 2010 16:49:03 +0100
Correct processing and location of a most important source file.
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.37
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: 20101122
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: postgresql
68 PreReq: apg
70 %description
71 The DAViCal CalDAV Server is a repository for calendar, schedule,
72 todo and journal entries which may be accessed with CalDAV capable
73 client software.
75 %track
76 prog davical:davical = {
77 version = %{V_davical}
78 url = http://debian.mcmillan.net.nz/packages/davical/
79 regex = davical-(__VER__)\.tar\.gz
80 }
81 prog davical:awl = {
82 version = %{V_awl}
83 url = http://debian.mcmillan.net.nz/packages/awl/
84 regex = awl_(__VER__)\.tar\.gz
85 }
87 %prep
88 %setup -q -c
89 %setup -q -T -D -a 1
90 %patch -p0
92 %build
93 cd davical-%{V_davical} && %{l_make} %{l_mflags} htdocs/always.php
95 %install
96 # create installation hierarchy
97 %{l_shtool} mkdir -f -p -m 755 \
98 $RPM_BUILD_ROOT%{l_prefix}/sbin \
99 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
100 $RPM_BUILD_ROOT%{l_prefix}/etc/davical \
101 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical \
102 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl \
103 $RPM_BUILD_ROOT%{l_prefix}/var/davical/db \
104 $RPM_BUILD_ROOT%{l_prefix}/var/davical/run \
105 $RPM_BUILD_ROOT%{l_prefix}/var/davical/log
107 # install program components
108 find . -name "*.orig" -print | xargs rm -f
109 cp -r \
110 awl-%{V_awl}/dba \
111 awl-%{V_awl}/inc \
112 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/awl/
113 rm -f davical-%{V_davical}/inc/always.php.in
114 %{l_shtool} subst %{l_value -s -a} \
115 davical-%{V_davical}/htdocs/always.php
116 cp -r \
117 davical-%{V_davical}/dba \
118 davical-%{V_davical}/inc \
119 davical-%{V_davical}/htdocs \
120 $RPM_BUILD_ROOT%{l_prefix}/lib/davical/davical/
122 # install DAViCal application configuration file
123 %{l_shtool} install -c -m 644 %{l_value -s -a} \
124 %{SOURCE davical-config.php} \
125 $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
127 # install DAViCal Apache configuration file
128 %{l_shtool} install -c -m 644 %{l_value -s -a} \
129 %{SOURCE davical-apache.conf} \
130 $RPM_BUILD_ROOT%{l_prefix}/etc/davical/
132 # install run-command script
133 %if "%{with_ssl}" == "yes"
134 with_ssl="-DSSL"
135 %else
136 with_ssl=""
137 %endif
138 %{l_shtool} install -c -m 755 %{l_value -s -a} \
139 -e "s;@with_ssl@;$with_ssl;" \
140 %{SOURCE rc.davical} \
141 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
143 # install RDBMS setup script
144 %{l_shtool} install -c -m 755 %{l_value -s -a} \
145 %{SOURCE davical-setup.sh} \
146 $RPM_BUILD_ROOT%{l_prefix}/sbin/davical-setup
148 # determine installation files
149 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
150 %{l_files_std} \
151 '%config %{l_prefix}/etc/davical/*' \
152 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical' \
153 '%attr(-,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/davical/*'
155 %files -f files
157 %clean
158 rm -rf $RPM_BUILD_ROOT
160 %post
161 if [ $1 -eq 1 ]; then
162 # display final hints on initial installation
163 ( echo "1. To complete this installation of DAViCal please start"
164 echo " PostgreSQL and initialize the DAViCal database like this:"
165 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc postgresql start"
166 echo " \$ $RPM_INSTALL_PREFIX/sbin/davical-setup install"
167 echo ""
168 echo "2. By default, DAViCal runs its own SSL/TLS based Apache server"
169 echo " under 127.0.0.1, TCP port 8443. Please change this by editing"
170 echo " the \"Listen 127.0.0.1:8443\" directive in:"
171 echo " $RPM_INSTALL_PREFIX/etc/davical/davical-apache.conf"
172 echo ""
173 echo "3. Now start DAViCal by running the command"
174 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc davical start"
175 echo " and connect with a browser to the URL"
176 %if "%{with_ssl}" == "yes"
177 echo " https://127.0.0.1:8443/"
178 %else
179 echo " https://127.0.0.1:8080/"
180 %endif
181 echo " and create user accounts."
182 echo ""
183 echo "4. Now you are able to subscribe to user \"example\"'s \"home\""
184 echo " calendar with a CalDAV client through the URL"
185 %if "%{with_ssl}" == "yes"
186 echo " https://127.0.0.1:8443/caldav/example/home"
187 %else
188 echo " http://127.0.0.1:8080/caldav/example/home"
189 %endif
190 ) | %{l_rpmtool} msg -b -t notice
191 fi
192 if [ $1 -eq 2 ]; then
193 # after upgrade, restart service
194 eval `%{l_rc} davical status 2>/dev/null`
195 [ ".$davical_active" = .yes ] && %{l_rc} davical restart
196 fi
197 exit 0
199 %preun
200 if [ $1 -eq 0 ]; then
201 # before erase, stop service and remove log files
202 %{l_rc} davical stop 2>/dev/null
203 $RPM_INSTALL_PREFIX/sbin/davical-setup uninstall >/dev/null 2>&1 || true
204 rm -f $RPM_INSTALL_PREFIX/var/davical/log/* >/dev/null 2>&1 || true
205 rm -f $RPM_INSTALL_PREFIX/var/davical/run/* >/dev/null 2>&1 || true
206 rm -f $RPM_INSTALL_PREFIX/var/davical/db/* >/dev/null 2>&1 || true
207 fi
208 exit 0