File: rules

package info (click to toggle)
libdvd-pkg 1.4.0-1-2
  • links: PTS, VCS
  • area: contrib
  • in suites: stretch
  • size: 248 kB
  • ctags: 13
  • sloc: sh: 166; makefile: 56
file content (57 lines) | stat: -rwxr-xr-x 2,337 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/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)