File: rules

package info (click to toggle)
ipolish 20161007-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 23,748 kB
  • ctags: 16
  • sloc: makefile: 58; sh: 7
file content (96 lines) | stat: -rwxr-xr-x 3,266 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
#!/usr/bin/make -f

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

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

%: force
	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 and needed for myspell-pl
	$(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
	
	## myspell-pl
	# build myspell-pl aff file
	ispellaff2myspell --myheader debian/sources/myspell.header \
	                  --charset=latin2 \
	                  $(SOURCE_DIR)/polish.aff > $(TMP_BUILD_DIR)/pl.aff
	
	# build myspell-pl dic file
	cat $(TMP_BUILD_DIR)/polish.mwl | wc -l > $(TMP_BUILD_DIR)/pl.dic
	cat $(TMP_BUILD_DIR)/polish.mwl >> $(TMP_BUILD_DIR)/pl.dic
	
	## 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)
	
	## myspell-pl
	installdeb-myspell  -p$(myspell-package) --srcdir=$(TMP_BUILD_DIR)
	installdeb-hunspell -p$(myspell-package)

.PHONY: force debian/rules override_dh_auto_build override_dh_auto_install override_dh_auto_clean
.DEFAULT_GOAL := binary