File: rules

package info (click to toggle)
freedict 1.3-4
  • links: PTS
  • area: main
  • in suites: lenny, squeeze, wheezy
  • size: 35,608 kB
  • ctags: 6
  • sloc: makefile: 121; sh: 46; xml: 14
file content (156 lines) | stat: -rwxr-xr-x 5,313 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
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
#!/usr/bin/make -f

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

VRESION = 1.3-4

BASENAMES=$(shell ls *.tar.gz | sed s/-20[0-9][0-9][0-9][0-9][0-9][0-9].tar.gz//)

DICTS1 = afr-deu cze-eng dan-eng deu-eng deu-fra deu-ita deu-nld deu-por eng-deu \
         eng-fra eng-iri eng-lat eng-nld eng-rom eng-rus eng-scr eng-spa eng-swe \
         eng-wel fra-deu fra-eng fra-nld iri-eng ita-deu jpn-deu lat-deu lat-eng \
         nld-deu nld-eng nld-fra por-deu por-eng sco-deu scr-eng slo-eng spa-eng \
         swe-eng tur-deu wel-eng

DICTS2 = eng-ita eng-por ita-eng

DICTS3 = eng-hun hun-eng

build: build-stamp

build-stamp:
	dh_testdir

	for FILE in $(BASENAMES); do \
		tar -zxvf $$FILE-20*.tar.gz; \
	done

	for DICT in $(DICTS1); do \
		echo '---  Rebuilding ==>' $$DICT 'dictionary  ---'; \
		dictunzip -f $$DICT.dict.dz; \
		cat $$DICT.dict | dictunformat $$DICT.index > tmp1.txt; \
		sed -e '1,28d' tmp1.txt >> tmp2.txt; \
		cat tmp2.txt | sed '$$!N; /^\( .*\)\n\1$$/!P; D' > $$DICT.txt; \
		if [ -e debian/patches/$$DICT.diff ]; then patch -u $$DICT.txt debian/patches/$$DICT.diff; fi; \
		dictfmt -t --utf8 $$DICT < $$DICT.txt; \
		cat $$DICT.dict | sed '$$d' > $$DICT.dic; \
		mv $$DICT.dic $$DICT.dict; \
		dictzip -f $$DICT.dict; \
		rm -f *.txt; \
	done

	for DICT in $(DICTS2); do \
		echo '---  Rebuilding ==>' $$DICT 'dictionary  ---'; \
		dictunzip -f $$DICT.dict.dz; \
		cat $$DICT.dict | dictunformat $$DICT.index > tmp1.txt; \
		cat tmp1.txt >> tmp2.txt; \
		cat tmp2.txt | sed '$$!N; /^\( .*\)\n\1$$/!P; D' > $$DICT.txt; \
		if [ -e debian/patches/$$DICT.diff ]; then patch -u $$DICT.txt debian/patches/$$DICT.diff; fi; \
		dictfmt -t --utf8 $$DICT < $$DICT.txt; \
		cat $$DICT.dict | sed '$$d' > $$DICT.dic; \
		mv $$DICT.dic $$DICT.dict; \
		dictzip -f $$DICT.dict; \
		rm -f *.txt; \
	done

	for DICT in $(DICTS3); do \
		echo '---  Rebuilding ==>' $$DICT 'dictionary  ---'; \
		dictunzip -f $$DICT.dict.dz; \
		cat $$DICT.dict | dictunformat $$DICT.index > tmp1.txt; \
		cat tmp1.txt | sed '/./,/^$$/!d; s/ô/ő/g; s/û/ű/g;' > tmp2.txt; \
		cat tmp2.txt | sed '$$!N; /^\( .*\)\n\1$$/!P; D' > $$DICT.txt; \
		if [ -e debian/patches/$$DICT.diff ]; then patch -u $$DICT.txt debian/patches/$$DICT.diff; fi; \
		dictfmt -t --utf8 $$DICT < $$DICT.txt; \
		cat $$DICT.dict | sed '$$d' > $$DICT.dic; \
		mv $$DICT.dic $$DICT.dict; \
		dictzip -f $$DICT.dict; \
		rm -f *.txt; \
	done

	touch build-stamp

clean:
	dh_testdir
	dh_testroot
	rm -f build-stamp configure-stamp

	dh_clean

	-rm -f *.dict *.dict.dz *.index *.txt
	-rm debian/*.dirs debian/*.links debian/*.postinst debian/*.postrm


install: build
	dh_testdir
	dh_testroot
	dh_clean -k

	for FILE in $(BASENAMES); do \
		sed "s/LANG/$$FILE/g" debian/dict-freedict-lang-dirs.tmpl > \
			debian/dict-freedict-$$FILE.dirs; \
		sed "s/LANG/$$FILE/g" debian/dict-freedict-lang-links.tmpl > \
			debian/dict-freedict-$$FILE.links; \
	done		

	for FILE in $(BASENAMES); do \
		cp debian/postinst debian/dict-freedict-$$FILE.postinst; \
		cp debian/postrm debian/dict-freedict-$$FILE.postrm; done

	sed "s/sco-deu/gla-deu/g" debian/dict-freedict-sco-deu.dirs > \
			debian/dict-freedict-gla-deu.dirs
	rm -f debian/dict-freedict-sco-deu.dirs
	sed "s/sco-deu/gla-deu/g" debian/dict-freedict-sco-deu.links > \
			debian/dict-freedict-gla-deu.links
	rm -f debian/dict-freedict-sco-deu.links
	mv debian/dict-freedict-sco-deu.postinst debian/dict-freedict-gla-deu.postinst
	mv debian/dict-freedict-sco-deu.postrm debian/dict-freedict-gla-deu.postrm

	dh_installdirs

	for FILE in $(BASENAMES); do \
		cp $$FILE.dict.dz debian/dict-freedict-$$FILE/usr/share/dictd/freedict-$$FILE.dict.dz; \
		cp $$FILE.index debian/dict-freedict-$$FILE/usr/share/dictd/freedict-$$FILE.index; \
	done

	for FILE in $(BASENAMES); do \
		name=$$(grep $$FILE debian/languagelist | cut -f2 -d\;); \
		author=$$(grep $$FILE debian/languagelist | cut -f3 -d\;); \
		sed "s/LANG/$$FILE/g" debian/opendict-plugin.xml | sed "s/NAME/$$name/g" | \
			sed "s/AUTHORN/$$author/g" | sed "s/VERSN/$(VRESION)/g" > config.txt; \
		install -m 644 config.txt \
			$(CURDIR)/debian/dict-freedict-$$FILE/usr/share/opendict/dictionaries/plain/freedict-$$FILE.dict.dz/conf/config.xml; \
	done

	cp sco-deu.dict.dz debian/dict-freedict-gla-deu/usr/share/dictd/freedict-gla-deu.dict.dz
	cp sco-deu.index debian/dict-freedict-gla-deu/usr/share/dictd/freedict-gla-deu.index
	name=$$(grep gla-deu debian/languagelist | cut -f2 -d\;); \
	author=$$(grep gla-deu debian/languagelist | cut -f3 -d\;); \
	sed "s/LANG/gla-deu/g" debian/opendict-plugin.xml | sed "s/NAME/$$name/g" | \
		sed "s/AUTHORN/$$author/g" | sed "s/VERSN/$(VRESION)/g" > config.txt
	install -m 644 config.txt \
		$(CURDIR)/debian/dict-freedict-gla-deu/usr/share/opendict/dictionaries/plain/freedict-gla-deu.dict.dz/conf/config.xml


# Build architecture-independent files here.
binary-arch: build install
# We have nothing to do by default.

# Build architecture-dependent files here.
binary-indep: build install
	dh_testdir
	dh_testroot
	dh_installchangelogs
	dh_installdocs -A debian/README.Debian
	dh_link
	dh_strip
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_shlibdeps
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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