#!/usr/bin/make -f export DEB_BUILD_MAINT_OPTIONS = hardening=+all DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk include /usr/share/dpkg/pkg-info.mk %: dh $@ PKG = $(DEB_SOURCE) UVER = $(DEB_VERSION_UPSTREAM) DTYPE = VER ?= $(subst $(DTYPE),,$(UVER)) ## http://wiki.debian.org/onlyjob/get-orig-source .PHONY: get-orig-source get-orig-source: $(PKG)_$(VER)$(DTYPE).orig.tar.xz $(info I: $(PKG)_$(VER)$(DTYPE)) @ ## checkout from subversion (add "subversion, svn2cl | subversion-tools (<< 1.7.5)" to Build-Depends) UURL = svn://svn.code.sf.net/p/robodude/code/bobdude/src REV = $(shell echo $(VER) | perl -ne 'print "$$1" if m/(?:git|svn|hg)(\d+)/;') $(PKG)_$(VER)$(DTYPE).orig.tar.xz: $(info I: REV=$(REV)) $(if $(wildcard $(PKG)-$(VER)),$(error $(PKG)-$(VER) exist, aborting..)) svn checkout --config-option config:miscellany:use-commit-times=yes -r $(REV) \ $(UURL) $(PKG)-$(VER) \ || $(RM) -r $(PKG)-$(VER) @echo "Clean-up..." cd $(PKG)-$(VER) \ && [ -s ChangeLog ] || ( echo "# Generating ChangeLog..." \ ; svn2cl --break-before-msg --include-rev \ | perl -0pi -e 's{(\d+\])[^:]+?:\s+}{$$1 }sgm;' ChangeLog) \ && find . -depth -name ".svn" -exec $(RM) -r '{}' \; @echo "# Packing..." find -L $(PKG)-$(VER) -xdev -type f -print | LC_ALL=C sort \ | XZ_OPT="-6v" tar -caf "../$(PKG)_$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \ && $(RM) -r "$(PKG)-$(VER)"