#!/usr/bin/make -f

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

export DEB_BUILD_OPTIONS += noautodbgsym

%:
	dh $@ --with coq,ocaml

override_dh_auto_build:
	dune build -p coq-quickchick

override_dh_auto_install:
	dune install coq-quickchick --destdir=$(CURDIR)/debian/tmp --prefix=/usr --libdir=$(OCAML_STDLIB_DIR)
	find $(CURDIR)/debian/tmp -name LICENSE -delete
	rm -rf $(CURDIR)/debian/tmp/usr/doc
	help2man $(CURDIR)/debian/tmp/usr/bin/quickChick --no-discard-stderr \
	  -n "Randomized property-based testing for Coq" --version-string=$(DEB_VERSION_UPSTREAM) > debian/quickChick.1

override_dh_auto_clean:
	make clean
	rm -f .lia.cache plugin/META.coq-quickchick
	find . -name "*.vo*" -delete
