squirrelmail.spec 17 KB

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