#!/usr/bin/make -f

%:
	dh $@

# Check files to be installed: find . -type f -maxdepth 1 -print | grep -v -P "(\.md|\.eslintrc.js|\.eslintignore|\.editorconfig|\.browserslistrc|\.lfsconfig|(vue|babel|jest)\.config\.js|(tsconfig|tsconfig\.spec).json|composer\.(lock|json)|(package|package-lock)\.json|phpcs\.xml|LEGALNOTICE|LICENSE)$" | sort
# Check dirs to be installed: find . -type d -maxdepth 1 -print | grep -v -P "(debian|\.git|tmp)$"

override_dh_auto_build:
	phpab --output autoload.php \
		--template debian/autoload.package.php.tpl \
		composer.json

override_dh_install:
	dh_install -X libs/jqplot/build_minified_script.sh -X misc/cron/archive.sh
	chmod a+w debian/matomo/usr/share/matomo/config

override_dh_link:
	dh_link
	# dh_link makes a mistake to link the file -- it links one directory up (../).
	# manually link it until this is debugged and fixed via d/links.
	mkdir -p debian/matomo/usr/share/matomo/public/plugins/UserCountryMap/javascripts/vendor
	ln -f -s ../../../../../javascript/raphael/raphael.min.js	debian/matomo/usr/share/matomo/public/plugins/UserCountryMap/javascripts/vendor/raphael.min.js
