Browse Source

2014-12-24 Ryoichi INAGAKI <ryo1@toki.waseda.jp>

	* cyrus-imapd: updated
	


git-svn-id: http://trac.vinelinux.org/repos/projects/specs@9191 ec354946-7b23-47d6-9f5a-488ba84defc7
inagaki 9 years ago
parent
commit
7bbbed121a
1 changed files with 379 additions and 543 deletions
  1. 379 543
      c/cyrus-imapd/cyrus-imapd-vl.spec

+ 379 - 543
c/cyrus-imapd/cyrus-imapd-vl.spec

@@ -1,176 +1,81 @@
 Name:			cyrus-imapd
-Version:		2.2.13p1
-Release:		11%{?_dist_release}
+Version:		2.4.17
+Release:		1%{?_dist_release}
 
-# ********************** BUILD TIME OPTIONS START **********************
+%define ssl_pem_file %{_sysconfdir}/pki/%{name}/%{name}.pem
 
-# To modify parameters, edit the .spec file or build like this:
-# rpm --rebuild --define='SEEN_DB skiplist' cyrus-imapd-2.x.x-x.src.rpm
+# uid/gid reserved, see setup:/usr/share/doc/setup*/uidgid
+%define uid 76
+%define gid 76
 
-# use saslauth group
-%{!?SASLGROUP:		%define		SASLGROUP 0}
+%define _cyrususer cyrus
+%define _cyrusgroup mail
+%define _cyrexecdir %{_exec_prefix}/lib/%{name}
 
-# include deliver-wrapper
-%{!?DEL_WRAP:		%define		DEL_WRAP 0}
+Summary: A high-performance mail server with IMAP, POP3, NNTP and SIEVE support
+Summary(ja): IMAP, POP3, NNTP, SIEVE をサポートする高パフォーマンスのメールサーバ
 
-# use preforking cyrus.conf
-%{!?PREFORK:		%define		PREFORK 1}
-
-# enable Netscape hack (recommended)
-%{!?NETSCAPEHACK:	%define		NETSCAPEHACK 1}
-
-# enable IMAP4 LIST extensions
-%{!?LISTEXT:		%define		LISTEXT 1}
-
-# enable IDLED support
-%{!?IDLED:		%define		IDLED 0}
-
-# force syncronous updates on ext3
-%{!?FORCESYNCEXT3:	%define		FORCESYNCEXT3 0}
-
-# include autocreate feature
-%{!?AUTOCREATE:		%define		AUTOCREATE 1}
-
-# enable allnumeric patch
-%{!?ALLNUMERIC:		%define		ALLNUMERIC 0}
-
-# don't check for RFC compliant line termination (bare newlines)
-%{!?NO_BARE_NL:		%define		NO_BARE_NL 0}
-
-# used syslog facility for logging
-%{!?SYSLOGFACILITY:	%define		SYSLOGFACILITY MAIL}
-
-# use -fpie for linking
-%{!?USEPIE:		%define		USEPIE 0}
-
-# OutlookExpress seenstate patch
-%{!?OE_SEEN_ST:		%define		OE_SEEN_ST 0}
-
-# use authorization module METHOD [unix|krb5]
-%{!?AUTH_METHOD:	%define		AUTH_METHOD unix}
-
-# krb5
-%if %{?_dist_release} == "vl4" || %{?_dist_release} == "vl5"
-%define krb5 0
-%else
-%define krb5 1
-%endif
+License: BSD
+Group: System Environment/Daemons
+URL: http://www.cyrusimap.org/
+
+Source0: ftp://ftp.cyrusimap.org/cyrus-imapd/%{name}-%{version}.tar.gz
+Source1: cyrus-imapd.logrotate
+Source2: cyrus-imapd.imap-2.3.x-conf
+Source3: cyrus-imapd.pam-config
+Source7: cyrus-imapd.sysconfig
+Source8: cyrus-imapd.cvt_cyrusdb_all
+Source9: cyrus-imapd.magic
+Source10: cyrus-imapd.cron-daily
+Source11: README.rpm
+
+# Vine
+# init.d support
+Source100: cyrus-imapd.init
+Source101: cyrus-imapd.db.cfg
+
+Patch3: http://www.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
+
+Patch4: cyrus-imapd-2.3.1-authid_normalize.patch
+
+# fedora/rhel specific, find current db lib, rhbz#461875
+Patch6: cyrus-imapd-2.3.12p2-current-db.patch
+
+# for c-i <= 2.4.12
+Patch8: cyrus-imapd-2.4.12-debugopt.patch
+
+BuildRoot: %{_tmppath}/%{name}-%{version}-root
+BuildRequires: autoconf
+BuildRequires: cyrus-sasl-devel
+BuildRequires: perl
+BuildRequires: tcp_wrappers
+BuildRequires: libdb-devel
+BuildRequires: openssl-devel
+BuildRequires: pkgconfig
+BuildRequires: flex
+BuildRequires: bison
+BuildRequires: groff
+BuildRequires: automake
+BuildRequires: openldap-devel
+BuildRequires: krb5-devel
+BuildRequires: net-snmp-devel
+BuildRequires: transfig
+BuildRequires: ghostscript
+BuildRequires: rpm-devel
+
+Requires: %{name}-utils = %{version}-%{release}
+Requires: file, libdb-utils
+
+Requires(pre):  coreutils shadow-utils /sbin/service
+Requires(post): e2fsprogs perl grep coreutils findutils /sbin/chkconfig
+Requires(postun): shadow-utils grep /sbin/service
+Requires(preun): /sbin/service /sbin/chkconfig
+
+Vendor: Project Vine
+Distribution: Vine Linux
+
+%{?perl_default_filter}
 
-# ********************** BUILD TIME OPTIONS END ************************
-
-%define		_use_internal_dependency_generator 0
-%define		_vlver %(eval rpm -q --queryformat '%{VERSION}' $(rpm -qf /etc/vine-release))
-%define		_vlrelease %(eval %{__cat} /etc/vine-release)
-%define		_dbver db4
-%define		_dbrpmver %(eval rpm -q db4)
-%define		_perlhack 1
-%define		_perl_man3dir %(eval "$(perl -V:man3dir)"; echo $man3dir)
-# Disable -debuginfo package generation
-#%define debug_package	%{nil}
-
-Summary:		A high-performance mail server with IMAP, POP3, NNTP and SIEVE support.
-Summary(ja):		IMAP と POP3, NNTP, SIEVE サービスを提供する高パフォーマンスのメールサーバ
-License:		OSI Approved
-Group:			System Environment/Daemons
-URL:			http://asg.web.cmu.edu/cyrus/imapd/
-Source0:		ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz
-Source1:		ftp://ftp.andrew.cmu.edu/pub/cyrus/%{name}-%{version}.tar.gz.sig
-Source2:		cyrus-procmailrc
-Source3:		cyrus-deliver-wrapper.c
-Source4:		cyrus-user-procmailrc.template
-Source5:		cyrus-imapd.logrotate
-Source6:		cyrus-imapd.imap-2.2.x-conf
-Source7:		cyrus-imapd.pam-config
-Source8:		http://email.uoa.gr/projects/cyrus/autocreate/README.autocreate
-Source9:		http://email.uoa.gr/projects/cyrus/autosievefolder/README.autosievefolder
-Source10:		cyrus-imapd-db.cfg
-Source11:		cyrus-imapd.init
-Source12:		cyrus-imapd.sysconfig
-# updated 2009-09-26 inagaki
-Source13:		cyrus-imapd.cvt_cyrusdb_all
-Source14:		cyrus-imapd.magic
-Source15:      		http://clement.hermann.free.fr/scripts/Cyrus/imapcreate.pl
-Source16:		http://eu.dl.sourceforge.net/cyrus-utils/cyrus_ldap_quota.pl
-Source17:		ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/batchreconstruct
-Source18:		ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/bsd2cyrus
-Source19:		ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/cpmsg
-Source20:		ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/folderxfer
-Source21:		ftp://kalamazoolinux.org/pub/projects/awilliam/cyrus/inboxfer
-Source22:		http://email.uoa.gr/download/cyrus/cyrus_sharedbackup/cyrus_sharedbackup-0.1.tar.gz
-Source23:		cyrus-imapd-README.RPM
-Source24:		cyrus-imapd-README.HOWTO-recover-mailboxes.db
-Source25:		cyrus-imapd.cron-daily
-Source27:		cyrus-imapd-procmail+cyrus.mc
-Source28:		cyrus-imapd.rpm_set_permissions
-Source29:		cyrus-imapd-sendmail-8.12.9-cyrusv2.m4
-Source30:		cyrus-imapd-README.contrib
-Patch0:			cyrus-imapd-2.1.9-fdatasync.patch
-Patch1:			http://email.uoa.gr/download/cyrus/cyrus-imapd-2.2.7/cyrus-imapd-2.2.7-autocreate-0.2.diff
-Patch2:			http://email.uoa.gr/download/cyrus/cyrus-imapd-2.2.7/cyrus-imapd-2.2.7-autosieve-0.1.diff
-Patch3:			http://email.uoa.gr/download/cyrus/cyrus-imapd-2.2.7/cyrus-imapd-2.2.7-rmquota+deletemailbox-0.1.diff
-Patch4:			http://servercc.oakton.edu/~jwade/cyrus/cyrus-imapd-2.1.3/cyrus-imapd-2.1.3-flock.patch
-Patch5:			cyrus-imapd-2.2.4-munge8bit.patch
-Patch6:			cyrus-imapd-2.1.16-getrlimit.patch
-Patch7:			cyrus-imapd-2.1.15-nobarenewlinescheck.patch
-Patch8:			cyrus-imapd-2.2.4-allnumeric.patch
-Patch9:			cyrus-imapd-2.2.4-OE-seenstate.patch
-Patch10:		cyrus-imapd-acceptinvalidfrom.patch
-Patch11:		cyrus-imapd-2.2.12-dontstrip.patch
-Patch12:		cyrus-imapd-2.2.12-off-by-one-null.patch
-Patch13:		cyrus-imapd-2.2.12-getgrouplist.patch
-Patch14:		cyrus-imapd-2.2.12-quota64b.patch
-Patch15:		cyrus-imapd-2.2.12-autocreate-crashfix1.diff
-#for rhbz#505425
-Patch16:                cyrus-imapd-2.2.12-encode64.patch
-#from upstream, rhbz#521056
-Patch17:		cyrus-imapd-2.3.7-bufov.patch
-
-Patch51:                cyrus-imapd-2.2.12-config.patch
-Patch52:                cyrus-imapd-2.2.12-db48.patch
-# Patches >= 100 are fixed in CVS
-Patch100:		cyrus-imapd-2.2.13-2817.patch
-Patch101:		cyrus-imapd-2.2.13p1_CVE-2011-3208.patch
-Patch102:		cyrus-imapd_CVE-2011-1926.patch
-Patch103:		cyrus-imapd-2.2.13p1_SA46093.patch
-#Patch104:		cyrus-imapd-2.2.13p1_CVE-2011-3481.patch
-Patch104: 		cyrus-imapd-2.3.7-CVE-2011-3481.patch
-
-BuildRoot:		%{_tmppath}/%{name}-%{version}-root
-BuildRequires:		cyrus-sasl-devel >= 2.1.15-1
-BuildRequires:		perl
-BuildRequires:		tcp_wrappers
-BuildRequires:		%{_dbver}-devel
-BuildRequires:		openssl-devel
-BuildRequires:		flex, bison, groff >= 1.15-8
-BuildRequires:		autoconf
-%if %{krb5}
-BuildRequires:		krb5-devel
-%endif
-Requires:		cyrus-sasl >= 2.1.15
-Requires:		file >= 3.35-1
-Requires(pre):		coreutils shadow-utils /sbin/service
-Requires(post):		coreutils make diffutils e2fsprogs grep
-Requires(post):		db4-utils file /sbin/chkconfig
-Requires(postun):	shadow-utils /sbin/service
-Requires(preun):	/sbin/service /sbin/chkconfig
-
-%define		uid 76
-%if %{SASLGROUP}
-%define		gid 76
-%define		_saslgroup saslauth
-%endif
-%define		_cyrususer cyrus
-%define		_cyrusgroup mail
-%define		_vardata %{_var}/lib/imap
-%define		_spooldata %{_var}/spool/imap
-%define		_cyrexecdir %{_exec_prefix}/lib/%{name}
-%define		_confdir master/conf
-%define		_contribdir %{_datadir}/%{name}/contrib
-%if %{PREFORK}
-%define		_cyrusconf %{_confdir}/prefork.conf
-%else
-%define		_cyrusconf %{_confdir}/normal.conf
-%endif
 
 %description
 The %{name} package contains the core of the Cyrus IMAP server.
@@ -181,11 +86,24 @@ internet mail technologies.
 A full Cyrus IMAP implementation allows a seamless mail and bulletin
 board environment to be set up across multiple servers. It differs from
 other IMAP server implementations in that it is run on "sealed"
-servers, where users are not normally permitted to log in. The mailbox
-database is stored in parts of the filesystem that are private to the
-Cyrus IMAP server. All user access to mail is through software using
-the IMAP, POP3, or KPOP protocols. TLSv1 and SSL are supported for
-security.
+servers, where users are not normally permitted to log in and have no
+system account on the server. The mailbox database is stored in parts
+of the file system that are private to the Cyrus IMAP server. All user
+access to mail is through software using the IMAP, POP3 or KPOP
+protocols. It also includes support for virtual domains, NNTP,
+mailbox annotations, and much more. The private mailbox database design
+gives the server large advantages in efficiency, scalability and
+administratability. Multiple concurrent read/write connections to the
+same mailbox are permitted. The server supports access control lists on
+mailboxes and storage quotas on mailbox hierarchies.
+
+The Cyrus IMAP server supports the IMAP4rev1 protocol described
+in RFC 3501. IMAP4rev1 has been approved as a proposed standard.
+It supports any authentication mechanism available from the SASL
+library, imaps/pop3s/nntps (IMAP/POP3/NNTP encrypted using SSL and
+TLSv1) can be used for security. The server supports single instance
+store where possible when an email message is addressed to multiple
+recipients, SIEVE provides server side email filtering.
 
 %description -l ja
 Cyrus-IMAP サーバは基本的な技術を用い、小規模から大規模なエンタープライズ用途
@@ -199,8 +117,8 @@ IMAP, POP3, KPOP プロトコルを通してのみメールにアクセスでき
 のために TLSv1 と SSL をサポートしています。
 
 %package murder
-Group: System Environment/Daemons
 Summary: Cyrus IMAP server murder aggregator system files.
+Group: System Environment/Daemons
 Requires: %{name} = %{version}-%{release}
 
 %description murder
@@ -210,8 +128,8 @@ It allows for cluster setups where there are many backend Cyrus spools
 and frontend proxy servers.
 
 %package nntp
-Group: System Environment/Daemons
 Summary: Cyrus IMAP server NNTP system files.
+Group: System Environment/Daemons
 Requires: %{name} = %{version}-%{release}
  
 %description nntp
@@ -221,8 +139,9 @@ mailboxes via NNTP. This is made possible by a new NNTP daemon which is
 included with Cyrus.
 
 %package devel
-Group: Development/Libraries
 Summary: Cyrus IMAP server development files.
+Summary(ja): Cyrus IMAP サーバーの開発用ファイル
+Group: Development/Libraries
 Requires: %{name} = %{version}-%{release}
 
 %description devel
@@ -230,9 +149,9 @@ The %{name}-devel package contains header files and libraries
 necessary for developing applications which use the imclient library.
 
 %package -n perl-Cyrus
-Group: Development/Libraries
 Summary: Cyrus IMAP server utility Perl modules.
-Requires: perl(:MODULE_COMPAT_%(eval "`perl -V:version`"; echo $version))
+Group: Development/Libraries
+Requires: perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))
 
 %description -n perl-Cyrus
 The perl-Cyrus package contains Perl modules necessary to use the
@@ -242,6 +161,9 @@ Cyrus IMAP server administration utilities.
 Group: Applications/System
 Summary: Cyrus IMAP server administration utilities.
 Requires: perl-Cyrus = %{version}-%{release}
+Requires(pre): shadow-utils
+Requires(post): grep, coreutils, make, openssl
+Requires(postun): shadow-utils
 
 %description utils
 The %{name}-utils package contains administrative tools for the
@@ -250,320 +172,192 @@ one running the server.
 
 %prep
 %setup -q
-%patch0 -p0 -b .fdatasync
-%if %{AUTOCREATE}
-%patch1 -p1 -b .autocreate
-%patch2 -p1 -b .autosieve
-%patch3 -p1 -b .rmquota
-%endif
-%patch4 -p1 -b .flock
-%patch5 -p1 -b .munge8bit
-%patch6 -p1 -b .getrlimit
-%if %{NO_BARE_NL}
-%patch7 -p1 -b .nobarenewlinescheck
-%endif
-%if %{ALLNUMERIC}
-%patch8 -p1 -b .allnumeric
-%endif
-%if %{OE_SEEN_ST}
-%patch9 -p1 -b .oeseenstate
-%endif
-%patch10 -p1 -b .acceptinvalidfrom
-%patch11 -p1 -b .dontstrip
-#patch12 -p1 -b .off-by-one-null
-%patch13 -p1 -b .getgrouplist
-#patch14 -p1 -b .quota64b
-%patch15 -p1 -b .autocreate-crashfix1
-%patch16 -p1 -b .encode64
-#patch17 -p1 -b .bufov
-
-%patch51 -p1 -b .config
-%patch52 -p1 -b .db46
-
-%patch100 -p0 -b .2817
-%patch101 -p1 -b .CVE-2011-3208
-%patch102 -p1 -b .CVE-2011-1926
-%patch103 -p1 -b .SA46093
-%patch104 -p1 -b .CVE-2011-3481
-
-aclocal -I ./cmulocal
-autoconf -I ./cmulocal
+%patch3 -p1 -b .flock
+%patch4 -p1 -b .authid_normalize
+%patch6 -p1 -b .libdb
+%patch8 -p1 -b .debugopt
+
+install -m 644 %{SOURCE11} doc/
+
+# only to update config.* files
+automake -a -f -c || :
+aclocal -I cmulocal
+autoheader
+autoconf -f
+
+# Modify docs master --> cyrus-master
+%{__perl} -pi -e "s@master\(8\)@cyrus-master(8)@" man/*5 man/*8 lib/imapoptions
+sed -i -e 's|\([^-]\)master|\1cyrus-master|g;s|^master|cyrus-master|g;s|Master|Cyrus-master|g;s|MASTER|CYRUS-MASTER|g' \
+        man/master.8 doc/man.html
+
+# Modify path in perl scripts
+find . -type f -name "*.pl" | xargs %{__perl} -pi -e "s@/usr/local/bin/perl@%{__perl}@"
+
+# modify lmtp socket path in .conf files
+%{__perl} -pi -e "s@/var/imap/@%{_var}/lib/imap/@" master/conf/*.conf doc/cyrusv2.mc
+
+# enable idled in .conf files to prevent error messages
+%{__perl} -pi -e "s/#  idled/  idled/" master/conf/*.conf
+
+# Fix permissions on perl programs
+find . -type f -name "*.pl" -exec chmod 755 {} \;
+
 
 %build
-# kerberos include is needed (because of openssl-0.9.7 ?)
-CPPFLAGS="-I%{_includedir}/et -I%{_prefix}/kerberos/include"; export CPPFLAGS
-CFLAGS="$RPM_OPT_FLAGS -fPIC"; export CFLAGS
+%global _hardened_build 1
+
+CPPFLAGS="%{optflags} -I%{_includedir}/et -I%{_includedir}/krb5 -fno-strict-aliasing -fPIC"; export CPPFLAGS
+CFLAGS="%{optflags} -fno-strict-aliasing -fPIC"; export CFLAGS
 CCDLFLAGS="-rdynamic"; export CCDLFLAGS
-LDFLAGS="-L%{_prefix}/kerberos/%{_lib}"; export LDFLAGS
-%if %{USEPIE}
+LDFLAGS="-Wl,-z,now -Wl,-z,relro"
 %ifnarch ppc ppc64
 LDFLAGS="$LDFLAGS -pie"; export LDFLAGS
 %endif
-%endif
 
 %configure \
-%if %{NETSCAPEHACK}
   --enable-netscapehack \
-%endif
-%if %{LISTEXT}
-  --enable-listext \
-%endif
-%if %{IDLED}
-  --with-idle=idled \
-%endif
-%if !%{krb5}
-  --disable-gssapi \
-%endif
+  --enable-idled \
+  --with-ldap=/usr \
+  --with-snmp \
   --enable-murder \
+  --enable-replication \
   --enable-nntp \
-  --without-snmp \
   --with-perl=%{__perl} \
   --with-cyrus-prefix=%{_cyrexecdir} \
   --with-service-path=%{_cyrexecdir} \
-  --with-auth=%{AUTH_METHOD} \
-  --with-bdb-incdir=%{_includedir}/%{_dbver} \
-  --with-extraident="Invoca-RPM-%{version}-%{release}" \
-  --with-syslogfacility=%{SYSLOGFACILITY} 
-
-%{__make}
-%if %{DEL_WRAP}
-%{__cc} -DLIBEXECDIR=\"%{_cyrexecdir}\" -Wall -o deliver-wrapper %{SOURCE3}
-%endif
-
-# Modify docs master --> cyrus-master
-pushd man
-  %{__perl} -pi -e "s@master\(8\)@cyrus-master(8)@" $(ls *5 *8)
-popd
-pushd doc
-  %{__perl} -pi -e "s@master@cyrus-master@g;" man.html
-popd
-pushd doc/man
-  %{__perl} -pi -e "s@master\(8\)@cyrus-master(8)@;" $(ls *html)
-popd
-
-# Modify path in perl scripts
-%{__perl} -pi -e "s@/usr/local/bin/perl@%{__perl}@" $(find . -type f -name "*.pl")
-
-# Fix permissions on perl programs
-find . -type f -name "*.pl" -exec %{__chmod} 755 {} \;
-
-# Cleanup of doc dir
-find doc perl -name CVS -type d | xargs -r %{__rm} -fr
-find doc -name "*~" -type f | xargs -r %{__rm} -f
-%{__rm} -f doc/Makefile.dist
-%{__rm} -f doc/text/htmlstrip.c
+  --with-bdb-incdir=%{_includedir}/libdb \
+  --with-extraident="Vine-RPM-%{version}-%{release}" \
+  --with-syslogfacility=MAIL \
+  --with-krbimpl=mit
+#  --enable-listext \
 
-# Create README.buildoptions
-%{__cat} << EOF >> doc/README.buildoptions
-This RPM has been compiled on %{_vlrelease} using
-Berkeley DB version %{_dbrpmver} with the following source
-RPM build options:
-
-use saslauth group
-SASLGROUP       : %{SASLGROUP}
-
-include deliver-wrapper
-DEL_WRAP        : %{DEL_WRAP}
-
-use preforking cyrus.conf
-PREFORK         : %{PREFORK}
-
-enable Netscape hack (recommended)
-NETSCAPEHACK    : %{NETSCAPEHACK}
-
-enable IMAP4 LIST extensions
-LISTEXT         : %{LISTEXT}
-
-enable IDLED support
-IDLED           : %{IDLED}
-
-force syncronous updates on ext3
-FORCESYNCEXT3   : %{FORCESYNCEXT3}
-
-include autocreate feature
-AUTOCREATE      : %{AUTOCREATE}
-
-include allnumeric patch
-ALLNUMERIC      : %{ALLNUMERIC}
-
-include nobarenewlinescheck patch
-NO_BARE_NL      : %{NO_BARE_NL}
-
-used syslog facility for logging
-SYSLOGFACILITY  : %{SYSLOGFACILITY}
-
-used -fpie for linking
-USEPIE          : %{USEPIE}
-
-include OutlookExpress seenstate patch
-OE_SEEN_ST      : %{OE_SEEN_ST}
-
-use authorization module METHOD [unix|krb5]
-AUTH_METHOD     : %{AUTH_METHOD}
-
-
-To modify parameters, edit the .spec file or build like this:
-rpm --rebuild --define='FULLDIRHASH 1' %{name}-%{version}-%{release}.src.rpm
-EOF
-
-%{__install} -m 644 %{SOURCE23}	doc/README.RPM
-%{__install} -m 644 %{SOURCE24}	doc/README.HOWTO-recover-mailboxes.db
-%if %{AUTOCREATE}
-%{__install} -m 644 %{SOURCE8}  doc/README.autocreate
-%{__install} -m 644 %{SOURCE9}  doc/README.autosievefolder
-%endif
-%{__install} -d doc/m4
-%{__install} -m 644 %{SOURCE2}	doc/m4/cyrus-procmailrc
-%{__install} -m 644 %{SOURCE4}	doc/m4/cyrus-user-procmailrc.template
-%{__install} -m 644 %{SOURCE27}	doc/m4/%{name}-procmail+cyrus.mc
-%{__install} -m 644 %{SOURCE29}	doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4
-
-# modify lmtp socket path in .conf files
-%{__perl} -pi -e "s@/var/imap/@%{_vardata}/@" %{_confdir}/*.conf doc/cyrusv2.mc doc/m4/%{name}-sendmail-8.12.9-cyrusv2.m4
+make -C man -f Makefile.dist
+make -C doc -f Makefile.dist
+make LDFLAGS="$LDFLAGS -pie"
+make -C notifyd notifytest
 
 %install
 [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
 
-# This hack is needed on RedHat > 7.3 to install the perl files correctly
-%if %{_perlhack}
+# This is needed to install the perl files correctly
 pushd perl/imap
-  %{__perl} Makefile.PL INSTALLDIRS=vendor
+  %{__perl} Makefile.PL PREFIX=%{buildroot}%{_prefix} INSTALLDIRS=vendor
 popd
 pushd perl/sieve/managesieve
-  %{__perl} Makefile.PL INStALLDIRS=vendor
+  %{__perl} Makefile.PL PREFIX=%{buildroot}%{_prefix} INSTALLDIRS=vendor
 popd
 
 # Do what the regular make install does
-  %{__make} install DESTDIR=%{buildroot} PREFIX=%{_prefix} mandir=%{_mandir}
-  %{__make} -C man install DESTDIR=%{buildroot} PREFIX=%{_prefix} mandir=%{_mandir}
-%else
-  %{__make} install DESTDIR=%{buildroot} PREFIX=%{buildroot}%{_prefix} mandir=%{_mandir}
-  %{__make} -C man install DESTDIR=%{buildroot} PREFIX=%{buildroot}%{_prefix} mandir=%{_mandir}
-%endif
+make install DESTDIR=%{buildroot} PREFIX=%{_prefix} mandir=%{_mandir}
+make -C man install DESTDIR=%{buildroot} PREFIX=%{_prefix} mandir=%{_mandir}
 
-%if %{DEL_WRAP}
-%{__install} -s -m 2755 deliver-wrapper	%{buildroot}%{_cyrexecdir}/
-%endif
-%{__install} -m 755 imtest/imtest	%{buildroot}%{_cyrexecdir}/
-%{__install} -m 755 perl/imap/cyradm	%{buildroot}%{_cyrexecdir}/
+install -m 755 imtest/imtest       %{buildroot}%{_bindir}/
+install -m 755 notifyd/notifytest  %{buildroot}%{_bindir}/
+install -m 755 perl/imap/cyradm    %{buildroot}%{_bindir}/
 
 # Install tools
 for tool in tools/* ; do
-  test -f ${tool} && %{__install} -m 755 ${tool} %{buildroot}%{_cyrexecdir}/
+  test -f ${tool} && install -m 755 ${tool} %{buildroot}%{_cyrexecdir}/
 done
 
 # Create directories
 %{__install} -d \
   %{buildroot}%{_sysconfdir}/{rc.d/init.d,logrotate.d,pam.d,sysconfig,cron.daily} \
   %{buildroot}%{_libdir}/sasl \
-  %{buildroot}%{_bindir} \
-  %{buildroot}%{_spooldata} \
-  %{buildroot}%{_vardata}/{user,quota,proc,log,msg,socket,db,sieve,rpm,backup} \
-  %{buildroot}%{_contribdir} \
-  %{buildroot}%{_datadir}/%{name}/rpm
+  %{buildroot}%{_var}/spool/imap \
+  %{buildroot}%{_var}/lib/imap/{user,quota,proc,log,msg,socket,db,sieve,sync,md5,rpm,backup,meta} \
+  %{buildroot}%{_var}/lib/imap/ptclient \
+  %{buildroot}%{_datadir}/%{name}/rpm \
+  %{buildroot}%{_sysconfdir}/pki/%{name} \
+  doc/contrib
 
 # Install additional files
-%{__install} -m 755 %{SOURCE11}   %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
-%{__install} -m 755 %{SOURCE13}   %{buildroot}%{_cyrexecdir}/cvt_cyrusdb_all
-%{__install} -m 755 %{SOURCE28}   %{buildroot}%{_cyrexecdir}/rpm_set_permissions
-%{__install} -m 644 %{SOURCE14}   %{buildroot}%{_datadir}/%{name}/rpm/magic
-%{__install} -m 755 %{SOURCE15}   %{buildroot}%{_contribdir}/imapcreate
-%{__install} -m 755 %{SOURCE16}   %{buildroot}%{_contribdir}/cyrus_ldap_quota
-%{__install} -m 755 %{SOURCE17}   %{buildroot}%{_contribdir}/batchreconstruct
-%{__install} -m 755 %{SOURCE18}   %{buildroot}%{_contribdir}/bsd2cyrus
-%{__install} -m 755 %{SOURCE19}   %{buildroot}%{_contribdir}/cpmsg
-%{__install} -m 755 %{SOURCE20}   %{buildroot}%{_contribdir}/folderxfer
-%{__install} -m 755 %{SOURCE21}   %{buildroot}%{_contribdir}/inboxfer
-%{__install} -m 644 %{SOURCE22}   %{buildroot}%{_contribdir}/
-%{__install} -m 644 %{SOURCE30}   %{buildroot}%{_contribdir}/README
-%{__install} -m 644 %{SOURCE10}   %{buildroot}%{_datadir}/%{name}/rpm/db.cfg
-
-# Install config files
-%{__install} -m 644 %{_cyrusconf} %{buildroot}%{_sysconfdir}/cyrus.conf
-%{__install} -m 644 %{SOURCE6}    %{buildroot}%{_sysconfdir}/imapd.conf
-%{__install} -m 644 %{SOURCE7}    %{buildroot}%{_sysconfdir}/pam.d/pop
-%{__install} -m 644 %{SOURCE7}    %{buildroot}%{_sysconfdir}/pam.d/imap
-%{__install} -m 644 %{SOURCE7}    %{buildroot}%{_sysconfdir}/pam.d/sieve
-%{__install} -m 644 %{SOURCE7}    %{buildroot}%{_sysconfdir}/pam.d/mupdate
-%{__install} -m 644 %{SOURCE7}    %{buildroot}%{_sysconfdir}/pam.d/lmtp
-%{__install} -m 644 %{SOURCE7}    %{buildroot}%{_sysconfdir}/pam.d/news
-%{__install} -m 644 %{SOURCE12}   %{buildroot}%{_sysconfdir}/sysconfig/%{name}
-%{__install} -m 644 %{SOURCE5}    %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
-%{__install} -m 755 %{SOURCE25}   %{buildroot}%{_sysconfdir}/cron.daily/%{name}
-
-#%{__cat} %{SOURCE11} | %{__sed} -e 's,/usr/lib,%{_libdir},g' > %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
-#%{__chmod} 755 %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
+install -m 755 %{SOURCE8}   %{buildroot}%{_cyrexecdir}/cvt_cyrusdb_all
+install -m 644 %{SOURCE9}   %{buildroot}%{_datadir}/%{name}/rpm/magic
+install -p -m 644 master/conf/prefork.conf %{buildroot}%{_sysconfdir}/cyrus.conf
+install -p -m 644 %{SOURCE2}    %{buildroot}%{_sysconfdir}/imapd.conf
+install -p -m 644 %{SOURCE3}    %{buildroot}%{_sysconfdir}/pam.d/pop
+install -p -m 644 %{SOURCE3}    %{buildroot}%{_sysconfdir}/pam.d/imap
+install -p -m 644 %{SOURCE3}    %{buildroot}%{_sysconfdir}/pam.d/sieve
+install -p -m 644 %{SOURCE3}    %{buildroot}%{_sysconfdir}/pam.d/mupdate
+install -p -m 644 %{SOURCE3}    %{buildroot}%{_sysconfdir}/pam.d/lmtp
+install -p -m 644 %{SOURCE3}    %{buildroot}%{_sysconfdir}/pam.d/nntp
+install -p -m 644 %{SOURCE3}    %{buildroot}%{_sysconfdir}/pam.d/csync
+install -p -m 644 %{SOURCE1}    %{buildroot}%{_sysconfdir}/logrotate.d/%{name}
+install -p -m 644 %{SOURCE7}   %{buildroot}%{_sysconfdir}/sysconfig/%{name}
+install -p -m 755 %{SOURCE10}   %{buildroot}%{_sysconfdir}/cron.daily/%{name}
+
+%{__install} -m 755 %{SOURCE100}   %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
+%{__sed} -i -e 's,__LIB__,/usr/lib,g' %{buildroot}%{_sysconfdir}/rc.d/init.d/%{name}
+
+#install -p -D -m 644 %{SOURCE12}   %{buildroot}%{_unitdir}/cyrus-imapd.service
+#install -p -D -m 755 %{SOURCE13}   %{buildroot}%{_cyrexecdir}/cyr_systemd_helper
+
+%{__install} -m 644 %{SOURCE101}   %{buildroot}%{_datadir}/%{name}/rpm/db.cfg
+
+# Cleanup of doc dir
+find doc perl -name CVS -type d -prune -exec rm -rf {} \;
+find doc perl -name .cvsignore -type f -exec rm -f {} \;
+rm -f doc/Makefile.dist*
+rm -f doc/text/htmlstrip.c
+rm -f doc/text/Makefile
+rm -rf doc/man
+
+# fix permissions on perl .so files
+find %{buildroot}%{_libdir}/perl5/ -type f -name "*.so" -exec chmod 755 {} \;
+
+# fix conflicts with uw-imap
+mv %{buildroot}%{_mandir}/man8/imapd.8 %{buildroot}%{_mandir}/man8/imapd.8cyrus
+mv %{buildroot}%{_mandir}/man8/pop3d.8 %{buildroot}%{_mandir}/man8/pop3d.8cyrus
 
 # Install templates
-%{__install} -m 755 -d doc/conf
-%{__install} -m 644 %{_confdir}/*.conf doc/conf/
+install -m 755 -d doc/conf
+install -m 644 master/conf/*.conf doc/conf/
+
+# Generate db config file
+#( grep '^{' lib/imapoptions | grep _db | cut -d'"' -f 2,4 | \
+#  sed -e 's/^ *//' -e 's/-nosync//' -e 's/ *$//' -e 's/"/=/'
+#  echo sieve_version=2.2.3 ) | sort > %{buildroot}%{_datadir}/%{name}/rpm/db.cfg
+
+# create the ghost pem file
+touch %{buildroot}%{ssl_pem_file}
 
 # Rename 'master' binary and manpage to avoid crash with postfix
-%{__mv} -f %{buildroot}%{_cyrexecdir}/master         %{buildroot}%{_cyrexecdir}/cyrus-master
-%{__mv} -f %{buildroot}%{_mandir}/man8/master.8      %{buildroot}%{_mandir}/man8/cyrus-master.8
-%{__mv} -f doc/man/master.8.html                     doc/man/cyrus-master.8.html
-%{__perl} -pi -e 's/master/cyrus-master/g'           %{buildroot}%{_mandir}/man8/cyrus-master.8
-%{__perl} -pi -e 's/Master/Cyrus-master/g'           %{buildroot}%{_mandir}/man8/cyrus-master.8
-%{__perl} -pi -e 's/MASTER/CYRUS-MASTER/g'           %{buildroot}%{_mandir}/man8/cyrus-master.8
-%{__perl} -pi -e 's/master/cyrus-master/g'           doc/man/cyrus-master.8.html
-%{__perl} -pi -e 's/Master/Cyrus-master/g'           doc/man/cyrus-master.8.html
-%{__perl} -pi -e 's/MASTER/CYRUS-MASTER/g'           doc/man/cyrus-master.8.html
-
-# Rename 'fetchnews' binary and manpage to avoid crash with leafnode
-%{__mv} -f %{buildroot}%{_cyrexecdir}/fetchnews      %{buildroot}%{_cyrexecdir}/cyrfetchnews
-%{__mv} -f %{buildroot}%{_mandir}/man8/fetchnews.8   %{buildroot}%{_mandir}/man8/cyrfetchnews.8
-%{__mv} -f doc/man/fetchnews.8.html                  doc/man/cyrfetchnews.8.html
-%{__perl} -pi -e 's/fetchnews/cyrfetchnews/g'        %{buildroot}%{_mandir}/man8/cyrfetchnews.8
-%{__perl} -pi -e 's/Fetchnews/Cyrfetchnews/g'        %{buildroot}%{_mandir}/man8/cyrfetchnews.8
-%{__perl} -pi -e 's/FETCHNEWS/CYRFETCHNEWS/g'        %{buildroot}%{_mandir}/man8/cyrfetchnews.8
-%{__perl} -pi -e 's/fetchnews/cyrfetchnews/g'        doc/man/cyrfetchnews.8.html
-%{__perl} -pi -e 's/Fetchnews/Cyrfetchnews/g'        doc/man/cyrfetchnews.8.html
-%{__perl} -pi -e 's/FETCHNEWS/CYRFETCHNEWS/g'        doc/man/cyrfetchnews.8.html
-
-# Create symlinks
-%{__ln_s} -f %{_cyrexecdir}/cyradm %{buildroot}%{_bindir}/
-%{__ln_s} -f %{_cyrexecdir}/imtest %{buildroot}%{_bindir}/
-
-# Create filelist for perl package, compress manpages before
-[ -x /usr/lib/rpm/brp-compress ] && /usr/lib/rpm/brp-compress
-find %{buildroot}%{perl_vendorarch}/Cyrus %{buildroot}%{perl_vendorarch}/auto/Cyrus -type f -print |
-  %{__sed} "s@^%{buildroot}@@g" |
-  %{__grep} -v perllocal.pod |
-  %{__grep} -v "\.packlist" > perl-Cyrus-%{version}-filelist
-find %{buildroot}%{_perl_man3dir} -type f -name "Cyrus*" -print |
-  %{__sed} "s@^%{buildroot}@@g" >> perl-Cyrus-%{version}-filelist
-if [ "$(%{__cat} perl-Cyrus-%{version}-filelist)X" = "X" ] ; then
-  echo "ERROR: EMPTY FILE LIST"
-  exit -1
-fi
+mv -f %{buildroot}%{_cyrexecdir}/master         %{buildroot}%{_cyrexecdir}/cyrus-master
+mv -f %{buildroot}%{_mandir}/man8/master.8      %{buildroot}%{_mandir}/man8/cyrus-master.8
+
+# Rename 'fetchnews' binary and manpage to avoid clash with leafnode
+mv -f %{buildroot}%{_cyrexecdir}/fetchnews      %{buildroot}%{_cyrexecdir}/cyrfetchnews
+mv -f %{buildroot}%{_mandir}/man8/fetchnews.8   %{buildroot}%{_mandir}/man8/cyrfetchnews.8
+%{__perl} -pi -e 's|fetchnews|cyrfetchnews|g;s|Fetchnews|Cyrfetchnews|g;s/FETCHNEWS/CYRFETCHNEWS/g' \
+        %{buildroot}%{_mandir}/man8/cyrfetchnews.8
 
-# Strip binaries
-%{__strip} --strip-unneeded %{buildroot}%{_cyrexecdir}/* ||:
+#remove executable bit from docs
+for ddir in doc perl/imap/examples
+do
+  find $ddir -type f -exec chmod -x {} \;
+done
 
 # Remove installed but not packaged files
-%{__rm} -f %{buildroot}%{_cyrexecdir}/not-mkdep
-%{__rm} -f %{buildroot}%{_cyrexecdir}/config2header
-%{__rm} -f %{buildroot}%{_cyrexecdir}/config2man
-%{__rm} -f %{buildroot}%{_cyrexecdir}/pop3proxyd
-find %{buildroot} -name "perllocal.pod" -exec %{__rm} -f {} \;
-find %{buildroot} -name ".packlist" -exec %{__rm} -f {} \;
+rm -f %{buildroot}%{_cyrexecdir}/not-mkdep
+rm -f %{buildroot}%{_cyrexecdir}/config2header*
+rm -f %{buildroot}%{_cyrexecdir}/config2man
+rm -f %{buildroot}%{_cyrexecdir}/pop3proxyd
+find %{buildroot} -name "perllocal.pod" -exec rm -f {} \;
+find %{buildroot} -name ".packlist" -exec rm -f {} \;
+rm -f %{buildroot}%{_mandir}/man8/syncnews.8*
+find %{buildroot}%{perl_vendorarch} -name "*.bs" -exec rm -f {} \;
 
-# On RedHat 7.3, this file is created here
-%{__rm} -f /perllocal.pod
 
 %clean
 [ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}
 
 %pre
 # Create 'cyrus' user on target host
-%if %{SASLGROUP}
-/usr/sbin/groupadd -g %{gid} -r %{_saslgroup} 2> /dev/null || :
-/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \
-  -G %{_saslgroup} -s /bin/bash -u %{uid} -r %{_cyrususer} 2> /dev/null || :
-%else
-/usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_vardata} -g %{_cyrusgroup} \
-  -s /bin/bash -u %{uid} -r %{_cyrususer} 2> /dev/null || :
-%endif
+getent group saslauth >/dev/null || /usr/sbin/groupadd -g %{gid} -r saslauth 
+getent passwd cyrus >/dev/null || /usr/sbin/useradd -c "Cyrus IMAP Server" -d %{_var}/lib/imap -g %{_cyrusgroup} \
+  -G saslauth -s /sbin/nologin -u %{uid} -r %{_cyrususer}
+
 # Let postun know whether cyrus-imapd was running
 if [ -e /var/lock/subsys/cyrus-imapd ]; then
   /sbin/service %{name} stop >/dev/null 2>&1 || :
@@ -573,12 +367,18 @@ fi
 %post
 /sbin/chkconfig --add %{name}
 
-# Create SSL certificates
-exec > /dev/null 2> /dev/null
-if [ ! -f %{_datadir}/ssl/certs/%{name}.pem ]; then
-pushd %{_datadir}/ssl/certs
+# Force synchronous updates, usually only on ext2 filesystems
+for i in %{_var}/lib/imap/{user,quota} %{_var}/spool/imap
+do
+  if [ "$(find $i -maxdepth 0 -printf %%F)" = "ext2" ]; then
+    chattr -R +S $i 2>/dev/null ||:
+  fi
+done
+
+if [ ! -f %{ssl_pem_file} ]; then
+pushd %{_sysconfdir}/pki/tls/certs
 umask 077
-%{__cat} << EOF | make %{name}.pem
+cat << EOF | make %{name}.pem
 --
 SomeState
 SomeCity
@@ -587,23 +387,12 @@ SomeOrganizationalUnit
 localhost.localdomain
 root@localhost.localdomain
 EOF
-%{__chown} root.%{_cyrusgroup} %{name}.pem
-%{__chmod} 640 %{name}.pem
+chown root.%{_cyrusgroup} %{name}.pem
+chmod 640 %{name}.pem
+mv %{name}.pem %{ssl_pem_file}
 popd
 fi
 
-# Force synchronous updates, usually only on ext2 filesystems
-for i in %{_vardata}/{user,quota} %{_spooldata}
-do
-%if %{FORCESYNCEXT3}
-  if [ $(find $i -maxdepth 0 -printf %%F) = "ext2" -o $(find $i -maxdepth 0 -printf %%F) = "ext3" ]; then
-%else
-  if [ $(find $i -maxdepth 0 -printf %%F) = "ext2" ]; then
-%endif
-    chattr -R +S $i 2>/dev/null
-  fi
-done
-
 # Add service entries if necessary
 if ! %{__grep} -q ^lmtp %{_sysconfdir}/services; then
   echo -e 'lmtp\t\t24/tcp\t\t\t\t# LMTP Mail Delivery over TCP' >> %{_sysconfdir}/services
@@ -644,126 +433,173 @@ fi
 %postun
 if [ $1 = 0 ]; then
   /usr/sbin/userdel %{_cyrususer} 2> /dev/null || :
-%if %{SASLGROUP}
   if [ "$(%{__grep} ^%{_saslgroup}: %{_sysconfdir}/group | cut -d: -f4-)" = "" ]; then
     /usr/sbin/groupdel %{_saslgroup} 2> /dev/null || :
   fi
-%endif
 else
   /sbin/service %{name} condrestart >/dev/null 2>&1 || :
 fi
 
 %files
-%defattr(0644,root,root,0755)
-%config %{_sysconfdir}/cyrus.conf
-%config %{_sysconfdir}/imapd.conf
-%attr(0755,root,root) %config %{_sysconfdir}/rc.d/init.d/%{name}
-%config %{_sysconfdir}/logrotate.d/%{name}
+%defattr(-,root,root,-)
+%doc COPYRIGHT README
+%doc doc/*
+%config(noreplace) %{_sysconfdir}/cyrus.conf
+%config(noreplace) %{_sysconfdir}/imapd.conf
+%config(noreplace) %{_sysconfdir}/logrotate.d/%{name}
 %config(noreplace) %{_sysconfdir}/sysconfig/%{name}
-%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/pop
-%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/imap
-%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/sieve
-%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/lmtp
-%attr(0755,root,root) %config %{_sysconfdir}/cron.daily/%{name}
+%config(noreplace) %{_sysconfdir}/pam.d/pop
+%config(noreplace) %{_sysconfdir}/pam.d/imap
+%config(noreplace) %{_sysconfdir}/pam.d/sieve
+%config(noreplace) %{_sysconfdir}/pam.d/lmtp
+%config(noreplace) %{_sysconfdir}/pam.d/csync
+%{_sysconfdir}/cron.daily/%{name}
+%{_sysconfdir}/rc.d/init.d/%{name}
+#{_unitdir}/cyrus-imapd.service
 %dir %{_cyrexecdir}
-%attr(0755,root,root) %{_cyrexecdir}/arbitron
-%attr(0755,root,root) %{_cyrexecdir}/arbitronsort.pl
-%attr(0755,root,root) %{_cyrexecdir}/chk_cyrus
-%attr(0755,root,root) %{_cyrexecdir}/convert-sieve.pl
-%attr(0755,root,root) %{_cyrexecdir}/ctl_cyrusdb
-%attr(0755,root,root) %{_cyrexecdir}/ctl_deliver
-%attr(0755,root,root) %{_cyrexecdir}/ctl_mboxlist
-%attr(0755,root,root) %{_cyrexecdir}/cvt_cyrusdb
-%attr(0755,root,root) %{_cyrexecdir}/cyr_expire
-%attr(0755,root,root) %{_cyrexecdir}/cyrdump
-%attr(0755,root,root) %{_cyrexecdir}/cyrus-master
-%attr(0755,root,root) %{_cyrexecdir}/dohash
-%attr(0755,root,root) %{_cyrexecdir}/fud
-%attr(0755,root,root) %{_cyrexecdir}/imapd
-%attr(0755,root,root) %{_cyrexecdir}/ipurge
-%attr(0755,root,root) %{_cyrexecdir}/lmtpd
-%attr(0755,root,root) %{_cyrexecdir}/masssievec
-%attr(0755,root,root) %{_cyrexecdir}/mbexamine
-%attr(0755,root,root) %{_cyrexecdir}/mbpath
-%attr(0755,root,root) %{_cyrexecdir}/mkimap
-%attr(0755,root,root) %{_cyrexecdir}/mknewsgroups
-%attr(0755,root,root) %{_cyrexecdir}/notifyd
-%attr(0755,root,root) %{_cyrexecdir}/pop3d
-%attr(0755,root,root) %{_cyrexecdir}/quota
-%attr(0755,root,root) %{_cyrexecdir}/reconstruct
-%attr(0755,root,root) %{_cyrexecdir}/rehash
-%attr(0755,root,root) %{_cyrexecdir}/sievec
-%attr(0755,root,root) %{_cyrexecdir}/smmapd
-%attr(0755,root,root) %{_cyrexecdir}/squatter
-%attr(0755,root,root) %{_cyrexecdir}/timsieved
-%attr(0755,root,root) %{_cyrexecdir}/tls_prune
-%attr(0755,root,root) %{_cyrexecdir}/translatesieve
-%attr(0755,root,root) %{_cyrexecdir}/undohash
-%attr(0755,root,root) %{_cyrexecdir}/upgradesieve
-%attr(0755,root,root) %{_cyrexecdir}/cvt_cyrusdb_all
-%attr(0755,root,root) %{_cyrexecdir}/rpm_set_permissions
-%if %{IDLED}
-%attr(0755,root,root) %{_cyrexecdir}/idled
-%endif
-%attr(4754,%{_cyrususer},%{_cyrusgroup}) %{_cyrexecdir}/deliver
-%if %{DEL_WRAP}
-%attr(2755,%{_cyrususer},%{_cyrusgroup}) %{_cyrexecdir}/deliver-wrapper
-%endif
-%attr(0750,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}
-%attr(0750,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/socket
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/user
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/quota
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/proc
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/log
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/msg
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/db
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/sieve
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/rpm
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_vardata}/backup
-%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_spooldata}
+#{_cyrexecdir}/cyr_systemd_helper
+%{_cyrexecdir}/arbitron
+%{_cyrexecdir}/arbitronsort.pl
+%{_cyrexecdir}/chk_cyrus
+%{_cyrexecdir}/convert-sieve.pl
+%{_cyrexecdir}/cyr_df
+%{_cyrexecdir}/ctl_cyrusdb
+%{_cyrexecdir}/ctl_deliver
+%{_cyrexecdir}/ctl_mboxlist
+%{_cyrexecdir}/cvt_cyrusdb
+%{_cyrexecdir}/cyr_dbtool
+%{_cyrexecdir}/cyr_expire
+%{_cyrexecdir}/cyr_sequence
+%{_cyrexecdir}/cyr_synclog
+%{_cyrexecdir}/cyr_userseen
+%{_cyrexecdir}/cyrdump
+%{_cyrexecdir}/cyrus-master
+%{_cyrexecdir}/deliver
+%{_cyrexecdir}/dohash
+%{_cyrexecdir}/fud
+%{_cyrexecdir}/imapd
+%{_cyrexecdir}/ipurge
+%{_cyrexecdir}/lmtpd
+%{_cyrexecdir}/masssievec
+%{_cyrexecdir}/mbexamine
+%{_cyrexecdir}/mbpath
+%{_cyrexecdir}/migrate-metadata
+%{_cyrexecdir}/mkimap
+%{_cyrexecdir}/mknewsgroups
+%{_cyrexecdir}/mupdate-loadgen.pl
+%{_cyrexecdir}/notifyd
+%{_cyrexecdir}/pop3d
+%{_cyrexecdir}/quota
+%{_cyrexecdir}/reconstruct
+%{_cyrexecdir}/rehash
+%{_cyrexecdir}/sievec
+%{_cyrexecdir}/sieved
+%{_cyrexecdir}/smmapd
+%{_cyrexecdir}/squatter
+%{_cyrexecdir}/timsieved
+%{_cyrexecdir}/tls_prune
+%{_cyrexecdir}/translatesieve
+%{_cyrexecdir}/undohash
+%{_cyrexecdir}/unexpunge
+%{_cyrexecdir}/upgradesieve
+%{_cyrexecdir}/cvt_cyrusdb_all
+%{_cyrexecdir}/idled
+%{_cyrexecdir}/sync_client
+%{_cyrexecdir}/sync_reset
+%{_cyrexecdir}/sync_server
+%{_cyrexecdir}/ptdump
+%{_cyrexecdir}/ptexpire
+%{_cyrexecdir}/ptloader
+%attr(0750,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/backup
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/db
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/log
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/meta
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/md5
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/msg
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %{_var}/lib/imap/proc
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %{_var}/lib/imap/ptclient
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/quota
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/rpm
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/sieve
+%attr(0750,%{_cyrususer},%{_cyrusgroup}) %{_var}/lib/imap/socket
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/sync
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/lib/imap/user
+%attr(0700,%{_cyrususer},%{_cyrusgroup}) %dir %{_var}/spool/imap
 %dir %{_datadir}/%{name}
 %dir %{_datadir}/%{name}/rpm
 %{_datadir}/%{name}/rpm/*
 %{_mandir}/man5/*
 %{_mandir}/man8/*
-%doc COPYRIGHT README
-%doc doc/*
+%dir %{_sysconfdir}/pki/%{name}
+%attr(0640,root,%{_cyrusgroup}) %ghost %config(missingok,noreplace) %verify(not md5 size mtime) %{ssl_pem_file}
 
 %files murder
-%defattr(0644,root,root,0755)
-%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/mupdate
-%attr(0755,root,root) %{_cyrexecdir}/lmtpproxyd
-%attr(0755,root,root) %{_cyrexecdir}/mupdate
-%attr(0755,root,root) %{_cyrexecdir}/proxyd
+%defattr(-,root,root,-)
+%config(noreplace) %{_sysconfdir}/pam.d/mupdate
+%{_cyrexecdir}/lmtpproxyd
+%{_cyrexecdir}/mupdate
+%{_cyrexecdir}/proxyd
 
 %files nntp
-%defattr(0644,root,root,0755)
-%config(noreplace) %verify(not size,not md5) %{_sysconfdir}/pam.d/news
-%attr(0755,root,root) %{_cyrexecdir}/cyrfetchnews
-%attr(0755,root,root) %{_cyrexecdir}/nntpd
+%defattr(-,root,root,-)
+%config(noreplace) %{_sysconfdir}/pam.d/nntp
+%{_cyrexecdir}/cyrfetchnews
+%{_cyrexecdir}/nntpd
 
 %files devel
 %defattr(0644,root,root,0755)
+%doc COPYRIGHT
 %{_includedir}/cyrus
 %{_libdir}/lib*.a
 %{_mandir}/man3/imclient.3*
 
-%files -n perl-Cyrus -f perl-Cyrus-%{version}-filelist
+%files -n perl-Cyrus
+#-f perl-Cyrus-%{version}-filelist
 %defattr(-,root,root)
+%dir %{perl_vendorarch}/Cyrus
+%dir %{perl_vendorarch}/Cyrus/IMAP
+%{perl_vendorarch}/Cyrus/IMAP/Admin.pm
+%{perl_vendorarch}/Cyrus/IMAP/Shell.pm
+%{perl_vendorarch}/Cyrus/IMAP/IMSP.pm
+%{perl_vendorarch}/Cyrus/IMAP.pm
+%dir %{perl_vendorarch}/Cyrus/SIEVE
+%{perl_vendorarch}/Cyrus/SIEVE/managesieve.pm
+%dir %{perl_vendorarch}/auto
+%dir %{perl_vendorarch}/auto/Cyrus
+%dir %{perl_vendorarch}/auto/Cyrus/IMAP
+%{perl_vendorarch}/auto/Cyrus/IMAP/IMAP.so
+%dir %{perl_vendorarch}/auto/Cyrus/SIEVE
+%dir %{perl_vendorarch}/auto/Cyrus/SIEVE/managesieve
+%{perl_vendorarch}/auto/Cyrus/SIEVE/managesieve/managesieve.so
+%{_mandir}/man3/Cyrus::IMAP::Admin.3pm.gz
+%{_mandir}/man3/Cyrus::IMAP::Shell.3pm.gz
+%{_mandir}/man3/Cyrus::IMAP.3pm.gz
+%{_mandir}/man3/Cyrus::IMAP::IMSP.3pm.gz
+%{_mandir}/man3/Cyrus::SIEVE::managesieve.3pm.gz
 %doc perl/imap/README
 %doc perl/imap/Changes
 %doc perl/imap/examples
 
 %files utils
-%defattr(0644,root,root,0755)
-%attr(0755,root,root) %{_cyrexecdir}/cyradm
-%attr(0755,root,root) %{_cyrexecdir}/imtest
-%attr(0755,root,root) %{_cyrexecdir}/mupdate-loadgen.pl
-%attr(-,root,root) %{_contribdir}
-%attr(0755,root,root) %{_bindir}/*
+%defattr(-,root,root,-)
+%doc COPYRIGHT
+%{_bindir}/*
 %{_mandir}/man1/*
 
 %changelog
+* Wed Dec 24 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.4.17-1
+- updated to 2.4.17
+- spec revamped based on CentOS package (2.4.17-7.el7)
+- updated URL
+- updated Source100 and 101
+
+* Sat Oct 13 2012 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 2.2.13p1-12
+- fix init script "LIB" dir
+  (http://mantis.vinelinux.org/view.php?id=1326)
+- add Vendor/Distri Tags
+- add smp flags into make section
+
 * Thu Mar 22 2012 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.2.13p1-11
 - update Patch52 (to link with db4-4.8.x)