#!/usr/bin/make -f

PKD = $(abspath $(dir $(MAKEFILE_LIST)))
DEB_UPSTREAM_VERSION := $(shell dpkg-parsechangelog -l$(PKD)/changelog -SVersion | cut -d- -f1)
# Extract everything after "svn" in DEB_UPSTREAM_VERSION
SVN_EXPORT_DATE      := $(shell echo $(DEB_UPSTREAM_VERSION) | sed 's/.*svn//')

%:
	dh $@ --parallel --buildsystem=maven

# Export from SVN and remove externals JAR in lib/
get-orig-source:
	mkdir orig_tmp
	(cd orig_tmp && \
	svn export -r {${SVN_EXPORT_DATE}} \
	http://svn.apache.org/repos/asf/commons/sandbox/javaflow/trunk/ \
	commons-javaflow-$(DEB_UPSTREAM_VERSION) && \
	rm -rf commons-javaflow-$(DEB_UPSTREAM_VERSION)/lib && \
	tar -czf ../../commons-javaflow_$(DEB_UPSTREAM_VERSION).orig.tar.gz commons-javaflow-$(DEB_UPSTREAM_VERSION))
	rm -rf orig_tmp

