#!/usr/bin/make -f

clean:
	dh_testdir
	dh_testroot
	dh_clean

install:
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	dh_install
	dh_installdocs
	dh_installexamples
	dh_installchangelogs docs/simplesamlphp-changelog.txt
	rm debian/simplesamlphp/usr/share/doc/simplesamlphp/simplesamlphp-changelog.txt
	rm -r debian/simplesamlphp/usr/share/simplesamlphp/vendor/openid/php-openid/*
	dh_link
	dh_compress
	find debian/simplesamlphp -name .gitignore -delete
	rm debian/simplesamlphp/usr/share/simplesamlphp/modules/InfoCard/lib/RP/LICENSE.txt \
	   debian/simplesamlphp/usr/share/simplesamlphp/modules/oauth/libextinc/LICENSE.txt \
	   debian/simplesamlphp/usr/share/simplesamlphp/vendor/psr/log/LICENSE \
	   debian/simplesamlphp/usr/share/simplesamlphp/vendor/simplesamlphp/saml2/LICENSE \
	   debian/simplesamlphp/usr/share/simplesamlphp/vendor/robrichards/xmlseclibs/LICENSE
	find . -type f -executable -not -path '*/bin/*' | xargs chmod -x
	find . -type d -name \.svn | xargs -r rm -r
	dh_fixperms
	chgrp www-data debian/simplesamlphp/var/lib/simplesamlphp/data \
		debian/simplesamlphp/var/log/simplesamlphp
	chmod u=rwx,g=wx,o= debian/simplesamlphp/var/lib/simplesamlphp/data \
		debian/simplesamlphp/var/log/simplesamlphp
	dh_lintian
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

build: build-arch build-indep
build-arch: build-stamp
build-indep: build-stamp
build-stamp:

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