File: blends.mk

package info (click to toggle)
debian-design 3.0.28
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 96 kB
  • sloc: makefile: 106; sh: 14
file content (104 lines) | stat: -rw-r--r-- 3,849 bytes parent folder | download | duplicates (2)
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
#!/usr/bin/make -f
# -*- mode: makefile; coding: utf-8 -*-
# Copyright © 2014, 2018  Jonas Smedegaard <dr@jones.dk>
# Description: CDBS template to create blends
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3, or (at your option)
# any later version.
#
# This program is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

include /usr/share/cdbs/1/rules/buildcore.mk
include /usr/share/cdbs/1/rules/debhelper.mk

#pkgstem = foo
#sharedir = usr/share/$(pkgstem)-blends
#blends = mine yours

# * recent boxer needed for change of skeleton files format
CDBS_BUILD_DEPENDS +=, boxer (>= 0.004~), boxer-data

# resolve release suite
include /usr/share/dpkg/pkg-info.mk

TARGETSUITE ?= $(strip $(or \
 $(if $(filter experimental% UNRELEASED,$(DEB_DISTRIBUTION)),forky), \
 $(if $(filter stretch% oldstable%,$(DEB_DISTRIBUTION)),bookworm), \
 trixie))

_pkg-bulk = $(shell perl -0777 -n \
	-e 's/ \\\n / /' \
	-e ' and m,^d-i pkgsel/include string ([^\n]*),ms' \
	-e ' and print $$1' \
	content/$1/preseed.cfg)
pkg-desktop-bulk = $(call _pkg-bulk,desktop)
pkg-desktop-desktop = $(shell perl -n \
	-e 's,^tasksel tasksel/desktop multiselect ,, and print $$_' \
	content/desktop/preseed.cfg)
pkg-desktop-tasks = $(shell perl -n \
	-e 's,^tasksel tasksel/first multiselect ,, and print $$_' \
	content/desktop/preseed.cfg)
pkg-desktop = $(strip \
	$(pkg-desktop-desktop:%=task-%-desktop$(comma)) \
	$(pkg-desktop-tasks:%=task-%$(comma)) \
	$(patsubst %,%$(comma),$(filter-out %-,$(pkg-desktop-bulk))))
pkg-desktop-avoid = $(strip \
	$(patsubst %-,%$(comma),$(filter %-,$(pkg-desktop-bulk))))

define blend_template =
pkg-desktop-$1-bulk = $$(call _pkg-bulk,desktop/$1)
pkg-desktop-$1 = $$(strip \
	$$(filter-out $$(pkg-desktop),\
		$$(patsubst %,%$$(comma),\
			$$(filter-out %-,$$(pkg-desktop-$1-bulk)))))
pkg-desktop-$1-avoid = $$(strip \
	$$(patsubst %-,%$$(comma),\
		$$(filter-out $$(pkg-desktop-bulk),\
			$$(filter %-,$$(pkg-desktop-$1-bulk)))))
CDBS_DEPENDS_$(pkgstem)-desktop-$1 = $$(pkg-desktop-$1)
CDBS_CONFLICTS_$(pkgstem)-desktop-$1-strict = $$(pkg-desktop-$1-avoid)
endef
$(foreach blend,$(blends),$(eval $(call blend_template,$(blend))))

# TODO: merge into main only when per-blend -strict package is missing
pkg-desktop-avoid-all = $(sort $(pkg-desktop-avoid) \
	$(foreach blend,$(blends),$(pkg-desktop-$(blend)-avoid)))
CDBS_DEPENDS_$(pkgstem)-desktop = $(pkg-desktop)
CDBS_CONFLICTS_$(pkgstem)-desktop-strict = $(pkg-desktop-avoid-all)

build/$(pkgstem)-desktop:: content/desktop/preseed.cfg $(pkgstem)-desktop-tidy

content/desktop/preseed.cfg:
	$(MAKE) suite=$(TARGETSUITE)

# check extracted packages and extract tidying script
CDBS_BUILD_DEPENDS +=, shellcheck
$(pkgstem)-desktop-tidy: content/desktop/preseed.cfg
	# check that all package lists are populated
	test -n "$(pkg-desktop)"
	set -e; $(foreach blend,$(blends),test -n "$(pkg-desktop-$(blend))"; )
	perl -0777 -n \
		-e 's,.*d-i preseed/late_command string ,#!/bin/sh\n,ms' \
		-e ' and print $$_' \
		$< > $@
	shellcheck -e SC1003 -e SC2016 -e SC2034 -e SC2046 -e SC2048 -e SC2086 -e SC2129 $@

binary-predeb/$(pkgstem)-data::
	find debian/$(pkgstem)-data/$(sharedir)/data \
		-name script.sh \
		-exec chmod +x {} +

DEB_DH_INSTALL_ARGS_$(pkgstem)-data = content/* $(sharedir)/data
DEB_DH_INSTALL_ARGS_$(pkgstem)-desktop = $(pkgstem)-desktop-tidy usr/sbin

clean::
	$(MAKE) clean
	rm -f $(pkgstem)-desktop-tidy