#!/usr/bin/make -f

# See debhelper(7) (uncomment to enable).
# Output every command that modifies files on the build system.
export DH_VERBOSE = 1

%:
	dh $@

override_dh_auto_test:
	# Skip upstream tests that require a live MySQL/MariaDB client, a
	# systemd/journald environment or specific VM hardware, which are not
	# available in the Debian build environment.
	cp -a releases/v2.9.3.md .v2.9.3.md.mysqltuner-build
	perl build/audit_tests.pl "prove -j4 $(shell ls tests/*.t | grep -vE '(cli_validation|syslog_journal_detection|test_issue_42|test_issue_490|test_issue_896|unit_os_vm)\.t$$' | tr '\n' ' ')"; rc=$$?; mv -f .v2.9.3.md.mysqltuner-build releases/v2.9.3.md; exit $$rc

override_dh_auto_build:
	pod2man mysqltuner.pl > mysqltuner.1

override_dh_auto_install:
	dh_auto_install
	cp mysqltuner.pl debian/mysqltuner/usr/bin/mysqltuner
	sed -i '1s|^#!/usr/bin/env perl|#!/usr/bin/perl|' debian/mysqltuner/usr/bin/mysqltuner

override_dh_auto_clean:
	dh_auto_clean
	rm -f mysqltuner.1 .v2.9.3.md.mysqltuner-build

override_dh_fixperms:
	dh_fixperms
	chmod a-x debian/mysqltuner/usr/share/mysqltuner/*	
