#!/usr/bin/make -f

export IPEPREFIX=/usr
export INSTALL_ROOT=$(shell pwd)/debian/tmp

IPEVER = 7.2.9

export DEB_BUILD_MAINT_OPTIONS=hardening=+all

# Tell qtchooser which version we want.
export QT_SELECT=qt5

%:
	rm -f build/doc/jquery.js
	dh $@ --sourcedirectory=src

install: debian/ipetoipe

override_dh_install: 
	dh_install
	dh_install -plibipe$(IPEVER) debian/tmp/usr/lib/lib*.so.* usr/lib

override_dh_link:
	dh_link
	dh_link usr/share/ipe/$(IPEVER)/doc usr/share/doc/ipe/doc

# TODO: install and use wrapper to avoid issue #405294.
# Needs work: the real executable must be renamed.
debian/ipetoipe: debian/ipetoipe.sh
	sed < $< > $@ -e 's,xIPELIBDIRx,/usr/bin,'
	chmod +x $@
