#!/usr/bin/make -f

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

# This has to be exported to make some magic below work.
export DH_OPTIONS

DEB_HOST_MULTIARCH := $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)
COMMON_OPTIONS := -DENABLE_TESTS=1 -DBOOTSTRAP_GN=1

%:
	dh $@ --parallel

override_dh_auto_configure:
	dh_auto_configure -- $(COMMON_OPTIONS) -DENABLE_PROPRIETARY_CODECS=1

override_dh_auto_test:
	#xvfb-run -a -s "-screen 0 1024x768x24" dh_auto_test --max-parallel=1

override_dh_auto_install:
	dh_auto_install
	dh_auto_configure -- $(COMMON_OPTIONS) -DENABLE_PROPRIETARY_CODECS=0
	dh_auto_build
	dh_auto_install --destdir debian/tmp.free

override_dh_install:
	dh_install
	dh_install -poxideqt-codecs --sourcedir=debian/tmp.free usr/lib/$(DEB_HOST_MULTIARCH)/oxide-qt/libffmpeg.so

override_dh_strip:
	dh_strip -pliboxideqtcore0 --dbg-package=oxideqt-dbg
	dh_strip -pliboxideqtquick0 --dbg-package=oxideqt-dbg
	dh_strip -pliboxideqt-qmlplugin --dbg-package=oxideqt-dbg
	dh_strip -poxideqmlscene --dbg-package=oxideqt-dbg
	dh_strip -poxideqt-codecs --dbg-package=oxideqt-codecs-dbg
	dh_strip -poxideqt-codecs-extra --dbg-package=oxideqt-codecs-extra-dbg

override_dh_fixperms:
	dh_fixperms
	chmod 4755 debian/liboxideqtcore0/usr/lib/*/oxide-qt/chrome-sandbox
