File: rules

package info (click to toggle)
calligra-l10n 1%3A2.9.11-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 110,096 kB
  • sloc: xml: 471; makefile: 74; sh: 47
file content (114 lines) | stat: -rwxr-xr-x 3,950 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
#!/usr/bin/make -f

# Uncomment this to turn on verbose mode.
#export DH_VERBOSE=1
ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    NUMJOBS = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
    MAKEFLAGS += -j$(NUMJOBS)
endif

# Value of the calligra:{Depends,Recommends,Suggests,Replaces,Breaks,Provides}
# substvars. Common relationships for each l10n package.
L10N_Depends := calligra-libs (>= 1:2.9.11)
L10N_Recommends :=
L10N_Suggests := calligra
L10N_Replaces :=
L10N_Breaks :=
L10N_Provides := calligra-l10n

L10N_PREFIX := calligra-l10n
#L10N_VERSION := $(shell cat debian/changelog | head -n1 | sed 's/.*(\([[:digit:]]\+:\)\?\(.\+\)-.\+).*/\2/')
L10N_LANGS := $(filter-out debian,$(subst ./,,$(shell find . -mindepth 1 -maxdepth 1 -type d ! -name .pc ! -name .git ! -name .hg)))
L10N_DIRS = $(L10N_LANGS)
L10N_PACKAGES := $(patsubst %,$(L10N_PREFIX)-%,$(L10N_LANGS))

# Support variables to be used in targets
cur_lang = $(word 2,$(subst __, ,$@))
cur_lang_dir = $(cur_lang)
cur_lang_builddir = $(cur_lang_dir)/build
cur_pkg = $(L10N_PREFIX)-$(cur_lang)

# Stamps
STAMP_BUILD := $(patsubst %,debian/stamp__%__build,$(L10N_LANGS))
L10N_INSTALL := $(patsubst %,install__%,$(L10N_LANGS))
L10N_CLEAN := $(patsubst %,clean__%,$(L10N_LANGS))

# debian/control checks
L10N_PACKAGES_IN_CONTROL := $(shell dh_listpackages | grep '$(L10N_PREFIX)')
L10N_NOTEXIST_IN_CONTROL := $(filter-out $(L10N_PACKAGES_IN_CONTROL),$(L10N_PACKAGES))
L10N_EXCESS_IN_CONTROL := $(filter-out $(L10N_PACKAGES),$(L10N_PACKAGES_IN_CONTROL))

check_control:
	@test -z "$(L10N_NOTEXIST_IN_CONTROL)" || \
		(echo "-- ERROR: debian/control is missing language packages: $(L10N_NOTEXIST_IN_CONTROL)" && false)
	@test -z "$(L10N_EXCESS_IN_CONTROL)" || \
		(echo "-- ERROR: debian/control has excess language packages: $(L10N_EXCESS_IN_CONTROL)" && false)

prepare_build: check_control
	dh_testdir

build: build-arch build-indep
build-arch: build-stamp
# no indep files, only arch: all
build-indep:
build-stamp: $(STAMP_BUILD)

build_progress = [$(shell ls -1 -d debian/stamp__*__build debian | wc -l)/$(words $(STAMP_BUILD))]
$(STAMP_BUILD): | prepare_build
	# $(build_progress) Building '$(cur_lang)' language ...
	dh_auto_configure -Scmake -D$(cur_lang) -B$(cur_lang_builddir) -- -DCMAKE_BUILD_TYPE=Debian
	$(MAKE) -C $(cur_lang_builddir)
	# $(build_progress) Built '$(cur_lang)' language.
	touch $@

prepare_install:
	dh_testdir
	dh_testroot
	dh_prep

install: $(L10N_INSTALL)
	# Installed successfully

$(L10N_INSTALL): | prepare_install
	# Installing '$(cur_lang)' to the '$(cur_pkg)' package
	dh_auto_install -Scmake -D$(cur_lang) -B$(cur_lang_builddir) --destdir=$(CURDIR)/debian/$(cur_pkg)
	# The new KF5 package have their own translations now, remove files listed in excluded_files.list
	sed -e '/^$$/d;/^#/d' $(CURDIR)/debian/excluded_files.list | while read excluded_file; do \
	    find $(CURDIR)/debian/$(cur_pkg) -name $${excluded_file} -delete ; \
	done
	# Drop *.appdata.mo translations, since they are only helper for
	# translating appdata files
	find $(CURDIR)/debian/$(cur_pkg) -name '*.appdata.mo' -delete

prepare_clean:
	dh_testdir

clean: $(L10N_CLEAN)
	dh_clean

# Delete build directories
$(L10N_CLEAN): prepare_clean
	rm -rf $(cur_lang_builddir) debian/stamp__$(cur_lang)__*

binary-arch:
	# No architecture dependent files available

binary-indep: build install
	dh_testroot
	dh_testdir
	dh_installdocs
	dh_installchangelogs
	dh_compress -X.docbook -X.css -X-license -X.dcl -X.bz2
	dh_link
	dh_fixperms
	dh_installdeb
	dh_gencontrol -- $(foreach rel,Depends Recommends Suggests Replaces Breaks Provides,-V'calligra:$(rel)=$(L10N_$(rel))')
	dh_md5sums
	dh_builddeb -- -Zxz

# Below here is fairly generic really
binary: binary-indep binary-arch

.PHONY: binary binary-arch binary-indep build build-arch build-indep
.PHONY: clean install patch
.PHONY: check_control prepare_build prepare_install $(L10N_INSTALL) $(L10N_CLEAN)