#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_HOST_ARCH_OS ?= $(shell dpkg-architecture -qDEB_HOST_ARCH_OS)

LIBS = -lwrap -lpam -lssl -lcrypto
ifeq ($(DEB_HOST_ARCH_OS),linux)
	LIBS += -lcap
endif

%:
	dh ${@} --with apport

override_dh_auto_build:
	$(MAKE) CFLAGS="$(CFLAGS) $(CPPFLAGS)" LIBS="$(LIBS)" LINK=""

override_dh_auto_install:
	# auto-install disabled

	# systemd
	mkdir -p debian/vsftpd/etc/systemd/system
	cp debian/vsftpd.systemd debian/vsftpd/etc/systemd/system/vsftpd.service

override_dh_installinit:
	dh_installinit --update-rcd-params='start 20 2 3 4 5 . stop 80 1 .'

override_dh_builddeb:
	dh_builddeb -- -Zxz -z9
