#!/usr/bin/make -f
include /usr/share/dpkg/default.mk

export QT_SELECT = qt5
DEB_BUILD_ARCH ?= $(shell dpkg-architecture -qDEB_BUILD_ARCH)
DEB_BUILD_OPTIONS += nocheck
SYSTYPE=Desktop
SYSTYPE=$(shell cat /etc/deepin-version | grep Type= | awk -F'=' '{print $$2}')

%:
	dh $@ --parallel

ifeq ($(DEB_BUILD_ARCH), amd64)
override_dh_auto_configure:
	dh_auto_configure -- -DCVERSION=$(DEB_VERSION_UPSTREAM)
endif

ifeq ($(DEB_BUILD_ARCH), x86_64)
override_dh_auto_configure:
	dh_auto_configure -- -DCVERSION=$(DEB_VERSION_UPSTREAM)
endif

ifeq ($(DEB_BUILD_ARCH), mips64el)
override_dh_auto_configure:
	dh_auto_configure -- -DCVERSION=$(DEB_VERSION_UPSTREAM)
endif

ifeq ($(DEB_BUILD_ARCH), mipsel)
override_dh_auto_configure:
	dh_auto_configure -- \
		-DDCC_ENABLE_AUTOSTART=YES \
		-DDCC_DISABLE_OPACITY_ANIMATION=YES \
		-DDCC_KEEP_SETTINGS_LIVE=YES \
		-DDCC_DISABLE_MIRACAST=YES \
		-DDCC_DISABLE_GRUB=YES \
		-DDISABLE_SYS_UPDATE_MIRRORS=YES \
		-DDCC_DISABLE_LANGUAGE=YES -DCVERSION=$(DEB_VERSION_UPSTREAM)
endif

ifeq ($(DEB_BUILD_ARCH), arm64)
override_dh_auto_configure:
	dh_auto_configure -- -DDISABLE_SYS_UPDATE_SOURCE_CHECK=YES \
		-DDISABLE_SYS_UPDATE_MIRRORS=YES -DCVERSION=$(DEB_VERSION_UPSTREAM)
endif

ifeq ($(DEB_BUILD_ARCH), sw_64)
override_dh_auto_configure:
	dh_auto_configure -- -DCVERSION=$(DEB_VERSION_UPSTREAM)
endif

ifeq ($(DEB_BUILD_ARCH), loongarch64)
override_dh_auto_configure:
	dh_auto_configure -- -DCVERSION=$(DEB_VERSION_UPSTREAM)
endif
