File: rules

package info (click to toggle)
gnome-shell-extension-suspend-button 0~git20160525-3
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 188 kB
  • ctags: 40
  • sloc: makefile: 83; xml: 17
file content (62 lines) | stat: -rwxr-xr-x 2,637 bytes parent folder | download
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
58
59
60
61
62
#!/usr/bin/make -f
# -*- makefile -*-

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1

# For get-orig-source
UURL = https://github.com/laserb/gnome-shell-extension-suspend-button.git
PKD   = $(abspath $(dir $(MAKEFILE_LIST)))
PKG   = $(word 2,$(shell dpkg-parsechangelog -l$(PKD)/changelog | grep ^Source))
VER  ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog  -SVersion | sed -e s/^.*git// -e s/-.*//)
TYPE = +repack
UPSVER ?= $(shell dpkg-parsechangelog -l$(PKD)/changelog -SVersion | cut -d~ -f1)


%:
	dh $@

override_dh_auto_build:
	glib-compile-schemas --strict --targetdir=schemas/ schemas
	dh_auto_build

override_dh_install:
	# Installing translations
	for mo in $$(cd locale; ls */*/*.mo); do \
		lang=$$(dirname $$mo); \
		mkdir -p debian/$(PKG)/usr/share/locale/$$lang; \
		cp locale/$$mo debian/$(PKG)/usr/share/locale/$$lang/gnome-shell-extension-suspend-button.mo; \
	done
	# do not install the xml file
	rm debian/$(PKG)/usr/share/gnome-shell/extensions/suspend-button@laserb/schemas/org.gnome.shell.extensions.suspend-button.gschema.xml
	dh_install -Xschemas/org.gnome.shell.extensions.suspend-button.gschema.xml

## from: https://wiki.debian.org/onlyjob/get-orig-source
.PHONY: get-orig-source
get-orig-source: $(PKG)_$(UPSVER)~git$(VER)$(DTYPE).orig.tar.xz
	@#$(info I: $(UPSVER$)~$(PKG)_$(VER)$(DTYPE))
	@

UDATE = $(shell date --rfc-3339=seconds --date='TZ="UTC" \
	$(shell echo ~git$(VER) | perl -ne 'print "$$1-$$2-$$3" if m/\~(?:git|svn|hg)(\d{4})(\d{2})(\d{2})/')')

$(PKG)_$(UPSVER)~git$(VER)$(DTYPE).orig.tar.xz:
	@#echo DEBUG: VER=$(VER) UDATE=$(UDATE) UPSVER=$(UPSVER)
	@#$(info I: UDATE=$(UDATE))
	$(if $(wildcard $(PKG)-$(UPSVER)~git$(VER)),$(error $(PKG)-$(UPSVER)~git$(VER) exist, aborting..))
	@echo "# Downloading..."
	git clone $(UURL) $(PKG)-$(UPSVER)~git$(VER) \
	|| $(RM) -r $(PKG)-$(UPSVER)~git$(VER)
	cd $(PKG)-$(UPSVER)~git$(VER) \
	&& git checkout v$(VER) || git checkout $$(git log -n1 --format=%h --before="$(UDATE)") \
	&& ( echo "# Generating ChangeLog..." \
	&& git log --pretty="format:%ad  %aN  <%aE>%n%n%x09* %s%n" --date=short > ChangeLog \
	&& touch -d "$$(git log -1 --format='%ci')" ChangeLog) \
	&& echo "# Setting times..." \
	&& for F in $$(git ls-tree -r --name-only HEAD); do touch --no-dereference -d "$$(git log -1 --format="%ai" -- $$F)" "$$F"; done \
	&& echo "# Cleaning-up..." \
	&& $(RM) -r .git .git*
	@echo "# Packing..."
	find -L "$(PKG)-$(UPSVER)~git$(VER)" -xdev -type f -print | sort \
	| XZ_OPT="-6v" tar -caf "$(PKG)_$(UPSVER)~git$(VER)$(DTYPE).orig.tar.xz" -T- --owner=root --group=root --mode=a+rX \
	&& $(RM) -r "$(PKG)-$(UPSVER)~git$(VER)"