#!/usr/bin/make -f

SHELL := sh -e

%:
	dh ${@} --with autotools_dev

override_dh_auto_configure:
	dh_auto_configure -- --disable-rpath --enable-guile --enable-ipv6 --with-microhttpd=yes

override_dh_auto_test:
	# Disabling test suite, incomplete

override_dh_auto_install:
	dh_auto_install

	# Install configuration
	mkdir -p debian/gnunet-server/etc
	sed -e 's|^LOGFILE =.*|LOGFILE = /var/log/gnunetd/gnunetd.log|' \
	    -e 's|^PIDFILE =.*|PIDFILE = /var/run/gnunetd/gnunetd.pid|' \
	    -e 's|^USER =.*|USER = gnunet|' \
	contrib/gnunetd.conf > debian/gnunet-server/etc/gnunetd.conf

	# Removing useless files
	rm -f debian/tmp/usr/lib/*.la debian/tmp/usr/lib/GNUnet/*.la

override_dh_install:
	dh_install -a --fail-missing

override_dh_strip:
	dh_strip --dbg-package=gnunet-dbg
