#!/usr/bin/make -f

# DH_VERBOSE := 1
export LC_ALL=C.UTF-8

DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@

override_dh_auto_build:
	# FIXME
	# upstream is using code from htslib-test which is made
	# available via this hackish link.  The proper solution
	# would surely be to move cram/cram.h to libhts-dev
	ln -s /usr/share/htslib-test/cram/ htslib
	dh_auto_build
	rm htslib/cram

override_dh_install:
	dh_install
	# Trick to get also headers moved by d-shlibmove
	cp -a SeqLib debian # note: also GenomicRegionCollection.cpp is really needed by freebayes
	d-shlibmove --commit \
		    --multiarch \
		    --devunversioned \
		    --exclude-la \
		    --movedev debian/SeqLib usr/include \
                    src/.libs/$(DEBPKGNAME).so
	mkdir -p $(CURDIR)/debian/libseqlib-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
	mv libseqlib.pc $(CURDIR)/debian/libseqlib-dev/usr/lib/$(DEB_HOST_MULTIARCH)/pkgconfig
