File: rules

package info (click to toggle)
fretsonfire 1.3.110.dfsg2-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 9,304 kB
  • ctags: 2,702
  • sloc: python: 13,098; makefile: 214; sh: 8
file content (155 lines) | stat: -rwxr-xr-x 5,399 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f

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


CFLAGS = -Wall -g

ifneq (,$(findstring noopt,$(DEB_BUILD_OPTIONS)))
	CFLAGS += -O0
else
	CFLAGS += -O2
endif

build-indep: build-stamp

build-arch:

build: build-indep build-arch

build-stamp:
	dh_testdir
	docbook-to-man debian/fretsonfire.sgml > fretsonfire.6
	find data -name "*.svg" | sed -e "s/.svg$$/.png/" | while read l; do if ! test -f "$$l"; then echo "Missing $$l"; exit 1; fi; done

	# rename and mode these here so that dh_install can do it's magic
	cp debian/fretsonfire.sh fretsonfire
	chmod 755 fretsonfire
	cp data/icon.png fretsonfire.png
	chmod 755 src/FretsOnFire.py

	mkdir translations
	cp data/translations/*.po translations/
	cp data/translations/*.py translations/
	if test $(ls debian/translations/* -1 | wc -l) -ne 0; then \
		cp debian/translations/* translations/ ; \
		fi
	cd translations && python update.py

	touch $@

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp
	rm -rf translations
	rm -rf `find . -name "*.pyc"`
	rm -f fretsonfire.6 fretsonfire fretsonfire.png
	dh_clean

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs

	# symlink fonts
	ln -sf ../../../fonts/truetype/dejavu/DejaVuSans.ttf $(CURDIR)/debian/fretsonfire-game/usr/share/games/fretsonfire/data/international.ttf
	ln -sf ../../../fonts/truetype/dejavu/DejaVuSans.ttf $(CURDIR)/debian/fretsonfire-game/usr/share/games/fretsonfire/data/title.ttf
	ln -sf ../../../fonts/truetype/dejavu/DejaVuSans.ttf $(CURDIR)/debian/fretsonfire-game/usr/share/games/fretsonfire/data/default.ttf

	# other installation done with dh_install

# Build architecture-independent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs
	dh_installmenu
	dh_installman -pfretsonfire-game fretsonfire.6
	dh_install -pfretsonfire-game
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	#dh_python2
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

# Build architecture-dependent files here.
binary-arch: build install

binary: binary-indep binary-arch

ORIG_VERSION=$(shell dpkg-parsechangelog | sed -n '/^Version/s/[^:].*: \(.*\).dfsg-[^-]*$$/\1/p')
print-orig-version:
	echo $(ORIG_VERSION)

../FretsOnFire-$(ORIG_VERSION).tar.gz:
	wget http://www.mirrorservice.org/sites/download.sourceforge.net/pub/sourceforge/f/fr/fretsonfire/FretsOnFire-$(ORIG_VERSION).tar.gz --directory-prefix=../

extract_translation_source:
	# get the translation template (needs gettext)
	cd fretsonfire-$(ORIG_VERSION).dfsg/src && \
		xgettext -o ../data/translations/fretsonfire.pot \
			`grep -r "_(\".*\")" * | awk -F: '{print $$1}' | sort --unique`

	cat fretsonfire-$(ORIG_VERSION).dfsg/data/songs/tutorial/script.txt | \
		awk '{ print NR "|" $$0 }' | grep " text " | sed 's/ text */|/g' | \
		awk -F"|" '{ print "\n#: data/songs/tutorial/script.txt:" $$1 " \nmsgid \"" $$3 "\"\nmsgstr \"\""}' \
			>> fretsonfire-$(ORIG_VERSION).dfsg/data/translations/fretsonfire.pot

	msguniq -o fretsonfire-$(ORIG_VERSION).dfsg/data/translations/fretsonfire.pot \
		fretsonfire-$(ORIG_VERSION).dfsg/data/translations/fretsonfire.pot

	# get the source from the translation files (needs gettext)
	cd fretsonfire-$(ORIG_VERSION).dfsg/data/translations && \
		for i in *.mo; do \
			msgunfmt $$i > `echo $$i | sed -e "s/.mo/.po/"` ; \
		done

	# merge the obtained the translation files with the template (needs gettext)
	cd fretsonfire-$(ORIG_VERSION).dfsg/data/translations && \
		for i in *.po; do \
			msgmerge -o $$i $$i fretsonfire.pot ; \
		done

get-orig-source: ../FretsOnFire-$(ORIG_VERSION).tar.gz
	# clean old builds;
	rm -rf "FretsOnFire-src-$(ORIG_VERSION)/" "Frets on Fire-$(ORIG_VERSION)/" "FretsOnFire/" "fretsonfire-$(ORIG_VERSION).dfsg"

	# extract source and data
	tar xvzf "../FretsOnFire-$(ORIG_VERSION).tar.gz"

	mkdir -p "fretsonfire-$(ORIG_VERSION).dfsg/data"

	# we want all the source
	cp -va "Frets on Fire-$(ORIG_VERSION)/doc" "Frets on Fire-$(ORIG_VERSION)/src" "fretsonfire-$(ORIG_VERSION).dfsg/"
	cp -v "Frets on Fire-$(ORIG_VERSION)"/* "fretsonfire-$(ORIG_VERSION).dfsg/" || true

	# copy the data, without the songs, but with the tutorial
	cp -v "Frets on Fire-$(ORIG_VERSION)/data"/* "fretsonfire-$(ORIG_VERSION).dfsg/data/" || true
	rm -f "fretsonfire-$(ORIG_VERSION).dfsg/data"/*.ttf
	cp -va "Frets on Fire-$(ORIG_VERSION)/data/mods" "fretsonfire-$(ORIG_VERSION).dfsg/data/"
	cp -va "Frets on Fire-$(ORIG_VERSION)/data/translations" "fretsonfire-$(ORIG_VERSION).dfsg/data/"
	mkdir -p "fretsonfire-$(ORIG_VERSION).dfsg/data/songs"
	cp -av "Frets on Fire-$(ORIG_VERSION)/data/songs/tutorial" "fretsonfire-$(ORIG_VERSION).dfsg/data/songs/"

	# get translation sources (requires subversion)
	svn co https://fretsonfire.svn.sourceforge.net/svnroot/fretsonfire/trunk/data/translations _translations
	mv _translations/* "fretsonfire-$(ORIG_VERSION).dfsg/data/translations/"
	rm -rf _translations

	# turn off the execute bit on all the random files
	find "fretsonfire-$(ORIG_VERSION).dfsg" -type f | xargs chmod -x

	# build the tarball and clean up
	tar cvfz "../fretsonfire_$(ORIG_VERSION).dfsg.orig.tar.gz" "fretsonfire-$(ORIG_VERSION).dfsg"
	rm -rf "Frets on Fire-$(ORIG_VERSION)/" "FretsOnFire-src-$(ORIG_VERSION)/" "FretsOnFire/" "fretsonfire-$(ORIG_VERSION).dfsg"

.PHONY: build clean binary-indep binary-arch binary install configure