# $Id: Portfile,v 1.15 2005/10/20 20:13:40 pguyot Exp $

PortSystem 1.0

name			cclient
version			2004g
categories		mail
maintainers		pguyot@kallisys.net
description		UW IMAP c-client library
long_description	\
				C-client is a common API for accessing mailboxes. It is \
				used internally by the popular PINE mail reader as well as the \
				University of Washington's IMAP server.
homepage		http://www.washington.edu/imap/
platforms		darwin
master_sites	ftp://ftp.cac.washington.edu/imap/ \
				ftp://ftp.cac.washington.edu/imap/old/ \
				opendarwin
extract.suffix	.tar.Z
distname		imap-${version}	
dist_subdir		imap-uw
worksrcdir		imap-${version}
checksums		md5 9a80f58d8d6a0979c13714ae69050020 \
				sha1 791a8bb247ca51ce0a4c32e814a2f736c2bcf066 \
				rmd160 a016a06ba073e879d2574a6395ce1074ea74c687

depends_lib		port:openssl \
				lib:libz:zlib \
				lib:libgssapi_krb5:kerberos5

use_configure	no

post-patch {
	cd ${worksrcpath}
	reinplace "s|/System/Library/OpenSSL SSLINCLUDE=/usr/include/openssl SSLLIB=/usr/lib|${prefix}/etc/openssl SSLINCLUDE=${prefix}/include SSLLIB=${prefix}/lib|g" Makefile
	reinplace "s| -Wno-pointer-sign||g" src/osdep/unix/Makefile
}
build.target	osx EXTRACFLAGS=-fno-common

variant ssl_plaintext {
	patchfiles patch-Makefile
	build.args SSLTYPE=unix
}

destroot {
	xinstall -m 755 -d ${destroot}${prefix}/include/c-client
	xinstall -m 644 -W ${worksrcpath}/c-client \
		c-client.h dummy.h env.h fdstring.h flockcyg.h flocksim.h env_unix.h \
		flstring.h fs.h ftl.h imap4r1.h linkage.c linkage.h mail.h mbx.h mh.h \
		misc.h mx.h netmsg.h newsrc.h nl.h nntp.h osdep.h \
		pseudo.h rfc822.h smtp.h sslio.h tcp.h tcp_unix.h unix.h utf8.h \
		${destroot}${prefix}/include/c-client
	xinstall -m 644 ${worksrcpath}/c-client/c-client.a \
		${destroot}${prefix}/lib/libc-client4.a
	system "cd ${destroot}${prefix}/lib/ && ranlib libc-client4.a"
}
