imapd.spec 8.0 KB

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