File: rules

package info (click to toggle)
openarena-088-data 0.8.8-10
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 485,592 kB
  • sloc: makefile: 139; ansic: 131; perl: 22; sh: 20
file content (187 lines) | stat: -rwxr-xr-x 5,806 bytes parent folder | download | duplicates (27)
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
#!/usr/bin/make -f

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

export TZ=UTC

include /usr/share/dpkg/default.mk

%:
	dh $@

paks := $(shell cat debian/$(DEB_SOURCE).paks)

# We cannot apply dh_strip_nondeterminism to the PK3 files because
# it would sort the files inside the archive, and the idTech3 engine
# is sensitive to order: an archive with re-ordered files is not
# considered network-compatible. The order of files is arbitrary but
# deterministic, and is chosen to match the arbitrary order that
# is present in upstream binary releases.
override_dh_strip_nondeterminism:
	dh_strip_nondeterminism -X.pk3

override_dh_auto_build: $(patsubst %,build/%,$(paks))
	:

debian/%.pk3.contents.raw: debian/%.pk3.contents
	sed -n -e 's/#.*//; /./p;' < $< > $@

debian/%.pk3.filenames: debian/%.pk3.contents
	sed -n -e 's/#.*//; s/.*\t//p;' < $< > $@

debian/%.pk3.qvms: debian/%.pk3.contents
	sed -n -e 's/#.*//; s/\.qvm$$//p;' < $< > $@

build/%: debian/%.pk3.qvms debian/%.pk3.filenames debian/%.pk3.contents.raw
	set -e; while read crc filename; do \
			test -f $*-$$crc.qvm || \
			$(MAKE) -f debian/rules QVMPREFIX=$(*F) QVMCRC=$$crc \
				debian/$(*F)-$$crc.qvm; \
			install -d $*/vm; \
			install -v -m644 debian/$(*F)-$$crc.qvm $*/$$filename.qvm; \
			touch --date='@$(SOURCE_DATE_EPOCH)' $*/$$filename.qvm; \
			touch --date='@$(SOURCE_DATE_EPOCH)' $*/vm; \
		done < debian/$*.pk3.qvms
	rm -f $*.pk3
	( set -e; cd $*; while read crc filename; do \
		if test $$crc = directory; then \
			chmod 0755 "$$filename"; \
		else \
			chmod 0644 "$$filename"; \
		fi; \
	done ) < debian/$*.pk3.contents.raw
	( cd $* && zip -X -o -q -9 $(CURDIR)/$*.pk3 -@ ) < \
		debian/$*.pk3.filenames

override_dh_auto_test: $(patsubst %,check/%,$(paks))
	:

check/pak0: build/pak0
	grep "NTVEpak0" pak0/vm/cgame.qvm
	grep "NTVEpak0" pak0/vm/qagame.qvm
	grep "NTVEpak0" pak0/vm/ui.qvm

check/mp-pak0: build/mp-pak0
	grep "NTVEmp-pak0" mp-pak0/vm/cgame.qvm
	grep "NTVEmp-pak0" mp-pak0/vm/qagame.qvm
	grep "NTVEmp-pak0" mp-pak0/vm/ui.qvm

check/pak6-patch085: build/pak6-patch085
	grep "NTVEpak6-patch085" pak6-patch085/vm/cgame.qvm
	grep "NTVEpak6-patch085" pak6-patch085/vm/qagame.qvm
	grep "NTVEpak6-patch085" pak6-patch085/vm/ui.qvm

check/pak6-patch088: build/pak6-patch088
	grep "NTVEpak6-patch088" pak6-patch088/vm/cgame.qvm
	grep "NTVEpak6-patch088" pak6-patch088/vm/qagame.qvm
	grep "NTVEpak6-patch088" pak6-patch088/vm/ui.qvm

# otherwise there's nothing to check
check/%: build/%
	:

# check that the PK3s are still compatible (do this as late as
# possible so that they aren't going to be modified further)
override_dh_builddeb: $(patsubst %,check-compat/%,$(paks))
	dh_builddeb

check-compat/%: debian/%.pk3.contents.raw
	perl debian/list-pk3.pl \
		debian/*/usr/share/games/openarena/*/$*.pk3 | \
		sed -n -e 's/#.*//; /./p' | \
		diff -u debian/$*.pk3.contents.raw -

build-indep: debian/openarena-088-data.README.Debian
debian/openarena-088-data.README.Debian: debian/qvms.README.Debian
	install -m644 $< $@

build-indep: debian/openarena-085-data.README.Debian
debian/openarena-085-data.README.Debian: debian/qvms.README.Debian
	install -m644 $< $@

build-indep: debian/openarena-data.README.Debian
debian/openarena-data.README.Debian: debian/qvms.README.Debian
	install -m644 $< $@

ifeq ($(filter-out openarena-oacmp1,$(DEB_SOURCE)),)
build-indep: oacmp-volume1-v3/docs/README
oacmp-volume1-v3/docs/README: oacmp-volume1-v3/docs/OACMP-Readme.txt
	install -m644 $< $@
endif

# order-only dependency: once we've generated it, no need to waste time
# generating it again, it'll come out the same
debian/$(QVMPREFIX)-$(QVMCRC).qvm: | debian/qvmbrute
	./debian/qvmbrute 0x$(QVMCRC) $@ $(QVMPREFIX)

debian/qvmbrute: | debian/qvmbrute.c
	$(DEB_BUILD_GNU_TYPE)-gcc $(CPPFLAGS) $(CFLAGS) -Wall -o debian/qvmbrute debian/qvmbrute.c $(LDFLAGS) -lz

tarball := $(DEB_SOURCE)_$(DEB_VERSION_UPSTREAM).orig.tar.xz
tardir := $(DEB_SOURCE)-$(DEB_VERSION_UPSTREAM).orig

ifeq ($(filter-out openarena-oacmp1,$(DEB_SOURCE)),)
sources = oacmp-volume1-v3
import-orig: pre-import-orig $(patsubst %,import-orig-zip/%,$(sources))
	:
else
sources = source
import-orig: pre-import-orig $(patsubst %,import-orig-pk3/%,$(paks))
	:
endif

pre-import-orig:
	rm -rf $(sources)

import-orig-pk3/%: pre-import-orig
	@if ! test -f $*.pk3; then \
		echo "Copy upstream pk3 file to $*.pk3";\
		exit 1;\
	fi
	rm -f debian/$*.pk3.contents
	rm -rf ./$*
	install -d $*
	perl debian/list-pk3.pl $*.pk3 > debian/$*.pk3.contents
	unzip -q $*.pk3 -x '*.qvm' '../*' -d $*
	set -e && if test mp-pak0 = $*; then \
		unzip -o -j mp-pak0.pk3 ../COPYING ../CREDITS; \
	fi
	# r901 is 0.8.1; r931 is 0.8.5 (despite the commit message)
	# r947 is 0.8.8
	# source/assets/textures/trak/ are not GPL-compatible
	set -e; for r in 901 931 947; do \
		if ! test -e debian/$*.svn$$r; then \
			continue; \
		fi; \
		install -d debian/svn-r$$r/source; \
		test -d debian/svn-r$$r/source/assets || svn export -r$$r \
			https://openarena.ws/svn/source/assets \
			debian/svn-r$$r/source/assets; \
		rm -rf debian/svn-r$$r/source/assets/textures/trak/; \
		while read s; do \
			rsync --link-dest=debian/svn-r$$r \
				--files-from=debian/$*.svn$$r -r \
				debian/svn-r$$r/ ./; \
		done < debian/$*.svn$$r; \
	done

import-orig-zip/%:
	@if ! test -f $*.zip; then \
		echo "Copy upstream download to $*.zip";\
		exit 1;\
	fi
	unzip $*.zip -d $*
	mv $*/*/*.pk3 .

export-orig:
	rm -rf $(tardir)
	install -d $(tardir)
	set -e && for x in $(paks) $(sources); do \
		cp -al $$x $(tardir)/$$x; \
	done
ifneq ($(filter-out openarena-oacmp1,$(DEB_SOURCE)),)
	install -m644 CHANGES COPYING CREDITS CREDITS-0.8.5 CREDITS-0.8.8 LINUXNOTES README WENEED readme_085.txt readme_088.txt $(tardir)
endif
	tar -Jvcf ../$(tarball) $(tardir)
	rm -rf $(tardir)