imapd.spec 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254
  1. ##
  2. ## imapd.spec -- OpenPKG RPM Specification
  3. ## Copyright (c) 2000-2003 Cable & Wireless Deutschland GmbH
  4. ## Copyright (c) 2000-2003 The OpenPKG Project <http://www.openpkg.org/>
  5. ## Copyright (c) 2000-2003 Ralf S. Engelschall <rse@engelschall.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 information
  26. Name: imapd
  27. Summary: Cyrus IMAP Server
  28. URL: http://asg.web.cmu.edu/cyrus/imapd/
  29. Vendor: Carnegie Mellon University
  30. Packager: The OpenPKG Project
  31. Distribution: OpenPKG [PLUS]
  32. Group: Mail
  33. License: BSD
  34. Version: 2.1.14
  35. Release: 20030708
  36. # package options
  37. %option with_fsl yes
  38. %option with_vhost_hack no
  39. # list of sources
  40. Source0: ftp://ftp.andrew.cmu.edu/pub/cyrus-mail/cyrus-imapd-%{version}.tar.gz
  41. Source1: rc.imapd
  42. Source2: cyrus.conf
  43. Source3: imapd.conf
  44. Source4: fsl.imapd
  45. Patch0: imapd.patch
  46. Patch1: vhosthack.patch
  47. # build information
  48. Prefix: %{l_prefix}
  49. BuildRoot: %{l_buildroot}
  50. BuildPreReq: OpenPKG, openpkg >= 20030415, perl, perl-openpkg, make
  51. PreReq: OpenPKG, openpkg >= 20030415, perl, MTA
  52. BuildPreReq: sasl, db >= 4.1.24, openssl
  53. PreReq: sasl, db >= 4.1.24, openssl
  54. %if "%{with_fsl}" == "yes"
  55. BuildPreReq: fsl
  56. PreReq: fsl
  57. %endif
  58. AutoReq: no
  59. AutoReqProv: no
  60. Provides: IMAP
  61. %description
  62. The Cyrus IMAP server is an IMAP4 and POP3 daemon that differs from
  63. other IMAP server implementations in that it is generally intended to
  64. be run on sealed servers, where normal users are not permitted to log
  65. in. The mailbox database is stored in parts of the filesystem that are
  66. private to the Cyrus IMAP system. All user access to mail is through
  67. the IMAP, POP3, or KPOP protocols.
  68. %prep
  69. %setup -q -n cyrus-imapd-%{version}
  70. %patch -p0
  71. %{l_shtool} subst \
  72. -e 's;db-4.1;db;g' \
  73. configure
  74. # ensure linking of Berkeley DB
  75. %{l_shtool} subst \
  76. -e 's;^\( *.LIBS..*\)\(\"\],.*\)$;\1 -ldb\2;' \
  77. perl/imap/Makefile.PL
  78. # ensure invocation of correct perl in cyradm
  79. %{l_shtool} subst \
  80. -e 's;^\(.) exec\) \(perl .*\)$;\1 %{l_prefix}/bin/\2;' \
  81. perl/imap/cyradm.sh
  82. # adjust hard-coded location of sieve
  83. %{l_shtool} subst \
  84. -e 's;"/usr/sieve";"%{l_prefix}/var/imapd/sieve";g' \
  85. imap/lmtpd.c \
  86. imap/mbdump.c \
  87. imap/user.c \
  88. man/imapd.conf.5 \
  89. timsieved/actions.c
  90. # adjust default config to install environment for use in mkimap install helper script
  91. %{l_shtool} install -c -m 644 \
  92. -e "s;@l_prefix@;$RPM_BUILD_ROOT%{l_prefix};g" \
  93. -e "s;@l_rusr@;%{l_rusr};g" \
  94. %{SOURCE imapd.conf} \
  95. imapd.conf-mkimap
  96. %{l_shtool} subst \
  97. -e 's;^exec perl ;exec %{l_prefix}/bin/perl ;' \
  98. -e "s;/etc/imapd.conf;%{l_prefix}/etc/imapd/imapd.conf;" \
  99. -e "s;^\(\$sievedir = \).*$;\1 shift || \"%{l_prefix}/var/imapd/sieve\"\;;" \
  100. tools/mkimap
  101. # ajdust syslog ident of deliver program
  102. %{l_shtool} subst \
  103. -e '/config_init/s;"deliver";"cyrdeliver";' \
  104. imap/deliver.c
  105. %if "%{with_vhost_hack}" == "yes"
  106. # allow @ in LMTP mailbox names
  107. %{l_patch} -p1 <%{SOURCE vhosthack.patch}
  108. %endif
  109. %build
  110. cflags="%{l_cppflags}"
  111. ldflags="%{l_ldflags} %{l_fsl_ldflags}"
  112. case "%{l_target}" in
  113. *-solaris* ) ldflags="$ldflags -lsocket -lnsl" ;;
  114. esac
  115. CC="%{l_cc}" \
  116. CPPFLAGS="$cflags" \
  117. CFLAGS="%{l_cflags -O} $cflags" \
  118. LDFLAGS="$ldflags" \
  119. LIBS="%{l_fsl_libs}" \
  120. ./configure \
  121. --cache-file=./cache.config \
  122. --prefix=%{l_prefix} \
  123. --with-openssl=%{l_prefix} \
  124. --with-dbdir=%{l_prefix} \
  125. --with-sasl=%{l_prefix} \
  126. --with-statedir=%{l_prefix}/var/imapd \
  127. --with-auth=unix \
  128. --without-libwrap \
  129. --without-perl \
  130. --without-ucdsnmp \
  131. --with-cyrus-prefix=%{l_prefix} \
  132. --with-cyrus-user=%{l_rusr} \
  133. --with-cyrus-group=%{l_rgrp}
  134. # redirect the hard-coded file paths
  135. %{l_shtool} subst \
  136. -e 's;/etc/\(.*\).conf;%{l_prefix}/etc/imapd/\1.conf;' \
  137. imap/*.c imap/*.h master/*.c master/*.h
  138. %{l_shtool} subst \
  139. -e 's;/etc/mail/cyrusmap\.db;%{l_prefix}/var/imapd/cyrusmap.db;' \
  140. imap/sendmail-map.c
  141. %{l_make} %{l_mflags}
  142. %install
  143. # build (and install) Perl-based administration stuff
  144. %{l_prefix}/bin/perl-openpkg prolog
  145. export SASL_INC="%{l_cppflags}"
  146. export SASL_LIB="%{l_ldflags} -lsasl2"
  147. export OPENSSL_INC="%{l_cppflags}"
  148. export OPENSSL_LIB="%{l_ldflags} -lssl -lcrypto"
  149. %{l_prefix}/bin/perl-openpkg install -d perl/imap
  150. ( cd perl/sieve
  151. # FIXME: private information from perl-openpkg
  152. tag="${RPM_PACKAGE_NAME}-${RPM_PACKAGE_VERSION}-${RPM_PACKAGE_RELEASE}"
  153. perl="${RPM_BUILD_DIR}/perl-$tag"
  154. %{l_make} PERL="$perl"
  155. ) || exit 1
  156. %{l_prefix}/bin/perl-openpkg install -d perl/sieve/managesieve
  157. %{l_prefix}/bin/perl-openpkg install -d perl/sieve/acap
  158. %{l_prefix}/bin/perl-openpkg epilog
  159. %{l_make} %{l_mflags} install \
  160. prefix=$RPM_BUILD_ROOT%{l_prefix} \
  161. exec_prefix=$RPM_BUILD_ROOT%{l_prefix} \
  162. cyrus_prefix=$RPM_BUILD_ROOT%{l_prefix}
  163. %{l_shtool} mkdir -f -p -m 755 \
  164. $RPM_BUILD_ROOT%{l_prefix}/etc/imapd \
  165. $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d \
  166. $RPM_BUILD_ROOT%{l_prefix}/var/imapd/spool \
  167. $RPM_BUILD_ROOT%{l_prefix}/bin
  168. # install sieve adminstration script
  169. %{l_shtool} install -c -m 755 \
  170. perl/sieve/scripts/sieveshell.pl \
  171. $RPM_BUILD_ROOT%{l_prefix}/bin/sieveshell
  172. # offer a sane configuration
  173. l_hostname=`%{l_shtool} echo -e %h`
  174. l_domainname=`%{l_shtool} echo -e %d | cut -c2-`
  175. %{l_shtool} install -c -m 644 \
  176. -e 's;@l_prefix@;%{l_prefix};g' \
  177. -e 's;@l_rusr@;%{l_rusr};g' \
  178. -e "s;@l_hostname@;$l_hostname;g" \
  179. -e "s;@l_domainname@;$l_domainname;g" \
  180. %{SOURCE cyrus.conf} \
  181. %{SOURCE imapd.conf} \
  182. $RPM_BUILD_ROOT%{l_prefix}/etc/imapd/
  183. # install the run command file
  184. %{l_shtool} install -c -m 755 \
  185. -e 's;@l_prefix@;%{l_prefix};g' \
  186. -e 's;@l_susr@;%{l_susr};g' \
  187. -e 's;@l_rusr@;%{l_rusr};g' \
  188. -e 's;@l_rgrp@;%{l_rgrp};g' \
  189. %{SOURCE rc.imapd} $RPM_BUILD_ROOT%{l_prefix}/etc/rc.d/
  190. # use mkimap to create many directories for us
  191. tools/mkimap imapd.conf-mkimap $RPM_BUILD_ROOT%{l_prefix}/var/imapd/sieve
  192. # rename files which are likely to cause namespace conflicts
  193. ( cd $RPM_BUILD_ROOT%{l_prefix}
  194. for i in deliver master quota reconstruct; do
  195. mv bin/$i bin/cyr$i
  196. mv man/man8/$i.8 man/man8/cyr$i.8
  197. done )
  198. # install from tools
  199. %{l_shtool} install -c -m 755 \
  200. tools/mkimap \
  201. $RPM_BUILD_ROOT%{l_prefix}/bin/
  202. # install OSSP fsl configuration
  203. %{l_shtool} mkdir -f -p -m 755 $RPM_BUILD_ROOT%{l_prefix}/etc/fsl
  204. %{l_shtool} install -c -m 644 \
  205. -e 's;@l_prefix@;%{l_prefix};g' \
  206. %{SOURCE fsl.imapd} \
  207. $RPM_BUILD_ROOT%{l_prefix}/etc/fsl/
  208. # strip binaries
  209. strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
  210. # determine files
  211. %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT \
  212. %{l_files_std} \
  213. '%not %dir %{l_prefix}/etc/fsl' \
  214. '%config %{l_prefix}/etc/fsl/fsl.imapd' \
  215. '%config %{l_prefix}/etc/imapd/imapd.conf' \
  216. '%config %{l_prefix}/etc/imapd/cyrus.conf' \
  217. '%dir %attr(0750,%{l_rusr},%{l_mgrp}) %{l_prefix}/var/imapd' \
  218. '%dir %attr(0750,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/imapd/*' \
  219. '%dir %attr(0770,%{l_rusr},%{l_rgrp}) %{l_prefix}/var/imapd/*/*' \
  220. '%dir %attr(0770,%{l_musr},%{l_rgrp}) %{l_prefix}/var/imapd/socket'
  221. %files -f files
  222. %clean
  223. rm -rf $RPM_BUILD_ROOT