#!/usr/bin/make -f
# You must remove unused comment lines for the released package.
#export DH_VERBOSE = 1
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
#export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed

include /usr/share/dpkg/architecture.mk

%:
	dh $@

override_dh_auto_configure:
	dh_auto_configure -- \
		  -DCMAKE_LIBRARY_ARCHITECTURE="$(DEB_TARGET_MULTIARCH)" \
		  -DCMAKE_BUILD_TYPE=RelWithDebInfo \
		  -DCMAKE_CXX_COMPILER=g++-10 \
          -DCMAKE_C_COMPILER=gcc-10 \
		  -DDOTTORRENT_MB_CRYPTO_LIB=isal

# Do not run tests
override_dh_auto_test:

# Only install torrenttools target
# source: https://unix.stackexchange.com/questions/519986/packaging-cmake-components-for-debian
override_dh_auto_install:
	sed -i -e 's/\-P/\-DCOMPONENT\=torrenttools\ \-P/g' obj-$(DEB_HOST_MULTIARCH)/Makefile
	dh_auto_install --destdir=debian/torrenttools
