#!/usr/bin/make -f
export JAVA_HOME=/usr/lib/jvm/default-java

include /usr/share/dpkg/architecture.mk

%:
	dh $@ --buildsystem=gradle

override_dh_auto_build:
	dh_auto_build -- -Dfile.encoding=UTF-8 assemble

override_dh_missing:
	dh_missing --fail-missing

# aapt is required, but apktool can do a couple important things
# without it.  Other arch:all tools depend on apktool, so this seems
# like the best option.
#
# To get the list of supported arches:
# curl -s 'https://packages.debian.org/search?keywords=aapt&exact=1&suite=sid' | grep -Eo 'amd64 [a-z0-9 ]+'
override_dh_gencontrol:
ifeq ($(DEB_HOST_ARCH_CPU),$(filter $(DEB_HOST_ARCH_CPU),amd64 arm64 armel armhf i386 mips64el mipsel))
	dh_gencontrol -- -Vapktool:Depends="aapt" -Vapktool:Recommends="";
else
	dh_gencontrol -- -Vapktool:Depends="" -Vapktool:Recommends="aapt";
endif
