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

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

PROJECT    = tox
PREFIX     = /usr/$(PROJECT)
LIBDIR     = $(PREFIX)/lib
INCLUDEDIR = $(PREFIX)/include

CONFIGURE_OPTS = \
    --prefix=$(PREFIX)         \
    --libdir=$(LIBDIR)         \
    --includedir=$(INCLUDEDIR) \
    --disable-silent-rules     \
    --enable-daemon            \
    --disable-tests            \
    --disable-shared

CFLAGS  += -fPIC -I$(INCLUDEDIR)
LDFLAGS += -L$(LIBDIR)

export PKG_CONFIG_PATH=$(shell pkg-config --variable pc_path pkg-config):$(LIBDIR)/pkgconfig

override_dh_auto_configure:
	./configure $(CONFIGURE_OPTS)

override_dh_auto_build:
	dh_auto_build

	# strip .sh extension
	cp other/bootstrap_daemon/tox-bootstrapd.sh other/bootstrap_daemon/tox-bootstrapd

	# script-not-executable
	chmod 0755 other/bootstrap_daemon/tox-bootstrapd

override_dh_auto_test:
	/bin/true

override_dh_shlibdeps:
	LD_LIBRARY_PATH=$(LD_LIBRARY_PATH):$(LIBDIR) dh_shlibdeps

%:
	dh $@ --parallel --with autoreconf
