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

# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DH_VERBOSE = 1

# see FEATURE AREAS in dpkg-buildflags(1):
# - https://wiki.debian.org/Hardening#dpkg-buildflags

%:

DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/buildflags.mk

# we disable runit in configure.ac, leaving dh-runit to do the job
CONFFLAGS = \
	--prefix=/usr \
	--disable-runit \
	--disable-silent-rules \
	$(NULL)


CONFFLAGS_deb = \
	--disable-manpages \
	$(NULL)

%:
	dh $@ --with runit

override_dh_auto_configure:
	chmod +x debian/libubus1.install
	chmod +x debian/libubus-dev.install
	dh_auto_configure \
		-- $(CONFFLAGS) $(CONFFLAGS_deb)

override_dh_installinit:
	dh_installinit -pubus --no-stop-on-upgrade --no-restart-after-upgrade

# permit the packaging with /usr/local/lib libraries (from `make install`)
# you can also use `export DEB_DH_SHLIBDEPS_ARGS_ALL=--dpkg-shlibdeps-params=--ignore-missing-info`
# not a good idea!
override_dh_shlibdeps:
	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
