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

export CARGO_NET_OFFLINE=true
export CARGO_HOME=$(shell pwd)/debian/cargo_home

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export DEB_CXXFLAGS_MAINT_APPEND = -Wno-variadic-macros
#-Wall -pedantic -O3

export DEB_LDFLAGS_MAINT_APPEND =

include /usr/share/dpkg/architecture.mk


%:
	dh $@

build-indep:
	# pass

execute_after_dh_auto_clean-indep:
	$(RM) -r datasrc/__pycache__ datasrc/seven/__pycache__ debian/cargo_home/.global-cache

override_dh_auto_configure-arch:
	dh_auto_configure -a -- \
		-DMYSQL=ON -DAUTOUPDATE=OFF \
		-DTESTRUNNER_ARGS=--gtest_filter=-Jobs.LookupHost

override_dh_auto_test-arch:
	+cd obj-$(DEB_BUILD_GNU_TYPE) && make run_tests

override_dh_auto_install-indep:
	for px in 16 32 48 128 256 512; do \
		size=$${px}x$${px}; \
		fn=other/icons/DDNet_$${size}x32.png; \
		if [ -f $${fn} ]; then \
			dir=debian/tmp/usr/share/icons/hicolor/$${size}/apps/; \
			mkdir -p $${dir}; \
			cp $${fn} $${dir}/ddnet.png; \
		fi; \
	done;

execute_after_dh_install-indep:
	for f in assets/entities/license.txt languages/license.txt maps/license.txt skins/license.txt; do \
		$(RM) "debian/ddnet-data/usr/share/games/ddnet/data/$$f"; \
	done
