#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

execute_before_dh_auto_configure:
	# Restore empty versions of some files that were removed for the DFSG tarball
	mkdir -p sdrbase/resources/webapi/doc/html2/ \
		sdrbase/resources/webapi/doc/swagger-ui/
	touch \
		sdrbase/resources/webapi/index.html \
		sdrbase/resources/webapi/doc/html2/index.html \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-initializer.js \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-bundle.js \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-bundle.js.map \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle-core.js \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle-core.js.map \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle.js \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-es-bundle.js.map \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-standalone-preset.js \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui-standalone-preset.js.map \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.css \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.css.map \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.js \
		sdrbase/resources/webapi/doc/swagger-ui/swagger-ui.js.map

override_dh_auto_configure:
	dh_auto_configure -- \
		-DCMAKE_BUILD_TYPE=Release \
		-DARCH_OPT="" \
		-DENABLE_QT6=ON \
		-DDEBUG_OUTPUT=OFF \
		-DRX_SAMPLE_24BIT=ON \
		-DBUILD_SHARED_LIBS=ON \
		-DENABLE_EXTERNAL_LIBRARIES=OFF \
		-DENABLE_LIBUNWIND=$(UNWIND) \
		-DENABLE_PERSEUS=OFF \
		-DENABLE_SDRPLAY=OFF \
		-DENABLE_CHANNELRX_DEMODINMARSAT=OFF \
		-DENABLE_CHANNELRX_DEMODDAB=OFF \
		-DENABLE_CHANNELRX_DEMODAPT=OFF \
		-DENABLE_CHANNELRX_DEMODDSD=OFF \
		-DENABLE_CHANNELRX_REMOTESINK=OFF \
		-DENABLE_CHANNELRX_SIGMFFILESINK=OFF \
		-DENABLE_CHANNELTX_REMOTESOURCE=OFF \
		-DENABLE_FEATURE_SATELLITETRACKER=OFF \
		-DENABLE_FEATURE_MORSEDECODER=OFF \
		-DENABLE_FEATURE_DENOISER=OFF \
		-DENABLE_FEATURE_MAP=OFF

execute_after_dh_auto_install:
	rm -rf debian/tmp/usr/share/sdrangel

%:
	dh $@ --with single-binary
