#!/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.

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

%:
	dh $@ 

override_dh_auto_install:
	dh_auto_install
	dh_install apicaro.py usr/share/pyshared
	dh_install icaro.py usr/share/pyshared/TurtleArt

override_dh_fixperms:
	dh_fixperms 
	chmod 644 $(CURDIR)/debian/tortucaro/usr/share/pyshared/TurtleArt/icaro.py

PACKAGE = tortucaro
SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
TARBALL = $(PACKAGE)_$(SRC_VERSION).orig.tar.gz
get-orig-source:
	rm -rf get-orig-source $(TARBALL)
	mkdir get-orig-source
	wget http://valentinbasel.fedorapeople.org/icaro-plugin-turtleart-v$(SRC_VERSION).tar \
	tar xf icaro-plugin-turtle-art-v$(SRC_VERSION).tar
	mv icaro tortucaro-$(SRC_VERSION)
	tar czf tortucaro-$(SRC_VERSION).tar.gz tortucaro-$(SRC_VERSION)
	ln -s tortucaro-$(SRC_VERSION).tar.gz tortucaro-$(SRC_VERSION).orig.tar.gz 
	rm -rf get-orig-source
	echo "  "$(TARBALL)" created; move it to the right destination to build the package"