#!/usr/bin/make -f

%:
	dh $@ --with autoreconf

# Adapted from http://wiki.debian.org/SandroTosi/Svn_get-orig-source
PACKAGE = ndpi
SRC_VERSION := $(shell dpkg-parsechangelog | sed -ne 's/^Version: \(\([0-9]\+\):\)\?\(.*\)-.*/\3/p')
SVN_REVISION := $(shell echo $(SRC_VERSION) | cut -d + -f 2 | sed 's/svn//' )
TARBALL = $(PACKAGE)_$(SRC_VERSION).orig.tar.gz
UPSTREAM_SVN_REPO = https://svn.ntop.org/svn/ntop/trunk/nDPI/

get-orig-source:
	rm -rf get-orig-source ../$(TARBALL)
	mkdir get-orig-source
	svn export -r $(SVN_REVISION) $(UPSTREAM_SVN_REPO) get-orig-source/$(PACKAGE)-$(SRC_VERSION)
	GZIP='--best --no-name' tar czf ../$(TARBALL) -C get-orig-source $(PACKAGE)-$(SRC_VERSION)
	rm -rf get-orig-source

.PHONY: get-orig-source
