Courier-Cygwin

From YobiWiki
Jump to navigation Jump to search

Courier-IMAP

Courier-IMAP requires the installation of the Courier Authentication Library and the following cygwin tools and packages

  • patch, tar, make, gcc
  • crypt
  • libgdbm-devel
  • inetutils
  • syslogd
  • cygrunsrv

Courier Authentication Library

Download and untar courier-authlib in your favorite sandbox. Version used: 0.61.0

Apply the [{{#file:courrier-authlib-0.61.0-cygwin.patch}} patch] before configuration to correct following issues:

  1. incorrect usage of EXEEXT in makedat/Makefile
  2. missing crypt library in main Makefile
  3. incorrect or incompatible (text-)format of install library files (*.la). Unix like library name (as provided by 'dlname') are not used under cygwin. Hence skip the related operation in the installation.
--- courier-authlib-0.61.0/makedat/Makefile.in  2008-05-24 16:21:09.000000000 +0200
+++ courier-authlib-0.61.0-cygwin/makedat/Makefile.in   2008-10-21 16:02:38.709166700 +0200
@@ -182,7 +182,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-makedatprog_target = @makedatprog_target@
+makedatprog_target = @makedatprog_target@$(EXEEXT)
 makedatprogpath = @makedatprogpath@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
@@ -198,7 +198,7 @@
 target_alias = @target_alias@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-noinst_PROGRAMS = @makedatprog_target@
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)
 makedatprog_SOURCES = makedatprog.c
 makedatprog_DEPENDENCIES = @dblibrary@
 makedatprog_LDADD = @dblibrary@
--- courier-authlib-0.61.0/Makefile.in	2008-07-12 21:41:08.000000000 +0200
+++ courier-authlib-0.61.0-cygwin/Makefile.in	2008-10-21 18:51:47.093466600 +0200
@@ -1659,7 +1659,6 @@
 				$(DESTDIR)$(sbindir)/userdbpw ; \
 		$(INSTALL_SCRIPT) userdb-test-cram-md5.pl \
 				$(DESTDIR)$(sbindir)/userdb-test-cram-md5
-	for f in $(pkglib_LTLIBRARIES); do . $$f; rm -f $(DESTDIR)$(pkglibdir)/$$dlname.0 $(DESTDIR)$(pkglibdir)/$$dlname.0.0; ln -s $$dlname $(DESTDIR)$(pkglibdir)/$$dlname.0; done
 
 uninstall-hook: uninstall-authldaprc uninstall-authdaemonrc uninstall-authmysqlrc uninstall-authpgsqlrc
 	rm -f $(DESTDIR)$(pkglibexecdir)/authdaemond

Install the patch

$ patch -Np1 < courrier-authlib-0.61.0-cygwin.patch

Configure the package without most authentication modules, keeping only userdb.

Note: replace mailuser by an existing user name (in your /etc/passwd file). I used my own username.

$ ./configure --disable-root-check --with-waitfunc=wait --without-authpam --without-authldap --without-authpwd \
--without-authshadow --without-custom --without-authpipe --without-authmysql --without-authpgsql --with-mailuser=mailuser \
--with-mailgroup=mkgroup-l-d

Take a long pause... and when ready execute the following command. The LDFLAGS and LIBS variables are used to correct the second issue.

$ make LDFLAGS=-lcrypt LIBS=-lcrypt

Take again a long pause... then check the result and install the libraries

$ make check
$ make install

Compilation and installation

Download and untar package courier-imap in your favorite sandbox. Version used: 4.4.1.20080920

Apply the [{{#file:courrier-imap-4.4.1-cygwin.patch}} patch] before configuration to correct following issues:

  1. incorrect usage of EXEEXT in makedat/Makefile
  2. incorrect usage of EXTEXT in main Makefile
  3. remove usage of /usr/lib/env in start/stop script (/usr/lib/env does not seem to work under Cygwin)
--- courier-imap-4.4.1.20080920/makedat/Makefile.in	2008-08-24 19:52:51.000000000 +0200
+++ courier-imap-4.4.1.20080920-cygwin/makedat/Makefile.in	2008-10-21 20:43:27.500000000 +0200
@@ -182,7 +182,7 @@
 libexecdir = @libexecdir@
 localedir = @localedir@
 localstatedir = @localstatedir@
-makedatprog_target = @makedatprog_target@
+makedatprog_target = @makedatprog_target@$(EXEEXT)
 makedatprogpath = @makedatprogpath@
 mandir = @mandir@
 mkdir_p = @mkdir_p@
@@ -198,7 +198,7 @@
 target_alias = @target_alias@
 top_builddir = @top_builddir@
 top_srcdir = @top_srcdir@
-noinst_PROGRAMS = @makedatprog_target@
+noinst_PROGRAMS = @makedatprog_target@$(EXEEXT)
 makedatprog_SOURCES = makedatprog.c
 makedatprog_DEPENDENCIES = @dblibrary@
 makedatprog_LDADD = @dblibrary@
--- courier-imap-4.4.1.20080920/Makefile.in	2008-09-20 14:48:46.000000000 +0200
+++ courier-imap-4.4.1.20080920-cygwin/Makefile.in	2008-10-21 20:59:45.156250000 +0200
@@ -247,9 +247,9 @@
 CLEANFILES = $(databin_SCRIPTS) $(man_MANS) $(sysconf_DATA) $(sbin_SCRIPTS)
 databindir = $(datadir)
 databin_SCRIPTS = mkimapdcert mkpop3dcert
-binPROGRAMS = imapd pop3d maildirmake maildiracl deliverquota maildirkw
-sbinPROGRAMS = imaplogin pop3login
-libexecPROGRAMS = makedatprog couriertcpd
+binPROGRAMS = imapd$(EXEEXT) pop3d$(EXEEXT) maildirmake$(EXEEXT) maildiracl$(EXEEXT) deliverquota$(EXEEXT) maildirkw$(EXEEXT)
+sbinPROGRAMS = imaplogin$(EXEEXT) pop3login$(EXEEXT)
+libexecPROGRAMS = makedatprog$(EXEEXT) couriertcpd$(EXEEXT)
 bin_PROGRAMS = @binPROGRAMS_exec@
 sbin_PROGRAMS = @sbinPROGRAMS_exec@
 libexec_PROGRAMS = @libexecPROGRAMS_exec@
--- courier-imap-4.4.1.20080920/imapd.rc.in	2008-05-04 15:12:47.000000000 +0200
+++ courier-imap-4.4.1.20080920-cygwin/imapd.rc.in	2008-10-21 23:00:30.781250000 +0200
@@ -35,7 +35,7 @@
 
 	umask $IMAP_UMASK
 	@ULIMIT@ $IMAP_ULIMITD
-	@SETENV@ -i @SHELL@ -c " set -a ;
+	@SHELL@ -c " set -a ;
 			prefix=@prefix@ ;
 			exec_prefix=@exec_prefix@ ;
 			bindir=@bindir@ ;
--- courier-imap-4.4.1.20080920/pop3d.rc.in	2008-05-04 15:12:47.000000000 +0200
+++ courier-imap-4.4.1.20080920-cygwin/pop3d.rc.in	2008-10-21 23:00:49.875000000 +0200
@@ -27,7 +27,7 @@
 
 case $1 in
 start)
-	@SETENV@ -i @SHELL@ -c " set -a ;
+	@SHELL@ -c " set -a ;
 		prefix=@prefix@ ;
 		exec_prefix=@exec_prefix@ ;
 		bindir=@bindir@ ;

Install the patch

$ patch -Np1 < courrier-imap-4.4.1-cygwin.patch

Configure the package

$ ./configure --disable-root-check --with-waitfunc=wait

Take a walk... and when ready execute the following command to build the package.

$ make

Time to go for some coffee... and then install the package with the usual

$ make install
$ make install-configure

Configuration

Set ADDRESS to a valid value (0 or 127.0.0.1) and change IMAP_ULIMITD in $prefix/etc/imapd (where $prefix=/usr/lib/courier-imap) to a value accepted by the command ulimit. I simply used the existing value returned by

$ ulimit -v

Running

Start the daemon with the following command:

$ /usr/lib/courier-imap/libexec/imapd.rc start

Stop the daemon with the following command:

$ /usr/lib/courier-imap/libexec/imapd.rc stop

Maildir

maildirmake is part of the courier-imap package