#!/usr/bin/make -f
# debian/rules for invesalius
# Andreas Tille <tille@debian.org>
# GPL

export DEB_BUILD_MAINT_OPTIONS = hardening=+bindnow
  
package=invesalius

PYMODDIR := /usr/lib/$(shell pyversions -r)
TARGET = $(CURDIR)/debian/$(package)
# shared library versions, option 1
version=2.0.5
major=2

%:
	dh $@ --with python2

override_dh_auto_build:
	python setup.py build_ext --inplace

override_dh_auto_clean:
	dh_auto_clean
	rm -f invesalius-3.0

override_dh_compress :
	dh_compress --exclude=LICENSE.pt.txt --exclude=.inv3

create-launcher:
	echo '#!/bin/sh' > invesalius-3.0
	echo 'export PYTHONPATH=$$PYTHONPATH:"/usr/lib/invesalius"' >> invesalius-3.0
	echo 'export INVESALIUS_LIBRARY_PATH="/usr/share/invesalius/invesalius"' >> invesalius-3.0
	echo 'cd $$INVESALIUS_LIBRARY_PATH' >> invesalius-3.0
	echo 'python invesalius.py $$@' >> invesalius-3.0

override_dh_install: create-launcher
	dh_install

override_dh_auto_install: ;

override_dh_builddeb:
	dh_builddeb -- -Z xz

get-orig-source:
	mkdir -p ../tarballs
	uscan --verbose --force-download --repack --rename --destdir=../tarballs

.PHONY: override_dh_auto_clean override_dh_install
