#!/usr/bin/make -f

# Output every command that modifies files on the build system
#export DH_VERBOSE = 1

# Enable all hardening options
export DEB_BUILD_MAINT_OPTIONS = hardening=+all

# Install INSTEAD to /usr/games rather than to /usr/bin
BINDIR = games
# Put data into /usr/share/games/instead rather than /usr/share/instead
DATADIR = share/games/instead
# Configure CMake build
CMAKE_FLAGS = -DWITH_HARFBUZZ=1
# Use libluajit on supported arches and liblua51 otherwise
ifeq ($(findstring $(DEB_TARGET_ARCH), amd64 arm64 armel armhf i386 mips64el mipsel s390x powerpc riscv64 loong64),)
CMAKE_FLAGS += -DWITH_LUAJIT=0
endif
# Override some variables in CMakeLists.txt
CMAKE_CACHE_FLAGS = -DBINDIR=$(BINDIR) -DDATADIR=$(DATADIR)

%:
	dh $@ --buildsystem=cmake

override_dh_auto_configure:
	dh_auto_configure -- $(CMAKE_FLAGS) $(CMAKE_CACHE_FLAGS)

override_dh_compress:
	dh_compress --exclude=.pdf --exclude=.lua
