#!/usr/bin/make -f
# debian/rules for a Meson project

include /usr/share/dpkg/default.mk

CONFIG_OPT += --prefix=/usr

MESON_OPT += -Dns-rule-dir=/usr/share/66/script/ns
MESON_OPT += -Ddbus-system-service-dir=/usr/share/dbus-1/system-services
MESON_OPT += -Ddbus-session-service-dir=/usr/share/dbus-1/services
#MESON_OPT += -Ddbus-system-config=/usr/share/dbus-1/system.conf
#MESON_OPT += -Ddbus-session-config=/usr/share/dbus-1/session.conf
#MESON_OPT += -Ddbus-system-uid-max=999
MESON_OPT += -Ddbus-system-name=system_bus_socket
MESON_OPT += -Ddbus-session-name=bus
MESON_OPT += -Duserd-pam-dir=/usr/lib/$(DEB_HOST_MULTIARCH)/security
MESON_OPT += -Duserd-runtime-base=/run/user
MESON_OPT += -Duserd-runtime-size=10%
MESON_OPT += -Duserd-dbus-addr-prefix=unix:path=
MESON_OPT += -Duserd-default-path=/usr/bin:/usr/sbin:usr/local/bin
MESON_OPT += -Dwith-doc=true
MESON_OPT += -Ddoc-only=false
MESON_OPT += -Dtest=false
#MESON_OPT += -Dwith-include-dir=
#MESON_OPT += -Dwith-staticlib-dir=
#MESON_OPT += -Dwith-dynamiclib-dir=
MESON_OPT += -Denable-shared=true
MESON_OPT += -Denable-static=false
MESON_OPT += -Denable-static-deps=false
MESON_OPT += -Denable-static-executable=false
MESON_OPT += -Denable-all-pic=false
MESON_OPT += -Denable-pie=false


%:
	dh $@ --buildsystem=meson


override_dh_clean:
	rm -rf README.md
	rm -rf obj-$(DEB_HOST_MULTIARCH)
	rm -rf src/include/66-tools/config.h
	dh_clean

override_dh_auto_configure:
	dh_auto_configure -- $(CONFIG_OPT) $(MESON_OPT)

override_dh_install:
	dh_install
	#include pam_configs
	set -e
	cp -r $(CURDIR)/debian/extra/pam-configs  $(CURDIR)/debian/66-tools/usr/share/

#override_dh_strip:
#	chrpath -d debian/66/usr/lib/*/*
#	dh_strip
