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

# dolphin does not work with -fPIE
export DEB_BUILD_MAINT_OPTIONS := hardening=+all,-pie
export DEB_LDFLAGS_MAINT_APPEND := -Wl,--as-needed

VER := $(shell dpkg-parsechangelog --show-field Version)
UPSTREAM_VER := $(shell echo $(VER) | sed 's/+dfsg.*//')

%:
	dh $@ --parallel

CMAKE_OPTIONS := \
	-Dbindir=/usr/games \
	-Ddatadir=/usr/share/games/dolphin-emu \
	-DDOLPHIN_WC_DESCRIBE=$(UPSTREAM_VER) \
	-DDOLPHIN_WC_REVISION=$(VER) \
	-DDOLPHIN_WC_BRANCH=debian

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_OPTIONS)

get-orig-source:
	uscan --noconf --verbose --rename --destdir=$(CURDIR) --check-dirname-level=0 --force-download --repack --compression=xz --download-current-version
