#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

export QT_SELECT = qt6
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_CFLAGS ?= $(shell dpkg-buildflags --get CFLAGS)
DEB_CPPFLAGS ?= $(shell dpkg-buildflags --get CPPFLAGS)
DEB_CXXFLAGS ?= $(shell dpkg-buildflags --get CXXFLAGS)

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

# Use realtime timestamp instead of the latest entry in debian/changelog
SOURCE_DATE_EPOCH := $(shell date +%s)

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE = 1

%:
	dh $@ --parallel

override_dh_auto_configure:
	dh_auto_configure -- \
	-DVERSION=$(DEB_VERSION_UPSTREAM) \
	-DCMAKE_BUILD_TYPE=Release \
	-DCMAKE_C_FLAGS="$(DEB_CFLAGS) $(DEB_CPPFLAGS)" \
	-DCMAKE_CXX_FLAGS="$(DEB_CXXFLAGS) $(DEB_CPPFLAGS)"

#Ignore the dpkg-shlibdeps: warning (it uses none of the library's symbols)
#Qt Mutidedia lib will ref to network libraray.
override_dh_shlibdeps:
	dh_shlibdeps --dpkg-shlibdeps-params=--warnings=0 --exclude=opt/durapps/spark-store/bin/ss-feedback/
override_dh_strip:
	dh_strip --exclude=opt/durapps/spark-store/bin/ss-feedback/