#!/usr/bin/make -f

export DH_VERBOSE=1

PKGDIR = $(CURDIR)/debian/emboss-explorer
LIBPKGDIR = $(CURDIR)/debian/libemboss-acd-perl

%:
	dh $@ --with apache2

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	echo 'Test disabled because of http://sourceforge.net/tracker/index.php?func=detail&aid=1994385&group_id=124389&atid=699414'
endif

override_dh_install:
	dh_install
	$(MAKE) install DESTDIR=$(PKGDIR) PREFIX=/usr
	# Move ACD.pm to a separate package, that is useful for making
	# manpages from EMBOSS ACD files without being bothered by the
	# dependancy on web servers.
	mv -v $(PKGDIR)/usr/share/perl5/EMBOSS/ACD.pm \
		$(LIBPKGDIR)/usr/share/perl5/EMBOSS/
	mv -v $(PKGDIR)/usr/share/man/man3/EMBOSS::ACD.3pm \
		$(LIBPKGDIR)/usr/share/man/man3/

override_dh_installman:
	# FIXME: strange "Permission denied" error - no idea why
	dh_installman || true

execute_before_dh_auto_clean:
	# Cleanup links ahead of time to avoid dh_perl choking on them.
	rm -vf $(PKGDIR)/usr/share/doc/emboss-explorer/html \
		$(PKGDIR)/etc/emboss-explorer/apache2.conf \
		$(PKGDIR)/usr/share/emboss-explorer/html/style \
		$(PKGDIR)/usr/share/emboss-explorer/html/output
