File: rules

package info (click to toggle)
ipolish 20180621-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 25,524 kB
  • sloc: makefile: 49; sh: 7
file content (79 lines) | stat: -rwxr-xr-x 2,603 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
#!/usr/bin/make -f

idict-package    := ipolish
words-package    := wpolish

export   LC_ALL=C
unexport LANGUAGE

SOURCE_DIR      := $(CURDIR)
TMP_BUILD_DIR   := debian/BUILDDIR
# Locales
SORT_C          := LC_ALL=C sort
LOCALE_NAME     := pl_PL
LOCALE_CHARSET  := ISO-8859-2
ifeq (,$(wildcard /usr/share/i18n/charmaps))    # `locale-all' is installed
LOCALE_DIR      :=
SORT_PL         := env -u LOCPATH LC_ALL="$(LOCALE_NAME).$(LOCALE_CHARSET)" sort
else                                            # `locale' is installed
LOCALE_DIR      := $(TMP_BUILD_DIR)/locale
SORT_PL         := env LOCPATH="$(LOCALE_DIR)" LC_ALL="$(LOCALE_NAME).$(LOCALE_CHARSET)" sort
endif

%:
	dh "$@"

override_dh_auto_clean:
	rm -rf $(TMP_BUILD_DIR)


override_dh_auto_build:
	mkdir      -p $(LOCALE_DIR) $(TMP_BUILD_DIR)
	
	## common
	# build Polish locale definition
	[ -z "$(LOCALE_DIR)" ] || \
	localedef  -i "$(LOCALE_NAME)" -f "$(LOCALE_CHARSET)"   \
	               "$(LOCALE_DIR)/$(LOCALE_NAME).$(LOCALE_CHARSET)"
	
	# check if $(SORT_PL) works correctly
	echo "a ą c ć e ę l ł n ń o ó s ś z ź ż" | recode utf-8..iso-8859-2 | \
	        tr ' ' '\n' | $(SORT_PL) -c
	
	# build mwl file used by ipolish
	$(SORT_C) -k1,1 -k 2 -t/ < $(SOURCE_DIR)/polish.all > $(TMP_BUILD_DIR)/polish.mwl.tmp
	icombine $(SOURCE_DIR)/polish.aff < $(TMP_BUILD_DIR)/polish.mwl.tmp > $(TMP_BUILD_DIR)/polish.mwl
	
	## ipolish
	gzip -9fn -c < $(TMP_BUILD_DIR)/polish.mwl > $(TMP_BUILD_DIR)/polish.mwl.gz
	
	## wpolish
	# build hash needed for generation of word list
	buildhash $(TMP_BUILD_DIR)/polish.mwl $(SOURCE_DIR)/polish.aff $(TMP_BUILD_DIR)/polish.hash
	# build word list
ifeq (,$(findstring testbuild,$(DEB_BUILD_OPTIONS)))
	ispell -d $(TMP_BUILD_DIR)/polish -e < $(TMP_BUILD_DIR)/polish.mwl | \
	        tr '\040' '\012' > $(TMP_BUILD_DIR)/polish.words.unsorted
	$(SORT_PL) -u  < $(TMP_BUILD_DIR)/polish.words.unsorted > $(TMP_BUILD_DIR)/polish.words
else
	touch $(TMP_BUILD_DIR)/polish.words
	echo "Test build.... Press any key..."
	read THROWAWAY
endif
	# recode into utf-8
	recode iso-8859-2..utf-8  $(TMP_BUILD_DIR)/polish.words

override_dh_auto_install:
	## ipolish
	dh_installdocs -p$(idict-package) $(SOURCE_DIR)/README
	
	install -m 644 $(SOURCE_DIR)/polish.aff        debian/$(idict-package)/usr/lib/ispell/
	install -m 644 $(TMP_BUILD_DIR)/polish.mwl.gz  debian/$(idict-package)/usr/share/ispell/
	
	installdeb-ispell -p$(idict-package)
	
	## wpolish	
	install -m 644 $(TMP_BUILD_DIR)/polish.words    debian/$(words-package)/usr/share/dict/polish
	installdeb-wordlist -p$(words-package)

.DEFAULT_GOAL := binary