#!/usr/bin/make -f
# See debhelper(7) (uncomment to enable)
# output every command that modifies files on the build system.
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_STRIP  = -O2
export DEB_CXXFLAGS_MAINT_STRIP  = -O2
export DEB_CFLAGS_MAINT_APPEND  = -Os
export DEB_CXXFLAGS_MAINT_APPEND  = -Os
LUA_ARCHS = amd64 arm64 armhf x86

%:
	dh $@ 

override_dh_auto_configure:
	dh_auto_configure -- -DWITH_LUA=$(if $(filter $(DEB_TARGET_ARCH),$(LUA_ARCHS)),1,0)

override_dh_install:
	dh_install
	install -m 644 -D keyledsd/keyledsd.conf.sample debian/keyleds/etc/keyledsd.conf
	install -d debian/keyleds/etc/xdg/autostart
	ln -s /usr/share/keyledsd/keyledsd.desktop debian/keyleds/etc/xdg/autostart/
	install -d debian/keyleds/lib/udev/rules.d
	cp debian/keyleds/usr/share/keyledsd/logitech.rules debian/keyleds/lib/udev/rules.d/70-logitech-hidpp.rules
