#!/usr/bin/make -f
# Sample debian/rules that uses debhelper.
# GNU copyright 1997 to 1999 by Joey Hess.

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

%:
	dh $@

override_dh_clean:
	dh_clean -- LIBS config.h config.log

override_dh_auto_build:
	dh_auto_build -- IPv6=-DHAVE_IPv6_FUNCS

override_dh_auto_install: debian/copyright
	dh_auto_install -- PREFIX=/usr UCBINSTALL=/usr/bin/install

	mv $(CURDIR)/debian/heirloom-mailx/usr/bin/mailx \
	   $(CURDIR)/debian/heirloom-mailx/usr/bin/heirloom-mailx
	mv $(CURDIR)/debian/heirloom-mailx/usr/share/man/man1/mailx.1 \
	   $(CURDIR)/debian/heirloom-mailx/usr/share/man/man1/heirloom-mailx.1

# This is dangerous!! If you really need dot locking, enable at your own risk.
#	chgrp mail $(CURDIR)/debian/heirloom-mailx/usr/bin/heirloom-mailx
#	chmod 2755 $(CURDIR)/debian/heirloom-mailx/usr/bin/heirloom-mailx

debian/copyright: debian/copyright.head AUTHORS COPYING
	dh_testdir
	(cat debian/copyright.head; \
	echo 'Upstream Authors:'; \
	echo '-----------------'; echo; \
	cat AUTHORS; echo; \
	echo 'Copyright:'; \
	echo '----------'; echo; \
	cat COPYING) > debian/copyright
