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

# see FEATURE AREAS in dpkg-buildflags(1)
# Disabling -Werror=format-security because it stops the build: the logger indeed has this weakness.
export DEB_BUILD_MAINT_OPTIONS=hardening=-format,+bindnow reproducible=+all

# see ENVIRONMENT in dpkg-buildflags(1)
# Reduce over-linking the easy way.
export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

export QT_SELECT=qt5


DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk

include /usr/share/dpkg/pkg-info.mk

%:
	dh $@ --sourcedirectory=src

# Force using system libs where possible
# and, produce a file containing the version, instead of using compile date.
override_dh_auto_configure:
	echo "static constexpr auto VERSION_STRING = \"$(DEB_VERSION_UPSTREAM)\";" > src/common/generated_version_header.h
	dh_auto_configure -- -DALLOW_BUNDLED_EIGEN=OFF \
	                     -DALLOW_BUNDLED_GLEW=OFF \
	                     -DALLOW_BUNDLED_LIB3DS=OFF \
	                     -DALLOW_BUNDLED_MUPARSER=OFF \
	                     -DALLOW_BUNDLED_OPENCTM=OFF \
	                     -DALLOW_BUNDLED_QHULL=OFF
