#!/usr/bin/make -f

override_dh_auto_configure:
	dh_auto_configure -- \
		-DENABLE_CURSES=1 \
		-DRUN_IN_PLACE=0 \
		-DCMAKE_VERBOSE_MAKEFILE=ON \
		-DENABLE_SYSTEM_JSONCPP=1 \
		-DENABLE_SYSTEM_GMP=1 \
		-DENABLE_SPATIAL=ON \
		-DJSON_INCLUDE_DIR=/usr/include/jsoncpp \
		-DENABLE_GETTEXT=1 \
		-DENABLE_FREETYPE=1 \
		-DFREETYPE_INCLUDE_DIR_freetype2=/usr/include/freetype2 \
		-DFREETYPE_INCLUDE_DIR_ft2build=/usr/include \
		-DENABLE_LEVELDB=1 \
		-DENABLE_POSTGRESQL=1 \
		-DLEVELDB_INCLUDE_DIR=/usr/include/leveldb \
		-DCUSTOM_LOCALEDIR=/usr/share/locale \
		-DCUSTOM_SHAREDIR=/usr/share/games/minetest \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_SERVER=1 \
		-DCMAKE_BUILD_TYPE=RelWithDebInfo\
		-DENABLE_UPDATE_CHECKER=OFF

# They are are needed for autopkgtest.
# run unittests when nocheck is active, but non-gating. Solves #1052671
# The unittest creates files that are to be installed in the minetest-data package.
# This files are required for autopkgtest, if the package is built with
# nocheck, this would break autopkgtest.
override_dh_auto_build:
	dh_auto_build

override_dh_install:
	dh_install -X.gitignore -Xoptimize_textures.sh
	find debian/ -iname "license.txt" -delete

override_dh_auto_test:
#	HOME=$$(mktemp -d) bin/minetest --run-unittests
#	dh_auto_test

%:
	dh $@

