File: rules

package info (click to toggle)
freedict 2018.10.21-3
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid
  • size: 704,732 kB
  • sloc: xml: 472,663; makefile: 482; yacc: 207; sh: 108; perl: 101
file content (81 lines) | stat: -rwxr-xr-x 2,414 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
#!/usr/bin/make -f
# Uncomment this to turn on verbose mode.
# export DH_VERBOSE=1

FREEDICT_TOOLS ?= /usr/share/freedict
export FREEDICT_TOOLS

DICTS=$(strip $(shell find . -maxdepth 1 -name '???-???'|sort |sed 's|^\./||g'|tr '\n' ' '))

# overwrite any existing definition
export FREEDICT_TOOLS = /usr/share/freedict

# If the environment variable BUILD_MODE=dummy is set, no dictionaries are
# build, but only dummy files are created. This is useful for test builds of the
# package, because the actual build takes ages.
BUILD_MODE ?= normal

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    MAKEFLAGS += -j$(NUMJOBS)
endif

%:
	dh $@

override_dh_auto_build: $(DICTS)

$(DICTS):
ifeq ($(BUILD_MODE),normal)
	$(MAKE) -C $@ build-dictd
else
	mkdir -p $@/build/dictd
	touch $@/build/dictd/$@.dict.dz $@/build/dictd/$@.index
endif

override_dh_auto_clean:
	dh_clean
	dh_testdir
	rm -f build-stamp timestamp configure-stamp
	rm -rf config.txt
	for DICT in $(DICTS); do \
		rm -rf $$DICT/build; \
		rm -rf debian/dict-freedict-$$DICT.dirs; \
		rm -rf debian/dict-freedict-$$DICT.docs; \
		rm -rf debian/dict-freedict-$$DICT.postinst; \
		rm -rf debian/dict-freedict-$$DICT.postrm; \
	done
	dh_clean


override_dh_auto_install:
	# create debian/dict-freedict-$LANG.dirs file and maint scripts
	for DICT in $(DICTS); do \
		sed "s/LANG/$$DICT/g" debian/dict-freedict-lang-dirs.tmpl > \
			debian/dict-freedict-$$DICT.dirs; \
		cp debian/postinst debian/dict-freedict-$$DICT.postinst; \
		cp debian/postrm debian/dict-freedict-$$DICT.postrm; \
	done

	dh_installdirs

	# copy files to final destination
	for DICT in $(DICTS); do \
		cp $$DICT/build/dictd/$$DICT.dict.dz debian/dict-freedict-$$DICT/usr/share/dictd/freedict-$$DICT.dict.dz; \
		cp $$DICT/build/dictd/$$DICT.index debian/dict-freedict-$$DICT/usr/share/dictd/freedict-$$DICT.index; \
	done

	# generate *.docs-files:
	sh debian/gendocs.sh
	dh_install

# this rule is explicitly here to document the source retrieval workflow
# requires python3
fetch-orig:
	python3 $(FREEDICT_TOOLS)/fetchdictdata.py --orig --criteria 'sourceURL!wikdict'

# generate debian/copyright and debian/control
gen-cc:
	python3 $(FREEDICT_TOOLS)/fetchdictdata.py --dc --criteria 'sourceURL!wikdict'

.PHONY: override_dh_auto_build_indep override_dh_auto_clean override_dh_auto_install $(DICTS)