#!/usr/bin/make -f

include /usr/share/dpkg/default.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_LDFLAGS_MAINT_APPEND = -Wl,-O1
export DPKG_GENSYMBOLS_CHECK_LEVEL = 4

# Specifically define the API/SONAME here to be used as part of
# dh_shlibdeps definition as well as the dev/gir install files
MAGPIE_API_VERSION = 0
MAGPIE_SONAME = 0

export MAGPIE_API_VERSION
export MAGPIE_SONAME

%:
	dh $@

ifeq ($(DEB_HOST_ARCH_OS),linux)
CONFFLAGS = \
	-Degl_device=true \
	-Dremote_desktop=false
else
CONFFLAGS = \
	-Dsystemd=false \
	-Dudev=false \
	-Dlibwacom=false \
	-Dnative_backend=false \
	-Dprofiler=false \
	-Dremote_desktop=false
endif

ifeq ($(DEB_HOST_ARCH),$(findstring $(DEB_HOST_ARCH),armel armhf))
CONFFLAGS += \
	-Ddefault_driver=gles2
endif

override_dh_auto_configure:
	dh_auto_configure -- \
		$(CONFFLAGS)


override_dh_girepository:
	dh_girepository /usr/lib/$(DEB_HOST_MULTIARCH)/magpies-$(MAGPIE_API_VERSION)

override_dh_makeshlibs:
	dh_makeshlibs -V

override_dh_shlibdeps:
	dh_shlibdeps -Llibmagpie-$(MAGPIE_API_VERSION)-$(MAGPIE_SONAME) \
		-l/usr/lib/$(DEB_HOST_MULTIARCH)/magpie-$(MAGPIE_API_VERSION)
