#!/usr/bin/make -f
# -*- makefile -*-
# debian/rules for mgltools-vision

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

DEBPKGNAME     := $(shell dpkg-parsechangelog | awk '/^Source:/ {print $$2}')

BRANCH=`cat debian/get-orig-source/current-branch`
RCVERSION=`cat debian/get-orig-source/rc-version`
SRC=VisionDIST
DISTDIR:=/usr/lib/python2.7/dist-packages/Vision

%:
	dh $@ --with python2

override_dh_install:
	dh_install
	dh_numpy
	find debian -name "runVision" | xargs -r chmod +x
	find debian -name *.jpg -o -name *.png -o -name *.pdb -o -name *.gif | xargs -r chmod 644
	mkdir -p debian/$(DEBPKGNAME)/usr/share/$(DEBPKGNAME)
	for dir in Icons doc icons ; do \
	    mv debian/$(DEBPKGNAME)/$(DISTDIR)/$${dir} debian/$(DEBPKGNAME)/usr/share/$(DEBPKGNAME) ; \
	    ln -sf ../../../../share/$(DEBPKGNAME)/$${dir} debian/$(DEBPKGNAME)/$(DISTDIR)/$${dir} ; \
	done
	cp -a debian/lena-replacement/lena.jpg debian/$(DEBPKGNAME)/usr/share/$(DEBPKGNAME)/doc/Examples
	cp -a debian/lena-replacement/lena.jpg debian/$(DEBPKGNAME)/usr/share/$(DEBPKGNAME)/doc/Examples/matplotlib/Data

get-orig-source:
	./debian/get-orig-source/get-orig-source $(SRC) $(BRANCH) $(RCVERSION)
