#!/usr/bin/make -f

export PYBUILD_NAME=pyregfi
LIB_R_VERSION=1.0.1

LIBDIR=$(CURDIR)/debian/libregfi1t64

export DOCPATH=$(CURDIR)/debian/reglookup-doc/usr/share/doc/reglookup-doc
export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_BUILD_HARDENING=1

%:
	dh $@ --buildsystem=pybuild --with python3

override_dh_auto_build:
	CFLAGS="$(CPPFLAGS) $(CFLAGS)" scons bin doc doc-devel
	dh_auto_build

override_dh_auto_install:
	CFLAGS="$(CPPFLAGS) $(CFLAGS)" PREFIX=/usr DESTDIR=debian/reglookup MANDIR=/usr/share/man LIBDIR=/usr/lib/$(DEB_HOST_MULTIARCH) scons install
	dh_auto_install

override_dh_install-arch:
	dh_install
	cp $(CURDIR)/lib/libregfi.so \
           $(LIBDIR)/usr/lib/libregfi.so.$(LIB_R_VERSION)

override_dh_install-indep:
	dh_install
	# Remove unnecessary hashes
	find $(DOCPATH) -name '*.md5' -exec rm -f {} \;
	# Using jdupes to convert duplicate files in softlinks
	jdupes -rl $(DOCPATH)
	# Avoid an embedded javascript library
	rm $(DOCPATH)/pyregfi/jquery.js

override_dh_auto_test:
