#!/usr/bin/make -f

%:
	dh $@

PKD := $(abspath $(dir $(MAKEFILE_LIST)))
VER := $(shell dpkg-parsechangelog -l$(PKD)/changelog -SVersion | cut -d- -f1)
PKG := fonts-roboto-slab
UURL := https://github.com/googlefonts/robotoslab
COMMIT := b62d3ce77d217e2ab5c11e560df97a506830911d

.PHONY: get-orig-source
## http://wiki.debian.org/onlyjob/get-orig-source
## https://anonscm.debian.org/cgit/pkg-games/pangzero.git/commit/debian/rules?id=eeaefee
get-orig-source get-packaged-orig-source:
	@echo "# Cloning upstream git repository..."
	git clone $(UURL) $(PKG)-$(VER) \
	|| $(RM) -r $(PKG)-$(VER)
	cd $(PKG)-$(VER) \
	&& git checkout -b debiansource $(COMMIT) \
	&& $(RM) -r .git .git*
	@echo "# Packing..."
	find -L "$(PKG)-$(VER)" -xdev -type f -o -type d -print | sort \
	| XZ_OPT="-6v" tar -caf "$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
	&& $(RM) -r "$(PKG)-$(VER)"
