From 4174580fb1169b8b16be08296742ae22cd9dc15e Mon Sep 17 00:00:00 2001
From: Jelmer Vernooij <jelmer@debian.org>
Date: Sat, 18 Jan 2014 22:51:27 +0000
Subject: [PATCH] Build with lucene full text search plugin. Closes: #685979

---
 debian/changelog                        |  7 +++++++
 debian/control                          | 16 ++++++++++++++--
 debian/dovecot-lucene.dirs              |  1 +
 debian/dovecot-lucene.links             |  1 +
 debian/dovecot-lucene.lintian-overrides |  2 ++
 debian/dovecot-lucene.triggers          |  1 +
 debian/rules                            |  4 ++++
 7 files changed, 30 insertions(+), 2 deletions(-)
 create mode 100644 debian/dovecot-lucene.dirs
 create mode 100644 debian/dovecot-lucene.links
 create mode 100644 debian/dovecot-lucene.lintian-overrides
 create mode 100644 debian/dovecot-lucene.triggers

diff --git a/debian/changelog b/debian/changelog
index 143efe4..c4d9338 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,10 @@
+dovecot (1:2.2.9-1.1) UNRELEASED; urgency=medium
+
+  * Non-maintainer upload.
+  * Build with lucene full text search plugin. Closes: #685979
+
+ -- Jelmer Vernooij <jelmer@debian.org>  Sat, 18 Jan 2014 22:51:19 +0000
+
 dovecot (1:2.2.9-1) unstable; urgency=low
 
   [ Jaldhar H. Vyas ]
diff --git a/debian/control b/debian/control
index e1bb9ea..caf1d38 100644
--- a/debian/control
+++ b/debian/control
@@ -3,7 +3,7 @@ Section: mail
 Priority: optional
 Maintainer: Dovecot Maintainers <jaldhar-dovecot@debian.org>
 Uploaders: Jaldhar H. Vyas <jaldhar@debian.org>, Fabio Tranchitella <kobold@debian.org>, Joel Johnson <mrjoel@lixil.net>, Marco Nenciarini <mnencia@debian.org>
-Build-Depends: debhelper (>= 7.2.3~), dpkg-dev (>= 1.16.1), pkg-config, libssl-dev, libpam0g-dev, libldap2-dev, libpq-dev, libmysqlclient-dev, libsqlite3-dev, libsasl2-dev, zlib1g-dev, libkrb5-dev, drac-dev (>= 1.12-5), libbz2-dev, libdb-dev, libcurl4-gnutls-dev, libexpat-dev, libwrap0-dev, dh-systemd, po-debconf, lsb-release
+Build-Depends: debhelper (>= 7.2.3~), dpkg-dev (>= 1.16.1), pkg-config, libssl-dev, libpam0g-dev, libldap2-dev, libpq-dev, libmysqlclient-dev, libsqlite3-dev, libsasl2-dev, zlib1g-dev, libkrb5-dev, drac-dev (>= 1.12-5), libbz2-dev, libdb-dev, libcurl4-gnutls-dev, libexpat-dev, libwrap0-dev, dh-systemd, po-debconf, lsb-release, libclucene-dev
 Standards-Version: 3.9.4
 Homepage: http://dovecot.org/
 Vcs-Git: git://git.debian.org/git/collab-maint/dovecot.git
@@ -12,7 +12,7 @@ Vcs-Browser: http://git.debian.org/?p=collab-maint/dovecot.git
 Package: dovecot-core
 Architecture: any
 Depends: ${shlibs:Depends}, ${misc:Depends}, libpam-runtime (>= 0.76-13.1), openssl, adduser, ucf (>= 2.0020)
-Suggests: ntp, dovecot-gssapi, dovecot-sieve, dovecot-pgsql, dovecot-mysql, dovecot-sqlite, dovecot-ldap, dovecot-imapd, dovecot-pop3d, dovecot-lmtpd, dovecot-managesieved, dovecot-solr
+Suggests: ntp, dovecot-gssapi, dovecot-sieve, dovecot-pgsql, dovecot-mysql, dovecot-sqlite, dovecot-ldap, dovecot-imapd, dovecot-pop3d, dovecot-lmtpd, dovecot-managesieved, dovecot-solr, dovecot-lucene
 Provides: dovecot-common
 Replaces: dovecot-common (<< 1:2.0.14-2~), mailavenger (<< 0.8.1-4)
 Breaks: dovecot-common (<< 1:2.0.14-2~), mailavenger (<< 0.8.1-4)
@@ -178,6 +178,18 @@ Description: secure POP3/IMAP server - Solr support
  .
  This package provides Solr full text search support for Dovecot.
 
+Package: dovecot-lucene
+Architecture: any
+Depends: ${shlibs:Depends}, ${misc:Depends}, dovecot-core (= ${binary:Version})
+Description: secure POP3/IMAP server - Lucene support
+ Dovecot is a mail server whose major goals are security and extreme
+ reliability. It tries very hard to handle all error conditions and verify
+ that all data is valid, making it nearly impossible to crash. It supports
+ mbox/Maildir and its own dbox/mdbox formats, and should also be pretty
+ fast, extensible, and portable.
+ .
+ This package provides Lucene full text search support for Dovecot.
+
 Package: dovecot-dbg
 Section: debug
 Priority: extra
diff --git a/debian/dovecot-lucene.dirs b/debian/dovecot-lucene.dirs
new file mode 100644
index 0000000..d973194
--- /dev/null
+++ b/debian/dovecot-lucene.dirs
@@ -0,0 +1 @@
+usr/lib/dovecot/modules
diff --git a/debian/dovecot-lucene.links b/debian/dovecot-lucene.links
new file mode 100644
index 0000000..6ffcbeb
--- /dev/null
+++ b/debian/dovecot-lucene.links
@@ -0,0 +1 @@
+/usr/share/bug/dovecot-core /usr/share/bug/dovecot-lucene
diff --git a/debian/dovecot-lucene.lintian-overrides b/debian/dovecot-lucene.lintian-overrides
new file mode 100644
index 0000000..60d90fd
--- /dev/null
+++ b/debian/dovecot-lucene.lintian-overrides
@@ -0,0 +1,2 @@
+dovecot-lucene: hardening-no-fortify-functions usr/lib/dovecot/modules/lib21_fts_lucene_plugin.so
+
diff --git a/debian/dovecot-lucene.triggers b/debian/dovecot-lucene.triggers
new file mode 100644
index 0000000..3d933a5
--- /dev/null
+++ b/debian/dovecot-lucene.triggers
@@ -0,0 +1 @@
+activate register-dovecot-plugin
diff --git a/debian/rules b/debian/rules
index 8ce49fe..c07c4c6 100755
--- a/debian/rules
+++ b/debian/rules
@@ -37,6 +37,7 @@ config-stamp: configure
 		        --with-solr \
 	            --with-ioloop=best \
 	            --with-libwrap \
+	            --with-lucene \
 	            --host=$(DEB_HOST_GNU_TYPE) \
 	            --build=$(DEB_BUILD_GNU_TYPE) \
 	            --prefix=/usr \
@@ -167,6 +168,9 @@ install: build
 	# solr
 	mv $(CURDIR)/debian/dovecot-core/usr/lib/dovecot/modules/lib??_fts_solr_* $(CURDIR)/debian/dovecot-solr/usr/lib/dovecot/modules
 
+	# lucene
+	mv $(CURDIR)/debian/dovecot-core/usr/lib/dovecot/modules/lib??_fts_lucene_* $(CURDIR)/debian/dovecot-lucene/usr/lib/dovecot/modules
+
 	# dev
 	mv $(CURDIR)/debian/dovecot-core/usr/include/* $(CURDIR)/debian/dovecot-dev/usr/include
 	mv $(CURDIR)/debian/dovecot-core/usr/lib/dovecot/dovecot-config $(CURDIR)/debian/dovecot-dev/usr/lib/dovecot
-- 
1.8.5.3

