#!/usr/bin/make -f

# DH_VERBOSE := 1

%:
	dh $@

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS)))
	if [ 6 -le "$(shell cs2cs 2>&1 | head -1 | cut -d' ' -f2 | cut -d'.' -f1)" ]; then \
	    PROJ_LIB=.:/usr/share/proj perl ./testrdtrans2018.pl -v; \
	else \
	    PROJ_LIB=. perl ./testrdtrans2008.pl -v; \
	fi
endif

override_dh_install:
	dh_install --list-missing

	if [ 6 -gt "$(shell cs2cs 2>&1 | head -1 | cut -d' ' -f2 | cut -d'.' -f1)" ]; then \
		mkdir -p $(CURDIR)/debian/proj-rdnap/usr/share/proj; \
		cp -v $(CURDIR)/debian/rdnap* $(CURDIR)/debian/proj-rdnap/usr/share/proj/; \
	fi

get-orig-source:
	. debian/get-orig-source