#!/usr/bin/make -f
#export DH_VERBOSE = 1

%:
	dh $@

override_dh_auto_build:
	# web_kbot 前端：Launchpad 源中 npm 包存在依赖冲突，使用源码包内预构建 dist/
	test -f kylin-aiassistant/web_kbot/dist/index.html || (echo "ERROR: web_kbot/dist not found, run 'npm run build' in web_kbot first" && exit 1)
	# huanghe-proposed 仅有 rav1e 0.8；构建阶段无 apt 权限，用 wget 补装 main 源 librav1e0
	if ! test -e /usr/lib/x86_64-linux-gnu/librav1e.so.0; then \
		cd /tmp && \
		wget -q -O librav1e0.deb \
			http://archive.build.openkylin.top/openkylin/pool/_new/main/r/rust-rav1e/librav1e0_0.7.1-ok1_amd64.deb && \
		dpkg -i librav1e0.deb || \
		(echo "ERROR: librav1e.so.0 required by libavcodec60 (Qt WebEngine) is missing" && exit 1); \
	fi
	# Build kylin-aiassistant Qt project
	dh_auto_build

override_dh_shlibdeps:
	dh_shlibdeps --dpkg-shlibdeps-params=--ignore-missing-info
