summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 5a924af28d39ea4da34eedcb5616129c2189e9e6 (plain)
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

include /usr/share/dpkg/pkg-info.mk
ARCHS=$(shell cd debian; ./getfromlist archlist)
LANGS=$(shell cd debian; ./getfromlist langlist)
DATE=$(shell echo $(DEB_VERSION) | cut -d '.' -f 1)
ifeq ($(DEB_DISTRIBUTION),unstable)
DEB_DISTRIBUTION=bookworm
endif

ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
DEB_PARALLEL_JOBS ?= $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
endif

ifneq (,$(DEB_PARALLEL_JOBS))
PARALLEL=-j$(DEB_PARALLEL_JOBS)
endif

export FORCE_SOURCE_DATE=1

# Avoid “Fontconfig error: No writable cache directories” in chroots:
export HOME=$(CURDIR)/debian/fake-home

MANTMP=$(shell pwd)/debian/manual

clean:
	dh_testdir
	dh_testroot
	dh_clean build-stamp
	rm -rf $(MANTMP) $(CURDIR)/debian/fake-home
	dh_clean doc-base-stamp
	rm -rf debian/installation-guide-*.doc-base.*
	rm -rf build/build.out* build/build.tmp* build/build.po

doc-base: doc-base-stamp
doc-base-stamp:
	@echo $(ARCHS)
	rm -f $@
	rm -rf debian/installation-guide-*.doc-base.*
	set -e; cd debian && \
	    for arch in $(ARCHS); do \
		for lang in $(LANGS); do \
		    arch_full="$$(grep "^$$arch[[:space:]]" archlist | cut -f 2)"; \
		    lang_full="$$(grep "^$$lang[[:space:]]" langlist | cut -f 2)"; \
		    lang_id="$$(echo $$lang | tr A-Z a-z | sed "s/_/-/")"; \
		    sed -e "s:%ARCH%:$$arch:g" -e "s:%ARCH_FULL%:$$arch_full:g" \
			-e "s:%LANG%:$$lang:g" -e "s:%LANG_FULL%:$$lang_full:g" \
			-e "s:%LANG_ID%:$$lang_id:g" \
			TEMPLATE.doc-base >installation-guide-$$arch.doc-base.$$lang; \
		    if [ ! -e manual/$$arch/$$lang/install.$$lang.pdf ]; then \
			    sed -i "/Format: pdf/,/^$$/d" installation-guide-$$arch.doc-base.$$lang; \
		    fi; \
		done; \
	    done
	touch $@

build: build-arch build-indep

build-arch:

build-indep: build-stamp
build-stamp:
	rm -f $@
	-rm -rf $(MANTMP)
	set -e && cd build && \
		MAKEFLAGS="$(PARALLEL)" \
		official_build=1 manual_release=$(DEB_DISTRIBUTION) \
		architectures="$(ARCHS)" languages="$(LANGS)" \
		destination=$(MANTMP)/'$${arch}' noarchdir=1 \
		./build.sh
	touch $@

install: build
	dh_testdir
	dh_testroot
	dh_prep
	dh_installdirs
	
binary-arch:

binary-indep: install doc-base
	dh_testdir
	dh_testroot
	dh_installchangelogs
	for arch in $(ARCHS) ; do \
		dh_installdocs -p installation-guide-$$arch $(MANTMP)/$$arch/* ; \
	done
	dh_compress
	dh_fixperms
	dh_installdeb
	dh_gencontrol
	dh_md5sums
	dh_builddeb

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