Thu, 18 Oct 2012 12:53:06 +0200
Refine specification, using other PHP dependent web packages as reference.
1 ##
2 ## roundcube.spec -- OpenPKG RPM Package Specification
3 ## Copyright (c) 2012-2012 Michael Schloh von Bennewitz <michael@schloh.com>
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_plug_rcguard 0.2.0-39-g6d98249
27 # package information
28 Name: roundcube
29 Summary: Roundcube Webmail Client
30 URL: http://www.roundcube.net/
31 Vendor: Thomas Bruederli
32 Packager: Michael Schloh von Bennewitz
33 Distribution: Europalab Networks Production
34 Class: EVAL
35 Group: Mail
36 License: GPL
37 Version: 0.8.2
38 Release: 20120800
40 # list of sources
41 Source0: http://switch.dl.sourceforge.net/roundcubemail/%{version}/roundcubemail-%{version}.tar.gz
42 Source1: https://www.github.com/dennylin93/rcguard/tarball/master/dennylin93-rcguard-%{V_plug_rcguard}.tar.gz
43 Source2: roundcube-apache.conf
44 Source3: rc.roundcube
45 Source4: linen_login.png
46 Patch0: roundcube.patch
48 # build information
49 BuildPreReq: OpenPKG, openpkg >= 20100101
50 PreReq: OpenPKG, openpkg >= 20100101
51 PreReq: MTA, apache, apache-php
52 PreReq: apache-php::with_xml = yes
53 PreReq: apache-php::with_json = yes
54 PreReq: apache-php::with_exif = yes
55 PreReq: apache-php::with_mcrypt = yes
56 PreReq: apache-php::with_iconv = yes
57 PreReq: apache-php::with_session = yes
58 PreReq: apache-php::with_ssl = yes
60 %description
61 Roundcube webmail is a browser based multilingual IMAP client with
62 an application-like user interface. It provides full functionality
63 expected from a email client, including MIME support, address book,
64 folder manipulation, message searching and spell checking.
66 %track
67 prog roundcube = {
68 version = %{version}
69 url = http://prdownloads.sourceforge.net/roundcubemail/
70 regex = roundcubemail-(\d+\.\d+\.\d+)\.tar\.gz
71 }
73 %prep
74 %setup -q -n roundcubemail-%{version}
75 %setup -q -n roundcubemail-%{version} -D -T -a 1
76 %{l_shtool} subst \
77 -e 's;\(E_ALL&~E_NOTICE\));\1&~E_STRICT);' \
78 installer/index.php
79 mv dennylin93-rcguard-* plugins/rcguard
80 %patch -p0
81 %{l_shtool} subst %{l_value -s -a} \
82 plugins/managesieve/config.inc.php.dist
84 %build
86 %install
87 # create directory structure
88 %{l_shtool} mkdir -f -p -m 755 \
89 $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
90 $RPM_BUILD_ROOT%{l_prefix}/share/roundcube \
91 $RPM_BUILD_ROOT%{l_prefix}/var/roundcube/log \
92 $RPM_BUILD_ROOT%{l_prefix}/var/roundcube/run
94 # install program
95 cp -rpf \
96 bin config installer logs plugins program skins SQL temp \
97 $RPM_BUILD_ROOT%{l_prefix}/share/roundcube/
98 %{l_shtool} install -c -m 644 \
99 index.php robots.txt \
100 $RPM_BUILD_ROOT%{l_prefix}/share/roundcube/
102 # install other components
103 ( cd $RPM_BUILD_ROOT%{l_prefix}/share/roundcube/plugins/rcguard/skins \
104 && ln -s default larry )
105 %{l_shtool} install -c -m 644 \
106 %{SOURCE linen_login.png} \
107 $RPM_BUILD_ROOT%{l_prefix}/share/roundcube/skins/larry/images/
109 # install runcommand script
110 %{l_shtool} install -c -m 755 %{l_value -s -a} \
111 %{SOURCE rc.roundcube} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
113 # install custom Apache configuration
114 l_hostname=`%{l_shtool} echo -e %h`
115 l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
116 %{l_shtool} install -c -m 644 %{l_value -s -a} \
117 -e "s;@l_hostname@;$l_hostname;g" \
118 -e "s;@l_domainname@;$l_domainname;g" \
119 %{SOURCE roundcube-apache.conf} \
120 $RPM_BUILD_ROOT%{l_prefix}/etc/roundcube/
122 # determine package ingredients and tag config files
123 %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
124 %{l_files_std} \
125 '%attr(775,-,%{l_ngrp}) %{l_prefix}/share/roundcube/temp' \
126 '%attr(775,-,%{l_ngrp}) %{l_prefix}/share/roundcube/logs' \
127 '%config %attr(640,%{l_mgrp},%{l_ngrp}) %{l_prefix}/share/roundcube/config/*' \
128 '%config %attr(640,%{l_mgrp},%{l_ngrp}) %{l_prefix}/share/roundcube/plugins/*/*config*'
130 %files -f files
132 %clean
134 %post
135 if [ $1 -eq 1 ]; then
136 # display information about next steps
137 ( echo "Roundcube stores data in SQL and requires an existing"
138 echo "local or remote installation of PostgreSQL, MySQL, or"
139 echo "SQLite. Please refer to online documentation to carry"
140 echo "out the SQL configuration, something like:"
141 echo ""
142 echo "CREATE DATABASE roundcubemail;"
143 echo "CREATE USER 'username'@'localhost' IDENTIFIED BY 'newpwd';"
144 echo "GRANT ALL PRIVILEGES ON roundcubemail.* TO username@localhost IDENTIFIED BY 'newpwd';"
145 echo "FLUSH PRIVILEGES;"
146 echo ""
147 echo "After that, start the database server and finally start Roundcube:"
148 echo " \$ $RPM_INSTALL_PREFIX/bin/openpkg rc roundcube start"
149 echo "Cconnect with a browser to the URL:"
150 echo " http://127.0.0.1:8080/roundcube/"
151 ) | %{l_rpmtool} msg -b -t notice
152 fi
153 if [ $1 -eq 2 ]; then
154 # after upgrade, restart service
155 eval `%{l_rc} roundcube status 2>/dev/null`
156 [ ".$roundcube_active" = .yes ] && %{l_rc} roundcube restart
157 fi
158 exit 0
160 %preun
161 # before erase, stop service and remove log files
162 [ $1 -eq 0 ] || exit 0
163 %{l_rc} roundcube stop 2>/dev/null
164 rm -f $RPM_INSTALL_PREFIX/var/roundcube/log/*.log >/dev/null 2>&1 || true
165 rm -f $RPM_INSTALL_PREFIX/share/roundcube/logs/* >/dev/null 2>&1 || true
166 rm -f $RPM_INSTALL_PREFIX/share/roundcube/temp/* >/dev/null 2>&1 || true