squirrelmail.spec 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395
  1. ##
  2. ## squirrelmail.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2005 The OpenPKG Project <http://www.openpkg.org/>
  4. ## Copyright (c) 2000-2005 Ralf S. Engelschall <rse@engelschall.com>
  5. ## Copyright (c) 2000-2005 Cable & Wireless <http://www.cw.com/>
  6. ##
  7. ## Permission to use, copy, modify, and distribute this software for
  8. ## any purpose with or without fee is hereby granted, provided that
  9. ## the above copyright notice and this permission notice appear in all
  10. ## copies.
  11. ##
  12. ## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
  13. ## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. ## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
  15. ## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
  16. ## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  17. ## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  18. ## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
  19. ## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
  20. ## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  21. ## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
  22. ## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  23. ## SUCH DAMAGE.
  24. ##
  25. # package version
  26. %define V_sqmail 1.4.4
  27. %define V_locale 20050308
  28. %define V_plugin_compat 1.3
  29. %define V_plugin_addgraphics 2.3-1.0.3
  30. %define V_plugin_saslpwd 1.4.1-1.4
  31. %define V_plugin_checkquota 1.4-1.2.7
  32. %define V_plugin_foldersize 1.4-1.4
  33. %define V_plugin_gnupg 2.0.1-1.4.2
  34. %define V_plugin_ldif 1.4-1.2.x
  35. %define V_plugin_logger 1.4.0-1.0.6
  36. %define V_plugin_update 0.7-1.4.2
  37. %define V_plugin_userip 3.2-1.2.2
  38. %define V_plugin_smallcal 0.8-1.2.3
  39. %define V_plugin_vkeyboard 0.8
  40. # package information
  41. Name: squirrelmail
  42. Summary: SquirrelMail Webmail Client
  43. URL: http://www.squirrelmail.org/
  44. Vendor: Squirrelmail Developers
  45. Packager: The OpenPKG Project
  46. Distribution: OpenPKG
  47. Class: EVAL
  48. Group: Mail
  49. License: GPL
  50. Version: %{V_sqmail}
  51. Release: 20050320
  52. # package options
  53. %option with_plugins no
  54. # list of sources
  55. Source0: http://osdn.dl.sourceforge.net/squirrelmail/squirrelmail-%{version}.tar.bz2
  56. Source1: http://osdn.dl.sourceforge.net/squirrelmail/all_locales-%{V_sqmail}-%{V_locale}.tar.bz2
  57. Source2: http://www.squirrelmail.org/plugins/compatibility-%{V_plugin_compat}.tar.gz
  58. Source3: http://www.squeaksoft.com/products/SquirrelLogger/squirrel_logger.%{V_plugin_logger}.tar.gz
  59. Source4: http://www.squirrelmail.org/plugins/addgraphics-%{V_plugin_addgraphics}.tar.gz
  60. Source5: http://www.squirrelmail.org/plugins/chg_sasl_passwd-%{V_plugin_saslpwd}.tar.gz
  61. Source6: http://www.squirrelmail.org/plugins/check_quota-%{V_plugin_checkquota}.tar.gz
  62. Source7: http://www.squirrelmail.org/plugins/folder_sizes.%{V_plugin_foldersize}.tar.gz
  63. Source8: http://www.squirrelmail.org/plugins/gpg.%{V_plugin_gnupg}.tar.gz
  64. Source9: http://www.squirrelmail.org/plugins/ldifimport-%{V_plugin_ldif}.tar.gz
  65. Source10: http://www.squirrelmail.org/plugins/pupdate.%{V_plugin_update}.tar.gz
  66. Source11: http://www.squirrelmail.org/plugins/show_user_and_ip-%{V_plugin_userip}.tar.gz
  67. Source12: http://www.squirrelmail.org/plugins/smallcal-%{V_plugin_smallcal}.tar.gz
  68. Source13: http://www.squirrelmail.org/plugins/vkeyboard-%{V_plugin_vkeyboard}.tar.gz
  69. Source14: config.php
  70. Source15: defprefs.txt
  71. Source16: opkg_large.png
  72. Source17: opkg_small.png
  73. Source18: rc.squirrelmail
  74. Patch0: squirrelmail.patch
  75. Patch1: squirrelmail.patch.plugins
  76. # build information
  77. Prefix: %{l_prefix}
  78. BuildRoot: %{l_buildroot}
  79. BuildPreReq: OpenPKG, openpkg >= 20040130
  80. PreReq: OpenPKG, openpkg >= 20040130, imapd, MTA, apache
  81. PreReq: apache::with_mod_php = yes, apache::with_mod_php_xml = yes
  82. AutoReq: no
  83. AutoReqProv: no
  84. %description
  85. SquirrelMail is a standards-based webmail package written in
  86. PHP4. It includes built-in pure PHP support for the IMAP and
  87. SMTP protocols, and all pages render in pure HTML 4.0 (with no
  88. Javascript) for maximum compatibility across browsers. It has
  89. very few requirements and is very easy to configure and install.
  90. SquirrelMail has all the functionality you would want from an email
  91. client, including strong MIME support, address books, and folder
  92. manipulation.
  93. %track
  94. prog squirrelmail = {
  95. comment = "ms: 1.5.x is the development trunk, so do not update past 1.4.x"
  96. version = %{version}
  97. url = http://prdownloads.sourceforge.net/squirrelmail/
  98. regex = squirrelmail-(__VER__)\.tar\.bz2
  99. }
  100. prog squirrelmail:locales = {
  101. comment = "ms: 1.5.x is the development trunk, so do not update past 1.4.x"
  102. version = %{V_sqmail}-%{V_locale}
  103. url = http://prdownloads.sourceforge.net/squirrelmail/
  104. regex = all_locales-(__VER__)\.tar\.bz2
  105. }
  106. prog squirrelmail:compat = {
  107. version = %{V_plugin_compat}
  108. url = http://www.squirrelmail.org/plugins/
  109. regex = compatibility-(__VER__)\.tar\.gz
  110. }
  111. prog squirrelmail:logger = {
  112. version = %{V_plugin_logger}
  113. url = http://www.squeaksoft.com/products/SquirrelLogger/
  114. regex = squirrel_logger.(__VER__)\.tar\.gz
  115. }
  116. prog squirrelmail:addgraphics = {
  117. version = %{V_plugin_addgraphics}
  118. url = http://www.squirrelmail.org/plugins/
  119. regex = addgraphics-(__VER__)\.tar\.gz
  120. }
  121. prog squirrelmail:saslpwd = {
  122. version = %{V_plugin_saslpwd}
  123. url = http://www.squirrelmail.org/plugins/
  124. regex = chg_sasl_passwd-(__VER__)\.tar\.gz
  125. }
  126. prog squirrelmail:checkquota = {
  127. version = %{V_plugin_checkquota}
  128. url = http://www.squirrelmail.org/plugins/
  129. regex = check_quota-(__VER__)\.tar\.gz
  130. }
  131. prog squirrelmail:foldersize = {
  132. version = %{V_plugin_foldersize}
  133. url = http://www.squirrelmail.org/plugins/
  134. regex = folder_sizes.(__VER__)\.tar\.gz
  135. }
  136. prog squirrelmail:gnupg = {
  137. version = %{V_plugin_gnupg}
  138. url = http://www.squirrelmail.org/plugins/
  139. regex = gpg.(__VER__)\.tar\.gz
  140. }
  141. prog squirrelmail:ldif = {
  142. version = %{V_plugin_ldif}
  143. url = http://www.squirrelmail.org/plugins/
  144. regex = ldifimport-(__VER__)\.tar\.gz
  145. }
  146. prog squirrelmail:update = {
  147. version = %{V_plugin_update}
  148. url = http://www.squirrelmail.org/plugins/
  149. regex = pupdate.(__VER__)\.tar\.gz
  150. }
  151. prog squirrelmail:userip = {
  152. version = %{V_plugin_userip}
  153. url = http://www.squirrelmail.org/plugins/
  154. regex = show_user_and_ip-(__VER__)\.tar\.gz
  155. }
  156. prog squirrelmail:smallcal = {
  157. version = %{V_plugin_smallcal}
  158. url = http://www.squirrelmail.org/plugins/
  159. regex = smallcal-(__VER__)\.tar\.gz
  160. }
  161. prog squirrelmail:vkeyboard = {
  162. version = %{V_plugin_vkeyboard}
  163. url = http://www.squirrelmail.org/plugins/
  164. regex = vkeyboard-(__VER__)\.tar\.gz
  165. }
  166. %prep
  167. %setup -q -c -n squirrelmail
  168. %setup -q -D -T -a 1 -c -n squirrelmail/all_locales-%{V_sqmail}-%{V_locale}
  169. %setup -q -D -T -a 2 -n squirrelmail
  170. %setup -q -D -T -a 3 -n squirrelmail
  171. mv compatibility squirrelmail-%{V_sqmail}/plugins
  172. mv squirrel_logger squirrelmail-%{V_sqmail}/plugins
  173. %if "%{with_plugins}" == "yes"
  174. %setup -q -D -T -a 4 -n squirrelmail
  175. %setup -q -D -T -a 5 -n squirrelmail
  176. %setup -q -D -T -a 6 -n squirrelmail
  177. %setup -q -D -T -a 7 -n squirrelmail
  178. %setup -q -D -T -a 8 -n squirrelmail
  179. %setup -q -D -T -a 9 -n squirrelmail
  180. %setup -q -D -T -a 10 -n squirrelmail
  181. %setup -q -D -T -a 11 -n squirrelmail
  182. %setup -q -D -T -a 12 -n squirrelmail
  183. %setup -q -D -T -a 13 -n squirrelmail
  184. # move additional plugins where other are already placed
  185. for plug in addgraphics check_quota chg_sasl_passwd \
  186. folder_sizes gpg ldifimport pupdate \
  187. show_user_and_ip smallcal vkeyboard; do
  188. mv $plug squirrelmail-%{V_sqmail}/plugins
  189. done
  190. %endif
  191. # clean up login screen of distractions
  192. ( cd %{l_tmpdir}/squirrelmail/squirrelmail-%{V_sqmail}
  193. %patch -p0
  194. ) || exit $?
  195. # rearrange documentation and remove archive script
  196. ( cd %{l_tmpdir}/squirrelmail/squirrelmail-%{V_sqmail}
  197. mv AUTHORS ChangeLog COPYING INSTALL README UPGRADE doc/
  198. mv ReleaseNotes doc/ReleaseNotes.txt
  199. mv themes/README.themes doc/
  200. for fil in `find plugins/ -name "README*" -o -name "Readme*" \
  201. -o -name "INSTALL*" -o -name CHANGES -o -name HISTORY`; do
  202. %{l_shtool} mkdir -f -p -m 755 doc/`dirname $fil`
  203. mv -f $fil $_
  204. done
  205. mv doc/plugins/squirrelspell/doc/README doc/plugins/squirrelspell
  206. rm -rf doc/plugins/squirrelspell/doc doc/plugins/squirrelspell/index.php
  207. mv plugins/squirrelspell/doc/* doc/plugins/squirrelspell
  208. rm -rf plugins/squirrelspell/doc
  209. rm -f plugins/make_archive.pl
  210. %if "%{with_plugins}" == "yes"
  211. mv plugins/pupdate/docs/* doc/plugins/pupdate
  212. rm -rf plugins/pupdate/docs
  213. %endif
  214. # postadjustment cosmetics
  215. %{l_shtool} subst \
  216. -e 's;\(#ffffff., .border="0" width=\)"350";\1"250";1' \
  217. src/login.php
  218. # set default prefs
  219. cat %{SOURCE defprefs.txt} >>data/default_pref
  220. ) || exit $?
  221. %build
  222. %install
  223. rm -rf $RPM_BUILD_ROOT
  224. # create directory structure
  225. %{l_shtool} mkdir -f -p -m 755 \
  226. $RPM_BUILD_ROOT%{l_prefix}/bin \
  227. $RPM_BUILD_ROOT%{l_prefix}/etc/squirrelmail \
  228. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/prefs \
  229. $RPM_BUILD_ROOT%{l_prefix}/var/squirrelmail/spool/attach \
  230. $RPM_BUILD_ROOT%{l_prefix}/var/squirrelmail/log
  231. # install locales
  232. ( cd %{l_tmpdir}/squirrelmail/all_locales-%{V_sqmail}-%{V_locale}
  233. cp -rpf help images locale $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/
  234. ) || exit $?
  235. # install program
  236. ( cd %{l_tmpdir}/squirrelmail/squirrelmail-%{V_sqmail}
  237. # install default_pref
  238. %{l_shtool} install -c -m 644 \
  239. data/default_pref \
  240. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/prefs/
  241. # create initial administrator list
  242. echo %{l_musr} >>$RPM_BUILD_ROOT%{l_prefix}/etc/squirrelmail/admins
  243. # install main index file to view in client browser
  244. %{l_shtool} install -c -m 644 \
  245. index.php \
  246. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/
  247. # copy over most functional directories, a lot of stuff
  248. for dir in class doc functions include plugins src themes; do
  249. cp -rpf $dir $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/
  250. done
  251. cp -rpf images/* $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/images/
  252. cp -pf locale/timezones.cfg $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/locale/
  253. # install main config files
  254. l_fqdm=`%{l_shtool} echo -e %h%d`
  255. %{l_shtool} install -c -m 644 %{l_value -s -a} \
  256. -e 's;config/\(config_local.php\);\1;g' \
  257. -e "s;@l_fqdm@;${l_fqdm};g" \
  258. %{SOURCE config.php} \
  259. config/config_default.php \
  260. $RPM_BUILD_ROOT%{l_prefix}/etc/squirrelmail/
  261. %if "%{with_plugins}" == "yes"
  262. ( cd $RPM_BUILD_ROOT%{l_prefix}
  263. %{l_patch} -p0 <%{PATCH squirrelmail.patch.plugins}
  264. rm -f $RPM_BUILD_ROOT%{l_prefix}/etc/squirrelmail/*.orig
  265. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/gpg/*.orig
  266. rm -f $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/chg_sasl_passwd/*.orig
  267. ) || exit $?
  268. %endif
  269. %{l_shtool} install -c -m 644 \
  270. config/config_local.php \
  271. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/
  272. # install plugin config files
  273. ( cd $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins
  274. %{l_shtool} subst \
  275. -e 's;../data/access_log;../../../var/squirrelmail/log/access.log;' \
  276. -e 's;\(\$sl_dateformat = \)"m/d/Y G:i:s";\1"d/m/Y G:i:s";' \
  277. squirrel_logger/setup.php
  278. %if "%{with_plugins}" == "yes"
  279. cp -pf check_quota/config.php.sample check_quota/config.php
  280. cp -pf chg_sasl_passwd/config.php.sample chg_sasl_passwd/config.php
  281. cp -pf show_user_and_ip/config.php.sample show_user_and_ip/config.php
  282. %{l_shtool} install -c -m 644 \
  283. -e "s;\(\$vkeyboard_msgsize.*\)'medium';\1'x-small';" \
  284. -e "s;\(\$vkeyboard_layout.*\)'us_english';\1'portuguese_abnt2';" \
  285. -e "s;\(\$vkeyboard_height.*\)'250';\1'270';" \
  286. vkeyboard/config.php.sample \
  287. vkeyboard/config.php
  288. %{l_shtool} install -c -m 644 \
  289. -e "s;sm_logo\.png;opkg_small.png;" \
  290. -e "s;SquirrelMail Logo;OpenPKG Logo;" \
  291. -e "s;www\.squirrelmail\.org;www.openpkg.org;" \
  292. -e "s;\/\/\(\$image_width.*\) = 308;\1 = 201;" \
  293. -e "s;\/\/\(\$image_height.*\) = 111;\1 = 62;" \
  294. addgraphics/config.php.typical.one.domain \
  295. addgraphics/config.php
  296. %{l_shtool} install -c -m 644 \
  297. -e 's;\(adminusername = "\)[^"]*;\1%{l_musr};' \
  298. -e 's;corehide = 1;corehide = 0;' \
  299. pupdate/config.php.sample \
  300. pupdate/config.php
  301. %{l_shtool} install -c -m 644 \
  302. %{SOURCE opkg_small.png} \
  303. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/images/
  304. %endif
  305. ) || exit $?
  306. # install squirrelmail configuration perl script
  307. %{l_shtool} install -c -m 755 \
  308. -e 's;chdir($dir);chdir("%{l_prefix}/etc/squirrelmail");g' \
  309. -e 's;\.\./plugins;%{l_prefix}/share/squirrelmail/plugins;g' \
  310. -e 's;\.\./themes;%{l_prefix}/share/squirrelmail/themes;g' \
  311. -e 's;config/config_local.php;config_local.php;g' \
  312. config/conf.pl \
  313. $RPM_BUILD_ROOT%{l_prefix}/bin/squirrelconf
  314. # use our own logo, a squirrel next to a OpenPKG package
  315. %{l_shtool} install -c -m 644 \
  316. %{SOURCE opkg_large.png} \
  317. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/images/
  318. ) || exit $?
  319. # install runcommand script
  320. %{l_shtool} mkdir -f -p -m 755 \
  321. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d
  322. %{l_shtool} install -c -m 755 %{l_value -s -a} \
  323. %{SOURCE rc.squirrelmail} \
  324. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  325. # replace false /etc config paths throughout
  326. %{l_shtool} subst \
  327. -e 's;SM_PATH \. \(.\)config/;\1%{l_prefix}/etc/squirrelmail/;g' \
  328. -e 's;require_once(SM_PATH \. \(.*\)%{l_prefix};require_once(\1%{l_prefix};g' \
  329. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/functions/*.php \
  330. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/include/*.php \
  331. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/abook_take/*.php \
  332. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/administrator/*.php \
  333. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/plugins/calendar/*.php \
  334. $RPM_BUILD_ROOT%{l_prefix}/share/squirrelmail/src/*.php
  335. # determine package ingredients and tag config files
  336. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  337. %{l_files_std} \
  338. '%config %{l_prefix}/etc/squirrelmail/*' \
  339. '%config %{l_prefix}/share/squirrelmail/prefs/*' \
  340. '%config %{l_prefix}/share/squirrelmail/plugins/squirrelspell/sqspell_config.php' \
  341. %if "%{with_plugins}" == "yes"
  342. '%config %{l_prefix}/share/squirrelmail/plugins/addgraphics/config.php' \
  343. '%config %{l_prefix}/share/squirrelmail/plugins/check_quota/config.php' \
  344. '%config %{l_prefix}/share/squirrelmail/plugins/chg_sasl_passwd/config.php' \
  345. '%config %{l_prefix}/share/squirrelmail/plugins/folder_sizes/folder_sizes_config.php' \
  346. '%config %{l_prefix}/share/squirrelmail/plugins/gpg/gpg_local_prefs.txt' \
  347. '%config %{l_prefix}/share/squirrelmail/plugins/ldifimport/config.php' \
  348. '%config %{l_prefix}/share/squirrelmail/plugins/pupdate/config.php' \
  349. '%config %{l_prefix}/share/squirrelmail/plugins/show_user_and_ip/config.php' \
  350. '%config %{l_prefix}/share/squirrelmail/plugins/vkeyboard/config.php' \
  351. %endif
  352. '%attr(755,%{l_nusr},%{l_ngrp}) %{l_prefix}/share/squirrelmail/prefs' \
  353. '%attr(755,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/squirrelmail/spool/attach' \
  354. '%attr(755,%{l_nusr},%{l_ngrp}) %{l_prefix}/var/squirrelmail/log'
  355. %files -f files
  356. %clean
  357. rm -rf $RPM_BUILD_ROOT
  358. %preun
  359. # before erase, remove log files
  360. [ $1 -eq 0 ] || exit 0
  361. rm -f $RPM_INSTALL_PREFIX/var/squirrelmail/log/*.log >/dev/null 2>&1 || true