#!/usr/bin/make -f
# -*- makefile -*-
# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

export DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

DEBVERSION := 1.0.3+dfsg1
TARBALL = OpenCTM-1.0.3-src.tar.bz2
TDIR = OpenCTM-1.0.3
get-orig-source:
	[ -e $(TARBALL) ] || wget http://qa.debian.org/watch/sf.php/openctm/$(TARBALL)
	tar -jxf $(TARBALL)
	# Remove PDFs without source
	rm -f $(TDIR)/doc/DevelopersManual.pdf
	rm -f $(TDIR)/doc/FormatSpecification.pdf
	# Remove external libraries which are in Debian or not used
	rm -rf $(TDIR)/tools/glew
	rm -rf $(TDIR)/tools/jpeg
	rm -rf $(TDIR)/tools/pnglite
	rm -rf $(TDIR)/tools/tinyxml
	rm -rf $(TDIR)/tools/zlib
	tar -jcf openctm_$(DEBVERSION).orig.tar.bz2 $(TDIR)

override_dh_python2:
	cp bindings/python/openctm.py debian/
	dh_python2
	rm debian/openctm.py

override_dh_compress:
	dh_compress -X.pdf

override_dh_clean:
	rm -f Makefile
	dh_clean

%:
	ln -s -f Makefile.linux Makefile
	dh $@ --with python2
