# Template file for 'mailx'
pkgname=mailx
version=12.5
patch_args="-Np1"
wrksrc=mailx-${version}
distfiles="http://cvs.fedoraproject.org/repo/pkgs/mailx/mailx-${version}.tar.bz2/acea6f7e8ae727514e498bd8c1895363/mailx-${version}.tar.bz2"
depends="glibc libssl mit-krb5-libs"
makedepends="openssl-devel mit-krb5-devel"
revision=1
short_desc="Feature-rich BSD mail(1)"
maintainer="Juan RP <xtraeme@gmail.com>"
checksum=c33dc81aaa6136645310c406d61d9b1d7c0a54d424bafe2d1c266e256526afe2
long_desc="
 Mailx is an enhanced mail command, which provides the functionality
 of the POSIX mailx command, as well as SysV mail and Berkeley Mail
 (from which it is derived).

 Additionally to the POSIX features, mailx can work with Maildir/ e-mail
 storage format (as well as mailboxes), supports IMAP, POP3 and SMTP
 procotols (including over SSL) to operate with remote hosts, handles mime
 types and different charsets. There are a lot of other useful features,
 see mailx(1).

 And as its ancient analogues, mailx can be used as a mail script language,
 both for sending and receiving mail.

 Besides the "mailx" command, this package provides "mail" and "Mail"
 (which should be compatible with its predecessors from the mailx-8.x source),
 as well as "nail" (the initial name of this project)."

conf_files="/etc/mail.rc"
disable_parallel_build=yes


do_build()
{
	echo	PREFIX=/usr 		\
		BINDIR=/bin 		\
		MANDIR=/usr/share/man	\
		SYSCONFDIR=/etc		\
		MAILRC=/etc/mail.rc	\
		MAILSPOOL=/var/spool/mail	\
		UCBINSTALL=install	\
	> ${wrksrc}/makeflags

	make $(cat makeflags) CFLAGS="${XBPS_CFLAGS} -D_GNU_SOURCE" \
		IPv6=-DHAVE_IPv6_FUNCS || return 1
}

do_install()
{
	make DESTDIR=${DESTDIR} $(cat makeflags) install || return 1

	cd ${wrksrc} && \
		ln -s mailx ${DESTDIR}/bin/mail && \
		ln -s mailx ${DESTDIR}/bin/Mail && \
		ln -s mailx.1 ${DESTDIR}/usr/share/man/man1/mail.1 && \
		ln -s mailx.1 ${DESTDIR}/usr/share/man/man1/Mail.1
}
