#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export CFLAGS = -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -pipe
export CXXFLAGS = -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -pipe
INSTDIR = debian/tmp

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_SKIP_RPATH=ON \
		-DCMAKE_VERBOSE_MAKEFILE=OFF \
		-DCMAKE_COLOR_MAKEFILE=ON \
		-DZM_RUNDIR=/var/run/zm \
		-DZM_SOCKDIR=/var/run/zm \
		-DZM_TMPDIR=/var/tmp/zm \
		-DZM_LOGDIR=/var/log/zm \
		-DZM_WEBDIR=/usr/share/zoneminder \
		-DZM_CONTENTDIR=/var/cache/zoneminder \
		-DZM_CGIDIR=/usr/lib/cgi-bin \
		-DZM_WEB_USER=www-data \
		-DZM_WEB_GROUP=www-data \
		-DZM_PERL_SUBPREFIX=/share/perl5 \
		-DCMAKE_INSTALL_SYSCONFDIR=etc/zm

override_dh_auto_install:
	dh_auto_install --buildsystem=cmake
	install -D -m 0644 debian/apache.conf  $(INSTDIR)/etc/zm/apache.conf
	rm $(INSTDIR)/usr/share/zoneminder/api/lib/Cake/LICENSE.txt
	rm $(INSTDIR)/usr/share/zoneminder/api/.gitignore
	rm -r $(INSTDIR)/usr/share/zoneminder/api/lib/Cake/Test

override_dh_auto_test:
	# do not run tests...

override_dh_strip:
	dh_strip --dbg-package=zoneminder-dbg

%:
	dh $@ --buildsystem=cmake --parallel
