#!/usr/bin/make -f
# -*- makefile -*-

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

include /usr/share/dpkg/pkg-info.mk

export DEB_BUILD_MAINT_OPTIONS = hardening=+all

export PKG_CONFIG_OPENCV4=1

%:
	dh $@

override_dh_auto_configure:
	find $(CURDIR) -name '*.xml' -exec chmod a-x {} \;
	find $(CURDIR) -name '*.html' -exec chmod a-x {} \;
	find $(CURDIR) -name '*.gyp' -exec chmod a-x {} \;
	find $(CURDIR) -name '*.md' -exec chmod a-x {} \;
	find $(CURDIR) -name '*.png' -exec chmod a-x {} \;
	find $(CURDIR) -name '*.jpg' -exec chmod a-x {} \;
	find $(CURDIR) -name '*.h' -exec chmod a-x {} \;
	chmod a-x examples/make-example-files.sh
	chmod a-x examples/make-example-files.sh
	dh_auto_configure
	node-gyp configure

override_dh_auto_build:
	node-gyp build
	find $(CURDIR)/build -name 'opencv.node' -exec chmod a-x {} \;

override_dh_auto_clean:
	dh_auto_clean
	rm -rf node_modules
	rm -rf build

override_dh_installexamples:
	dh_installexamples -Xtmp/

override_dh_auto_test:
	node test/unit.js
