#!/usr/bin/make -f
# -*- makefile -*-
# Sample debian/rules that uses debhelper.
#
# This file was originally written by Joey Hess and Craig Small.
# As a special exception, when this file is copied by dh-make into a
# dh-make output file, you may use that output file without restriction.
# This special exception was added by Craig Small in version 0.37 of dh-make.
#
# Modified to make a template file for a multi-binary package with separated
# build-arch and build-indep targets  by Bill Allombert 2001

# Uncomment this to turn on verbose mode.
export DH_VERBOSE=1
# This ensures that cmake uses debian's version of hamlib
export PKG_CONFIG_ALLOW_SYSTEM_LIBS=1
# Belt and Braces
export WSJT_SKIP_MANPAGES=1
# Debian Hardening
export DEB_BUILD_MAINT_OPTIONS=hardening=+all

%:
	dh $@

override_dh_auto_configure:
	# look for documentation in /usr/share/doc/wsjtx instead of .../WSJT-X
	dh_auto_configure -- -DCMAKE_INSTALL_DOCDIR=share/doc/wsjtx

override_dh_installchangelogs:
	# there are various files with upstream notes, NEWS is the most comprehensive one
	dh_installchangelogs NEWS

override_dh_installdocs-indep:
	dh_installdocs --indep
	# Fix font-awesome from cloudflare
	sed -i -e 's/https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/4.7.0\/css\/font-awesome.min.css/\/usr\/share\/fonts-font-awesome\/css\/font-awesome.min.css/g' \
		debian/wsjtx-doc/usr/share/doc/wsjtx/wsjtx-main-*.html
	sed -i -e 's/https:\/\/cdnjs.cloudflare.com\/ajax\/libs\/font-awesome\/4.7.0\/css\/font-awesome.min.css/\/usr\/share\/fonts-font-awesome\/css\/font-awesome.min.css/g' \
		debian/tmp/usr/share/doc/wsjtx/wsjtx-main-*.html
