#!/usr/bin/make -f
export DH_VERBOSE=1
include /usr/share/dpkg/default.mk
export XDG_CACHE_HOME := $(CURDIR)/.cache

%:
	dh $@

override_dh_auto_build:
	#nimble build --verbose
	#nim c -d:release --noBabelPath src/fab.nim
	PREFIX=/usr make
	echo "generating HTML docs"
ifeq (,$(findstring nodoc,$(DEB_BUILD_OPTIONS)))
	nim doc -o:./htmldocs --project --index:on src/main.nim
	nim buildIndex -o:htmldocs/theindex.html htmldocs
	find htmldocs -name '*.idx' -delete
	echo "generating man pages"
	make manpage
endif

override_dh_auto_test:
	# Broken, see https://github.com/nim-lang/nimble/issues/637 and 638
	#http_proxy='http://127.0.0.1:9/' https_proxy='http://127.0.0.1:9/' 	#	nimble test --verbose
	true

