File: rules

package info (click to toggle)
sgt-puzzles 20191231.79a5378-3%2Bdeb11u1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 19,024 kB
  • sloc: ansic: 88,707; perl: 2,685; objc: 1,311; javascript: 674; java: 606; makefile: 189; sh: 68
file content (99 lines) | stat: -rwxr-xr-x 3,204 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
#!/usr/bin/make -f

# We require some bash features
override SHELL := /bin/bash

include /usr/share/dpkg/default.mk

LANGUAGES := en $(patsubst po/%.po,%,$(wildcard po/*.po))

# Files that have version strings substituted in the tarball but never in git
VERSION_SUB_FILES := configure.ac devel.but osx-info.plist puzzles.but version.h

# Commit message for updating them
VERSION_SUB_MSG := "Apply version string substitutions from the tarball"

CFLAGS += -Wno-error=deprecated-declarations

%:
	dh $@

# We need to configure and build the executablea twice - once to
# generate the icon files, and a second time using the icon files.

define configure_commands
./mkfiles.pl
./mkauto.sh
CFLAGS="$(CFLAGS)" CPPFLAGS="$(CPPFLAGS) -DDEBIAN_VERSION=\"\\\"$(DEB_VERSION)\\\"\"" LDFLAGS="$(LDFLAGS)" ./configure --prefix=/usr --bindir=/usr/games --program-prefix=sgt-
endef

override_dh_auto_configure:
	$(configure_commands)
	$(MAKE)
	$(MAKE) -C icons gtkicons pngicons
	$(MAKE) clean
	$(configure_commands)

override_dh_auto_build:
	$(MAKE)
	$(MAKE) -f Makefile.doc BINPREFIX=sgt-

# Disable running tests; they are quite slow and don't seem likely to catch
# regressions.
override_dh_auto_test:

override_dh_auto_install:
	$(MAKE) DESTDIR=debian/sgt-puzzles install

override_dh_installdocs:
	for lang in $(LANGUAGES); do \
		dh_install html-$$lang/*.html usr/share/sgt-puzzles/help/$$lang \
		|| exit; \
	done
	dh_installdocs

override_dh_installman:
	for lang in $(LANGUAGES); do \
		dh_installman --language=$${lang/en/C} man-$$lang/* || exit; \
	done

override_dh_install:
	dh_install debian/desktop/*.desktop usr/share/applications
	for icon in icons/*-48d24.png; do \
	    base="$$(basename $$icon -48d24.png)" && \
	    install -m644 $$icon debian/sgt-puzzles/usr/share/icons/hicolor/48x48/apps/sgt-$$base.png \
	    || exit; \
	done

override_dh_auto_clean:
	$(MAKE) -C icons clean
	! [ -f Makefile ] || $(MAKE) distclean
	$(MAKE) -f Makefile.doc clean
	dh_clean $(addprefix Makefile.,am clangcl cyg emcc gnustep gtk in nestedvm osx vc wce) aclocal.m4 compile configure depcomp gamedesc.txt install-sh list.c missing

FORCE:
.PHONY: FORCE

../puzzles.tar.gz: FORCE
	wget -N -O $@ https://www.chiark.greenend.org.uk/~sgtatham/puzzles/puzzles.tar.gz

../puzzles.tar.version: ../puzzles.tar.gz
	version="$$(tar -xOzf $< --wildcards '*/version.h' | \
		    sed -n 's/^\#define VER "Version \([^ ]*\)"$$/\1/p')" && \
	test "$${version#*.}" != "$$version" &&				\
	echo "$$version" > $@

update-upstream: ../puzzles.tar.gz ../puzzles.tar.version
	version="$$(cat ../puzzles.tar.version)" &&			\
	upstream_commit="$${version#*.}" &&				\
	git tag -m "Upstream version $$version" "upstream/$$version"	\
		"$$upstream_commit" &&					\
	git deborig --version "$$version" &&				\
	git debrebase new-upstream "$$version" &&			\
	tar -xzf $< --strip-components=1 --wildcards			\
		$(addprefix '*/',$(VERSION_SUB_FILES)) &&		\
	version_sub_commit="$$(git rev-list --grep=$(VERSION_SUB_MSG) -F \
			       $$(git debrebase breakwater)..)" &&	\
	git commit -m $${version_sub_commit:+"fixup! "}$(VERSION_SUB_MSG) \
		$(VERSION_SUB_FILES) &&					\
	{ test -z "$$version_sub_commit" || git debrebase -i --autosquash; }