#!/usr/bin/make -f

#export DH_VERBOSE = 1

PYVERS = $(shell py3versions -r)

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export PYBUILD_NAME = apsw
export PYBUILD_BUILD_ARGS = -g --enable=load_extension

%:
	dh $@ --with python3 --buildsystem=pybuild

override_dh_install:
	dh_install
	mkdir -p debian/python-apsw-doc/usr/share/doc/python-apsw
	cp -a doc debian/python-apsw-doc/usr/share/doc/python-apsw/html

# Remove Google Analytics footer (see
# http://lintian.debian.org/tags/privacy-breach-google-adsense.html)
	sed -i '/This page uses.*analytics.google.com/,/<\/div>/d' \
	    debian/python-apsw-doc/usr/share/doc/python-apsw/html/*.html

	cd debian/python-apsw-doc/usr/share/doc/python-apsw && \
		ln -sf ../../../../javascript/jquery/jquery.min.js html/_static/jquery.js
	cd debian/python-apsw-doc/usr/share/doc/python-apsw && \
		ln -sf ../../../../javascript/underscore/underscore.min.js html/_static/underscore.js

	mkdir -p debian/python3-apsw-dbg/usr/share/doc
	ln -s python3-apsw debian/python3-apsw-dbg/usr/share/doc/python3-apsw-dbg
