#!/usr/bin/make -f

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

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@ --parallel --with autoreconf

override_dh_autoreconf:
	intltoolize --automake --copy --force
	dh_autoreconf

# --enable-werror will cause FTBFS on GNU Hurd:
# src/vfs/fish/fish.c: In function 'fish_fh_open': 
# fish.c:1517:5: error: 'and' of mutually exclusive equal-tests is always 0 [-Werror]
#
# AWK="awk" is inheritance of 4.7.* series, see http://bugs.debian.org/499723
# might be still necessary for extfs scripts
override_dh_auto_configure:
	dh_auto_configure -- AWK="awk" \
		--libexecdir='$${prefix}/lib' \
		--with-x \
		--with-screen=slang \
		--disable-rpath \
		--disable-static \
		--enable-vfs-undelfs \
		--enable-tests
#		--enable-vfs-smb=yes

override_dh_auto_install:
	dh_auto_install --max-parallel=1

override_dh_fixperms:
	chmod 755 debian/mc/etc/mc/*.rc
	dh_fixperms
	# cons.saver has to be sgid tty to access vcsa
	chgrp tty debian/mc/usr/lib/mc/cons.saver || true
	chmod g+s debian/mc/usr/lib/mc/cons.saver || true

override_dh_installchangelogs:
	dh_installchangelogs doc/NEWS

override_dh_strip:
	dh_strip --dbg-package=mc-dbg

get-orig-source:
	uscan --noconf --destdir=. --download-current-version --rename --verbose
