#!/usr/bin/make -f

export QT_SELECT := qt5
export DEB_CXXFLAGS_MAINT_APPEND  = -flto
export DEB_LDFLAGS_MAINT_APPEND  = -flto
export DEB_CPPFLAGS_MAINT_APPEND = -DNDEBUG
export DEB_BUILD_MAINT_OPTIONS = hardening=+all,-format

DATADIR = debian/tmp/usr/share/detectiteasy

%:
	dh $@ --buildsystem=cmake --builddirectory=build

override_dh_auto_configure:
	dh_auto_configure -- \
		-DX_RESOURCES=share/detectiteasy \
		-DWITH_PEID=ON

override_dh_auto_install:
	dh_auto_install
	# upstream folds the extra signatures into the main database (see build_dpkg.sh)
	for d in dep/Detect-It-Easy/db_extra/*/; do \
		cp -R "$$d" $(DATADIR)/db/ ; \
	done

override_dh_install:
	dh_install
	find debian -type f -name '*.sg' -exec chmod 0644 {} +
