From a66263918230bc1d3f24cfdb8e6278dc0ac44cfc Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 10 Aug 2015 14:08:18 +0000
Subject: imap: upgrage 2007f-5

---
 abs/core/imap/PKGBUILD                             | 60 ++++++++++++++--------
 .../imap/c-client-2006k_GENTOO_amd64-so-fix.patch  | 13 +++++
 2 files changed, 52 insertions(+), 21 deletions(-)
 create mode 100644 abs/core/imap/c-client-2006k_GENTOO_amd64-so-fix.patch

diff --git a/abs/core/imap/PKGBUILD b/abs/core/imap/PKGBUILD
index b251daf..cad646c 100644
--- a/abs/core/imap/PKGBUILD
+++ b/abs/core/imap/PKGBUILD
@@ -1,40 +1,40 @@
 # $Id$
 
-pkgname=imap
+pkgbase=imap
+pkgname=(imap c-client)
 pkgver=2007f
-pkgrel=4
-pkgdesc="An IMAP/POP server"
+pkgrel=5
 arch=('i686' 'x86_64')
 license=('APACHE')
 url="http://www.washington.edu/imap"
-depends=('openssl' 'pam')
-provides=('imap-server' 'pop3-server')
-conflicts=('courier-mta' 'courier-imap')
+makedepends=('pam')
 source=("ftp://ftp.cac.washington.edu/imap/${pkgname}-${pkgver}.tar.gz"
+        'c-client-2006k_GENTOO_amd64-so-fix.patch'
         'imap' 'ipop2' 'ipop3')
 options=('staticlibs')
-backup=(etc/xinetd.d/{imap,ipop2,ipop3} etc/ssl/certs/{imapd,ipop3d}.pem)
 md5sums=('2126fd125ea26b73b20f01fcd5940369'
+         '7f3937a871edd54203fe51f91423e204'
          '3ae5b3b333bc8ea2da106f6a97d7bd8d'
          '448f988dc5f9bdb2223dcea3abc4f5f1'
          '1499b13015075f0aafba04324a6f523a')
 
 prepare() {
+  cd $srcdir/$pkgbase-$pkgver
+
   sed \
     -e "s:-g -fno-omit-frame-pointer -O6:\${CFLAGS}:" \
     -e "s:SSLDIR=/usr/local/ssl:SSLDIR=/usr:" \
     -e "s:SSLCERTS=\$(SSLDIR)/certs:SSLCERTS=/etc/ssl/certs:" \
-    -i $srcdir/$pkgname-$pkgver/src/osdep/unix/Makefile
+    -i src/osdep/unix/Makefile
+
+  patch -p1 -i $srcdir/c-client-2006k_GENTOO_amd64-so-fix.patch
 }
 
 build() {
-  cd $srcdir/$pkgname-$pkgver
+  cd $srcdir/$pkgbase-$pkgver
   # NOTE: if you wish to enforce SSL, use SSLTYPE=unix.nopwd
 
-  if [ "$CARCH" == "x86_64" ]; then
-         yes "y" | make lnp SPECIALAUTHENTICATORS=ssl SSLTYPE=unix EXTRACFLAGS="${CFLAGS} -fPIC"
-    else yes "y" | make lnp SPECIALAUTHENTICATORS=ssl SSLTYPE=unix
-  fi
+  yes "y" | make lnp EXTRAAUTHENTICATORS=gss PASSWDTYPE=pam SPECIALAUTHENTICATORS=ssl SSLTYPE=unix EXTRACFLAGS="${CFLAGS} -fPIC -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lpam"
 
   # create ssl certs for secure imap
   for i in imapd ipop3d; do
@@ -59,18 +59,18 @@ EOF
   done
 }
 
-package() {
-  cd $srcdir/$pkgname-$pkgver
+package_imap() {
+  pkgdesc="An IMAP/POP server"
+  depends=('c-client')
+  provides=('imap-server' 'pop3-server')
+  conflicts=('courier-mta' 'courier-imap')
+  backup=(etc/xinetd.d/{imap,ipop2,ipop3} etc/ssl/certs/{imapd,ipop3d}.pem)
+
+  cd $srcdir/$pkgbase-$pkgver
   install -d $pkgdir/usr/bin
   install -D -m755 imapd/imapd $pkgdir/usr/bin/imapd
   install -D -m755 ipopd/ipop2d $pkgdir/usr/bin/ipop2d
   install -D -m755 ipopd/ipop3d $pkgdir/usr/bin/ipop3d
-  for i in c-client mail imap4r1 rfc822 linkage misc smtp nntp \
-    osdep env_unix env fs ftl nl tcp sslio utf8 utf8aux; do
-    install -D -m644 c-client/${i}.h $pkgdir/usr/include/imap/${i}.h
-  done
-  install -D -m644 c-client/c-client.a $pkgdir/usr/lib/c-client.a
-  ln -sf c-client.a $pkgdir/usr/lib/libc-client.a
 
   # install certs
   install -D -m600 imapd.pem $pkgdir/etc/ssl/certs/imapd.pem
@@ -81,3 +81,21 @@ package() {
   install -D -m644 ../ipop2 $pkgdir/etc/xinetd.d/ipop2
   install -D -m644 ../ipop3 $pkgdir/etc/xinetd.d/ipop3
 }
+
+package_c-client() {
+  pkgdesc="Imap client library"
+  depends=('pam')
+
+  cd $srcdir/$pkgbase-$pkgver
+
+  for i in c-client mail imap4r1 rfc822 linkage misc smtp nntp \
+    osdep env_unix env fs ftl nl tcp sslio utf8 utf8aux; do
+    install -D -m644 c-client/${i}.h $pkgdir/usr/include/imap/${i}.h
+  done
+  install -D -m644 c-client/c-client.a $pkgdir/usr/lib/c-client.a
+  ln -sf c-client.a $pkgdir/usr/lib/libc-client.a
+
+  install -D -m755 c-client/libc-client.so.1.0.0 $pkgdir/usr/lib/libc-client.so.1.0.0
+  ln -sf /usr/lib/libc-client.so.1.0.0 $pkgdir/usr/lib/libc-client.so.1
+  ln -sf /usr/lib/libc-client.so.1.0.0 $pkgdir/usr/lib/libc-client.so
+}
diff --git a/abs/core/imap/c-client-2006k_GENTOO_amd64-so-fix.patch b/abs/core/imap/c-client-2006k_GENTOO_amd64-so-fix.patch
new file mode 100644
index 0000000..79b067d
--- /dev/null
+++ b/abs/core/imap/c-client-2006k_GENTOO_amd64-so-fix.patch
@@ -0,0 +1,13 @@
+diff -r 7c3e6c6ef2ba src/osdep/unix/Makefile
+--- a/src/osdep/unix/Makefile	Thu Feb 21 18:51:32 2008 +0100
++++ b/src/osdep/unix/Makefile	Thu Feb 21 18:53:15 2008 +0100
+@@ -962,6 +962,9 @@ onceenv:
+ 	 -DRSHPATH=\"$(RSHPATH)\" -DLOCKPGM=\"$(LOCKPGM)\" > OSCFLAGS
+ 	echo $(BASELDFLAGS) $(EXTRALDFLAGS) > LDFLAGS
+ 	echo "$(ARRC) $(ARCHIVE) $(BINARIES);$(RANLIB) $(ARCHIVE)" > ARCHIVE
++	echo "`$(CAT) CCTYPE` `$(CAT) CFLAGS` `$(CAT) OSFLAGS` -shared \
++	 -Wl,-soname,libc-client.so.1 -o libc-client.so.1.0.0 $(BINARIES)" \
++	 >> ARCHIVE
+ 	echo $(OS) > OSTYPE
+ 	./drivers $(EXTRADRIVERS) $(DEFAULTDRIVERS) dummy
+ 	./mkauths $(EXTRAAUTHENTICATORS) $(DEFAULTAUTHENTICATORS)
-- 
cgit v0.12

