#!/usr/bin/make -f
-include /usr/share/gnome-pkg-tools/1/rules/gnome-get-source.mk

CONFFLAGS = --buildtype=release --prefix=/usr -Denable-gtk-doc=true

# https://github.com/ebassi/graphene/issues/95
# https://github.com/ebassi/graphene/issues/97
ifneq (,$(filter $(DEB_BUILD_ARCH),i386))
CONFFLAGS += -Denable-sse2=false
else ifneq (,$(filter $(DEB_BUILD_ARCH),armhf))
CONFFLAGS +=  -Denable-arm-neon=false
endif

%:
	dh $@ --with gir,gnome --without autoreconf

override_dh_auto_clean:
	rm -rf deb-build/
	dh_clean

override_dh_auto_configure:
	mkdir deb-build
	meson $(CONFFLAGS) . deb-build

override_dh_auto_build:
	ninja -Cdeb-build -v

override_dh_auto_install:
	DESTDIR=$(CURDIR)/debian/tmp ninja -Cdeb-build -v install

override_dh_install:
	find debian/tmp -name '*.la' -delete
	#TODO: Do something useful with these
	#dh_install --fail-missing -Xusr/libexec/installed-tests/
	dh_install --fail-missing

override_dh_makeshlibs:
	dh_makeshlibs -V -- -c4
