#!/usr/bin/make -f
# -*- makefile -*-

export DEB_CXXFLAGS_MAINT_APPEND = -std=c++14

export CONFIG_SHELL=/bin/bash

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

%:
	dh $@

override_dh_autoreconf:
	dh_autoreconf ./autogen.sh

override_dh_auto_configure:
	dh_auto_configure -- --with-synthesis-src=none --prefix=/usr \
			--sysconfdir=/etc \
			--enable-gui \
			--with-rst2man --with-rst2html --enable-dav \
			--enable-oauth2

execute_after_dh_auto_install:
	cp test/syncevo-http-server.py \
		debian/tmp/usr/bin/syncevo-http-server

override_dh_install:
	dh_install -X"*.pl"

override_dh_missing:
	dh_missing

override_dh_makeshlibs:
	dh_makeshlibs -V'libsyncevolution0 (>= 1.5.2-3~)' -plibsyncevolution0
	dh_makeshlibs -V'libsyncevo-dbus0 (>= 1.5.2-3~)' -plibsyncevo-dbus0
	dh_makeshlibs -V'libgdbussyncevo0 (>= 1.5.2-3~)' -plibgdbussyncevo0
	dh_makeshlibs --remaining-packages

override_dh_gencontrol:
	dh_gencontrol -- \
	  -Vlib:Depends="$(shell dpkg-query -W -f '$${Depends}' libsynthesis-dev \
			| sed -E 's/.*(libsynthesis[[:alnum:].-]+).*/\1/') (>= 3.4.0.47.5)"
