#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

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

# Let's decide the package name and url depending on the distribution
DISTRO = "$(shell dpkg-vendor --query vendor)"

GST_PACKAGE_ORIGIN="https://tracker.debian.org/pkg/gstreamer-vaapi"

ifeq ($(DISTRO),"Debian")
GST_PACKAGE_ORIGIN="https://tracker.debian.org/pkg/gstreamer-vaapi"
endif

ifeq ($(DISTRO),"Ubuntu")
GST_PACKAGE_ORIGIN="https://launchpad.net/ubuntu/+source/gstreamer-vaapi"
endif

conf_flags = -Dpackage-origin=$(GST_PACKAGE_ORIGIN)
conf_flags +=	-Dauto_features=enabled -Ddoc=disabled -Dexamples=disabled

# Wayland is only available on linux-any
ifeq ($(DEB_HOST_ARCH_OS),hurd)
conf_flags+= -Dwayland=disabled
endif

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- $(conf_flags)

override_dh_auto_test:
	xvfb-run dh_auto_test || true
