#!/usr/bin/make -f # -*- makefile -*- # Uncomment this to turn on verbose mode. #export DH_VERBOSE=1 PKD = $(abspath $(dir $(MAKEFILE_LIST))) PKG = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source)) PKGG = $(patsubst %-pkg,%,$(PKG))css VER = $(shell dpkg-parsechangelog -l$(PKD)/changelog | perl -ne 'print $$1 if m{^Version:\s+(\d.*)(?:\-\d+.*)};') VERG = $(shell dpkg-parsechangelog -l$(PKGG)/debian/changelog | sed -n 's/^Version: *//p') P88 = $(patsubst debian/%,%,$(wildcard debian/88*)) TMPL = $(patsubst %.in,%,$(wildcard debian/*.in)) ## check if host package version (without debian revision) match full version of encapsulated guest package ifneq ($(VER), $(VERG)) $(error Error: Packages' version mismatch: host(upstream part)/$(VER) != guest/$(VERG)) endif %: debian/po/templates.pot $(TMPL) dh $@ debian/po/templates.pot: debconf-updatepo --verbose $(TMPL): perl -p -E's{\@VERGG\@}{$(VERG)}sg;' -E's{\@PKGI\@}{$(PKG)}sg;' -E's{\@P88\@}{$(P88)}sg;' "$@.in" >"$@" chmod $$(stat --format=%a "$@.in") "$@" override_dh_clean: dh_clean $(TMPL) override_dh_installchangelogs: dh_installchangelogs $(PKGG)/debian/changelog override_dh_gencontrol: dh_gencontrol -v -- \ -Vguest:Build-Depends="$(shell perl -0n -E 's{^#.*$$}{}mg;' -E 'print $$1 if m{^Build-Depends:([^:A-Z]+)}ms;' $(PKGG)/debian/control)" \ -Vguest:Provides="$(shell perl -0nE 'print join q{,},m{^Package:\s+([^\s]+)}smg;' $(PKGG)/debian/control)" \ -Vguest:Recommends="$(shell perl -0n -E 'print $$1 if m{^Recommends:([^:A-Z]+)}ms;' $(PKGG)/debian/control)" \ -Vguest:Suggests="$(shell perl -0n -E 'print $$1 if m{^Suggests:([^:A-Z]+)}ms;' $(PKGG)/debian/control)" \ -Vguest="$(PKGG)" .PHONY: get-orig-source BZ2_FILES=$(notdir $(wildcard $(PKGG)/*.bz2)) SHA_FILES=$(addprefix $(PKGG)/, $(BZ2_FILES:.bz2=.bz2.sha256)) get-orig-source: $(PKG)_$(VER).orig.tar.xz @ $(SHA_FILES): sha256sum $(@:.bz2.sha256=.bz2) | sed 's! .*/! /usr/src/$(PKG)/!' > $@ $(PKG)_$(VER).orig.tar.xz: $(SHA_FILES) mkdir $(PKG)_$(VER) cp --archive --recursive $(PKGG) $(PKG)_$(VER)/ find -L "$(PKG)_$(VER)" -xdev -type f -print | LC_ALL=C sort \ | XZ_OPT="-6v" tar -caf $(PKG)_$(VER).orig.tar.xz -T- --exclude="*.bz2" --owner=root --group=root --mode=a+rX $(RM) -r $(PKG)_$(VER)