#!/usr/bin/make -f

ifeq (,$(filter terse,$(DEB_BUILD_OPTIONS)))
export CARGO_TERM_VERBOSE = true
endif

# use local fork of debcargo and dh-cargo
PATH := $(CURDIR)/debian/dh-cargo/bin:$(PATH)
PERL5LIB = $(CURDIR)/debian/dh-cargo/lib
export PATH PERL5LIB

%:
	dh $@ --buildsystem=cargo

execute_after_dh_auto_configure:
	mkdir -p debian/build
	ln --symbolic --force ../cargo_home debian/build/cargo-home
	cd debian/build && meson --prefix=/usr ../..

override_dh_auto_build:
	cd debian/build && ninja -v

override_dh_auto_test:
	cd debian/build && ninja test

override_dh_auto_install:
	cd debian/build && DESTDIR=${CURDIR}/debian/helvum ninja install
