#!/usr/bin/make -f

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

%:
	dh $@

override_dh_auto_build:
	@# Use /usr/lib here, because libdir will be used for
	@# generating the wrapper script, and we want that to be the
	@# same on all architectures. Since the script leaves it to the
	@# dynamic linker to find the library, the path is not actually
	@# used if the library is installed to a system location.
	dh_auto_build -- prefix=/usr libdir=/usr/lib

	@# Generate HTML documentation
	printf '<!DOCTYPE html><html><head><title>gtk3-nocsd README</title></head><body>\n' > README.html
	markdown README.md >> README.html
	printf '</body></html>\n' >> README.html

override_dh_auto_clean:
	dh_auto_clean
	rm -f README.html

override_dh_auto_install:
	dh_auto_install -- prefix=/usr libdir=/usr/lib/$(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

override_dh_fixperms:
	dh_fixperms
	! [ -f debian/libgtk3-nocsd0/usr/lib/*/libgtk3-nocsd.so.0 ] || \
		chmod 4644 debian/libgtk3-nocsd0/usr/lib/*/libgtk3-nocsd.so.0
