File: rules

package info (click to toggle)
ogamesim 20130107-3.2
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 932 kB
  • sloc: ansic: 1,621; perl: 1,041; makefile: 157; javascript: 97; sh: 21
file content (64 lines) | stat: -rwxr-xr-x 1,661 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
#!/usr/bin/make -f
# -*- makefile -*-

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

SIMULATOR	:=	ogamesim
WEBGUI		:=	ogamesim-www

SIMPATH		:=	/usr/games/$(SIMULATOR)

REVISION	:=	$(shell dpkg-parsechangelog| \
	grep '^Version' | sed 's/.*-//')

DEBVERSION	:=	$(shell dpkg-parsechangelog| \
	grep '^Version' | awk '{ print $$2 }'| sed 's/-.*//')


SIMVERSION	:=	$(shell grep 'define[[:space:]]\+VERSION' \
	csim/version.h | \
	awk -- '{ print $$3 }' | \
	sed 's/[^0-9\.]//g')-$(REVISION)
GUIVERSION	:=	$(shell grep 'our[[:space:]]\+$$VERSION' \
	www/index.cgi| \
	sed 's/.*=//'| \
	sed 's/[^0-9\.]//g')-$(REVISION)

DOWNLOAD_URL	:=	'http://www.o-o-d.com/tool/sim/sim.tar.bz2'

%:
	dh $@

override_dh_auto_build:
	dh_auto_build -D csim -- for_linux
	cp csim/csim $(SIMULATOR)
	dh_auto_build -D www
	install -m 0755 www/index.cgi .
	perl -pi -e \
		's#^my\s+\$$units_conf.*#my \$$units_conf = "units.conf";#; \
		 s#^my\s+\$$lang.*#my \$$lang = "en";#; \
		 s#my\s+\$$counter_file.*#my \$$counter_file = "";#; \
		 s#^my\s+\$$simulator.*#my \$$simulator = "$(SIMPATH)";#' \
		index.cgi
	mkdir -p template
	for tmpl in `ls www/template/|grep 'sim\...\.html$$'`; do \
		cat www/template/$$tmpl \
		|sed 's~href="sim\.tar\.bz2"~href="$(DOWNLOAD_URL)"~' \
		> template/$$tmpl; \
	done
	install -m 0644 csim/csim.6 $(SIMULATOR).6
	perl -pi -e 's/csim/$(SIMULATOR)/g' $(SIMULATOR).6

override_dh_auto_clean:
	rm -fr $(CURDIR)/template
	dh_auto_clean -D csim
	dh_auto_clean

tarball: clean
	test -d ../ogamesim-$(DEBVERSION)
	cd .. && \
		tar --exclude=debian --exclude=.git \
			-czvf ogamesim_$(DEBVERSION).orig.tar.gz \
			ogamesim-$(DEBVERSION)