#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

DEB_CMAKE_EXTRA_FLAGS = -DWANT_SHARED=OFF \
 -DWANT_PORTAUDIO=ON \
 -DWANT_PORTMIDI=ON \
 -DWANT_RUBBERBAND=ON
export DEB_CMAKE_EXTRA_FLAGS

export QTDIR=/usr/lib/qt5

%:
	dh $@

override_dh_strip:
	dh_strip --no-automatic-dbgsym

# (Re)generate locale files from code sources

# TODO: The commented-out section below comes from the old
# "debian/doc.stamp:" target, which seems to have been called from
# common-build-indep:: debian/docs.stamp.  Consequently, it is likely
# we'll need to provide a comparable method to make the build
# reproducible.

override_override_dh_auto_build:
	dh_auto_build
	# When upstream restores data/doc, uncomment the following:
	# $(MAKE) -C data/doc
	# touch $@
	cd data/i18n && ./updateTranslations.sh
	touch $@

override_dh_auto_clean:
	rm -f debian/docs.stamp
	rm -rf CMakeCache.txt CMakeFiles/ try/
	rm -f qt4.pyc version.cpp config.h
	rm -f debian/l10n.stamp

# Comment-out the following to see if it's still necessary.  Also I'm
# not sure if we should continue to use this method in ≥2020.
# DEB_UPSTREAM_CRUFT_MOVE = usr/share/hydrogen/data/i18n/*.qm

# Disable the following temporarily, to see if it's still necessary
# override_dh_auto_install:
# 	find $(CURDIR)/debian/hydrogen/usr/share/ -type d -empty -delete
# 	rm -rf $(CURDIR)/debian/hydrogen/usr/lib/
# 	rm -rf $(CURDIR)/debian/hydrogen/usr/include/
# 	dh_auto_install
