#!/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 $@ 

get-orig-source:
	DEHS=$$(mktemp) && \
	export NST_DSTDIR=$$PWD && \
	export NST_TMPDIR=$$(mktemp -d) && \
	cd $$NST_TMPDIR && \
	uscan --dehs --download --destdir . --package nestopia \
	      --upstream-version 0 --repack \
	      --force-download --watchfile $(dir $(_))/watch > $$DEHS && \
	VERSION=$$(sed -n 's/.*<upstream-version>\(.*\)<\/upstream-version>.*/\1/p' $$DEHS) && \
	mkdir nestopia-$$VERSION+dfsg && \
	cd nestopia-$$VERSION+dfsg && \
	tar xf ../nestopia-$$VERSION.tgz && \
	mv nestopia-$$VERSION/* . && \
	rm -rf nestopia-$$VERSION && \
	rm -rf dll lib source/kaillera source/unrar && \
	cd .. && \
	tar cjf $$NST_DSTDIR/nestopia_$$VERSION+dfsg.orig.tar.bz2 nestopia-$$VERSION+dfsg && \
	rm -rf $$NST_TMPDIR
