#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_BUILD_MAINT_OPTIONS=hardening=+all
export DEB_PYTHON_INSTALL_LAYOUT=deb_system

%:
	dh $@ --with python3

override_dh_auto_configure:
	dh_auto_configure -- -DCMAKE_INSTALL_LIBDIR=lib/ledger -DBUILD_DOCS=1 -DBUILD_WEB_DOCS=1 -DUSE_PYTHON=ON

override_dh_auto_build:
	dh_auto_build -- all doc

override_dh_auto_install:
	# do not care about shipping convenience library
	# as a public one, it's for private eyes only
	dh_auto_install
	rm -rf debian/*/usr/include/
	rm -rf debian/*/usr/lib/ledger/libledger.so

execute_after_dh_install:
	find debian/python3-ledger -name "ledger*.so" -exec chrpath -d {} \;
	rm -f debian/ledger/usr/share/doc/ledger/contrib/non-profit-audit-reports/GPLv3
	rm -f debian/ledger/usr/share/doc/ledger/contrib/non-profit-audit-reports/LICENSE

override_dh_compress:
	dh_compress -X.pdf

override_dh_makeshlibs:
	dh_makeshlibs -Xusr/lib/ledger/
