#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# This has to be exported to make some magic below work.
export DH_OPTIONS

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

Description := $(shell sed -e ':a; N; s/\n/$${Newline}/; ta' < debian/Description)

%:
	dh $@ --with bash-completion

override_dh_auto_configure-indep:
	dh_auto_configure -- --with-blas=blas --with-boost-libdir=/usr/lib/$(DEB_HOST_MULTIARCH) && $(MAKE) -C lib doxygen-doc && touch $@

override_dh_auto_configure-arch:
	dh_auto_configure -- --with-boost-libdir=/usr/lib/$(DEB_HOST_MULTIARCH)

override_dh_compress:
	dh_compress -Xlibfreecontact.tag -Xdemo_1000.aln -XPF00071_v25_999.fa -XPF00071_v25_999.xml

override_dh_gencontrol:
	dh_gencontrol -- '-VDescription=$(Description)'

override_dh_install:
	dh_install
	d-shlibmove --commit \
	            --multiarch \
	            --exclude-la \
	            --devunversioned \
	            --override s/libblas3-dev/libblas-dev/ \
	            --v5 \
                    --override s/libgfortran[345]-dev/libgfortran-8-dev/ \
                    --override s/libquadmath0-dev/libgcc-8-dev/ \
	            --override s/liblapack3-dev/liblapack-dev/ \
	            --movedev debian/tmp/usr/include/* usr/include \
	            debian/tmp/usr/lib/*/*.so


override_dh_bash-completion:
	echo "Until bug #668254 is fixed we need to override this"
	mkdir -p debian/freecontact/usr/share/bash-completion/completions
	cp -a freecontact.bash-completion debian/freecontact/usr/share/bash-completion/completions

override_dh_installdocs:
	dh_installdocs
	find debian -name jquery.js -delete

override_dh_auto_clean:
	rm -f build-indep-stamp
	dh_auto_clean
