#!/usr/bin/make -f

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

%:
	dh $@ --with ocaml

override_dh_auto_build:
	dune build

override_dh_auto_test:
ifeq (,$(filter nocheck, $(DEB_BUILD_OPTIONS)))
	dune test
endif

override_dh_auto_install:
	dune install --destdir=$(CURDIR)/debian/tmp --prefix=/usr --libdir=..$(OCAML_STDLIB_DIR)
	# drop excess LICENSE files
	find debian/tmp -name "LICENSE*" -delete
	# copy the examples
	cp -R examples debian/tmp/usr/doc/crowbar
	rm -f debian/tmp/usr/doc/crowbar/examples/.gitignore
