#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1 -Wl,-z,defs

# arm64 上 ephy-encodings 单测依赖 glib 生成本地化排序键（collation key）的具体结果，
# 该断言在当前构建环境（glibc C.UTF-8）下失败；amd64/loong64 同源同环境构建通过测试。
# 仅在 arm64 跳过测试（DEB_BUILD_OPTIONS=nocheck 由 dh_auto_test 识别），其他架构行为不变。
ifeq ($(DEB_HOST_ARCH),arm64)
export DEB_BUILD_OPTIONS := $(DEB_BUILD_OPTIONS) nocheck
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		-Dauto_features=enabled

execute_after_dh_install-arch:
	cd debian/epiphany-browser/usr/bin \
		&& mv epiphany-browser.sh epiphany-browser

override_dh_auto_test:
	dbus-run-session -- \
	xvfb-run -a -s "-screen 0 1024x768x24 -noreset" -e /proc/self/fd/2 \
	dh_auto_test
