#!/usr/bin/make -f
# $Id: rules 228 2004-08-30 15:21:07Z grin $
# 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

# This is the debhelper compatability version to use.
#export DH_COMPAT=2   # this should work if your debhelper is older!
export DH_COMPAT=4

build: build-stamp
build-stamp:
	dh_testdir

	# compiling without X, since it only needed for RESETTING xterm title
	# comp. with GNUTLS due to license restictions.
	./configure --prefix=/usr --mandir=\$${prefix}/share/man \
	--sysconfdir=/etc/elinks \
	--without-openssl --without-x --with-gnutls=/usr
	# --enable-leds --enable-debug
	# Add here commands to compile the package.
	$(MAKE)

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp
	rm -rf debian/elinks/

	# Add here commands to clean up after the build process.
	-$(MAKE) distclean

	dh_clean -XChangelog.orig

install: build
	dh_testdir
	dh_testroot
	dh_clean -k
	dh_installdirs

	# Add here commands to install the package into debian/elinks.
	$(MAKE) install DESTDIR=`pwd`/debian/elinks
	
	mkdir -p debian/elinks/etc/elinks
	install -o root -g root -m 644 debian/elinks.conf debian/elinks/etc/elinks/elinks.conf
# KDE menu integration
	mkdir -p debian/elinks/usr/share/applnk/Internet/
	cp debian/elinks.desktop debian/elinks/usr/share/applnk/Internet/
# upstream CVS bug hack: remove double contrib dirs
	rm -rf contrib/lua/lua contrib/conv/conv contrib/guile/guile || true
# remove CVS directories
	find . -name CVS -exec rm -rf "{}" \; || true
# locale.alias causes conflicts and I believe it's not necessary
	rm -f debian/elinks/usr/share/locale/locale.alias || true

	touch install-stamp

# Build architecture-independent files here.
binary-indep: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-arch: build install
#	dh_testversion
	dh_testdir
	dh_testroot
	dh_installdebconf	
	dh_installdocs AUTHORS SITES TODO BUGS
	dh_installexamples contrib/ debian/elinks.conf
#contrib/*
	dh_installmime
	dh_installmenu
#	dh_installemacsen
#	dh_installpam
#	dh_installinit
##	dh_installcron
	dh_installmanpages

# comment out for slink:
##	dh_installinfo

#	dh_undocumented
	dh_installchangelogs ChangeLog changelog.orig

# comment out for slink:
##	dh_link
	
	dh_strip
	dh_compress
	dh_fixperms
	# You may want to make some executables suid here.
##	dh_suidregister
#	dh_makeshlibs
	dh_installdeb
#	dh_perl
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

binary: binary-indep binary-arch
.PHONY: build clean binary-indep binary-arch binary install
