Debian Codegraph @

debian/blends.mk

raw symbols SCIP
1 #!/usr/bin/make -f
2 # -*- mode: makefile; coding: utf-8 -*-
3 # Copyright © 2014, 2018 Jonas Smedegaard <[email protected]>
4 # Description: CDBS template to create blends
5 #
6 # This program is free software; you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation; either version 3, or (at your option)
9 # any later version.
10 #
11 # This program is distributed in the hope that it will be useful, but
12 # WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 # General Public License for more details.
15 #
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18
19 include debian/buildcore.mk
20 include debian/debhelper.mk
21
22 #pkgstem = foo
23 #sharedir = usr/share/$(pkgstem)-blends
24 #blends = mine yours
25
26 # * recent boxer needed for change of skeleton files format
27 CDBS_BUILD_DEPENDS +=, boxer (>= 0.004~), boxer-data
28
29 # resolve release suite
30 include /usr/share/dpkg/pkg-info.mk
31
32 TARGETSUITE ?= $(strip $(or \
33 $(if $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION)),forky), \
34 $(if $(filter stretch% oldstable%,$(DEB_DISTRIBUTION)),bookworm), \
35 trixie))
36
37 _pkg-bulk = $(shell perl -0777 -n \
38 -e 's/ \\\n / /' \
39 -e ' and m,^d-i pkgsel/include string ([^\n]*),ms' \
40 -e ' and print $$1' \
41 content/$1/preseed.cfg)
42 pkg-desktop-bulk = $(call _pkg-bulk,desktop)
43 pkg-desktop-desktop = $(shell perl -n \
44 -e 's,^tasksel tasksel/desktop multiselect ,, and print $$_' \
45 content/desktop/preseed.cfg)
46 pkg-desktop-tasks = $(shell perl -n \
47 -e 's,^tasksel tasksel/first multiselect ,, and print $$_' \
48 content/desktop/preseed.cfg)
49 pkg-desktop = $(strip \
50 $(pkg-desktop-desktop:%=task-%-desktop$(comma)) \
51 $(pkg-desktop-tasks:%=task-%$(comma)) \
52 $(patsubst %,%$(comma),$(filter-out %-,$(pkg-desktop-bulk))))
53 pkg-desktop-avoid = $(strip \
54 $(patsubst %-,%$(comma),$(filter %-,$(pkg-desktop-bulk))))
55
56 define blend_template =
57 pkg-desktop-$1-bulk = $$(call _pkg-bulk,desktop/$1)
58 pkg-desktop-$1 = $$(strip \
59 $$(filter-out $$(pkg-desktop),\
60 $$(patsubst %,%$$(comma),\
61 $$(filter-out %-,$$(pkg-desktop-$1-bulk)))))
62 pkg-desktop-$1-avoid = $$(strip \
63 $$(patsubst %-,%$$(comma),\
64 $$(filter-out $$(pkg-desktop-bulk),\
65 $$(filter %-,$$(pkg-desktop-$1-bulk)))))
66 CDBS_DEPENDS_$(pkgstem)-desktop-$1 = $$(pkg-desktop-$1)
67 CDBS_CONFLICTS_$(pkgstem)-desktop-$1-strict = $$(pkg-desktop-$1-avoid)
68 endef
69 $(foreach blend,$(blends),$(eval $(call blend_template,$(blend))))
70
71 # TODO: merge into main only when per-blend -strict package is missing
72 pkg-desktop-avoid-all = $(sort $(pkg-desktop-avoid) \
73 $(foreach blend,$(blends),$(pkg-desktop-$(blend)-avoid)))
74 CDBS_DEPENDS_$(pkgstem)-desktop = $(pkg-desktop)
75 CDBS_CONFLICTS_$(pkgstem)-desktop-strict = $(pkg-desktop-avoid-all)
76
77 build/$(pkgstem)-desktop:: content/desktop/preseed.cfg $(pkgstem)-desktop-tidy
78
79 content/desktop/preseed.cfg:
80 $(MAKE) suite=$(TARGETSUITE)
81
82 # check extracted packages and extract tidying script
83 CDBS_BUILD_DEPENDS +=, shellcheck
84 $(pkgstem)-desktop-tidy: content/desktop/preseed.cfg
85 # check that all package lists are populated
86 test -n "$(pkg-desktop)"
87 set -e; $(foreach blend,$(blends),test -n "$(pkg-desktop-$(blend))"; )
88 perl -0777 -n \
89 -e 's,.*d-i preseed/late_command string ,#!/bin/sh\n,ms' \
90 -e ' and print $$_' \
91 $< > $@
92 shellcheck -e SC1003 -e SC2016 -e SC2034 -e SC2046 -e SC2048 -e SC2086 -e SC2129 $@
93
94 binary-predeb/$(pkgstem)-data::
95 find debian/$(pkgstem)-data/$(sharedir)/data \
96 -name script.sh \
97 -exec chmod +x {} +
98
99 DEB_DH_INSTALL_ARGS_$(pkgstem)-data = content/* $(sharedir)/data
100 DEB_DH_INSTALL_ARGS_$(pkgstem)-desktop = $(pkgstem)-desktop-tidy usr/sbin
101
102 clean::
103 $(MAKE) clean
104 rm -f $(pkgstem)-desktop-tidy