summaryrefslogtreecommitdiff
path: root/debian/rules
blob: 35c638cf2f71de8fc5c26bd4dc8fca467c5d7e8d (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
97
98
99
100
101
102
103
#!/usr/bin/make -f

ARCHS=$(shell cd debian; ./getfromlist archlist)
LANGS=$(shell cd debian; ./getfromlist langlist)
VERSION=$(shell LC_ALL=C dpkg-parsechangelog | grep ^Version: | cut -d ' ' -f 2)
DATE=$(shell echo $(VERSION) | cut -d '.' -f 1)
SUITE=$(shell LC_ALL=C dpkg-parsechangelog | grep ^Distribution: | cut -d ' ' -f 2)
ifeq (${SUITE},unstable)
SUITE=buster
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


MANTMP=$(shell pwd)/debian/manual

clean:
	dh_testdir
	dh_testroot
	dh_clean build-stamp
	rm -rf $(MANTMP)
	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=$(SUITE) \
		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

	# Create a tarball for each arch for use in debian-cd
	# Note: these should be uploaded manually
	#set -e && cd $(MANTMP) && \
	#    for arch in $(ARCHS) ; do \
	#	tarname=di-manual-$${arch}_$(VERSION).tar.gz ; \
	#	cd $$arch ; \
	#	tar czf ../../../../$$tarname . ; \
	#	cd .. ; \
	#    done

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