File: rules

package info (click to toggle)
swupdate 2022.12%2Bdfsg-4%2Bdeb12u1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 8,904 kB
  • sloc: ansic: 54,399; perl: 6,317; cpp: 1,829; makefile: 989; sh: 704; yacc: 613; lex: 373; python: 285; javascript: 238
file content (111 lines) | stat: -rwxr-xr-x 3,976 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
#!/usr/bin/make -f
include /usr/share/dpkg/architecture.mk

ifneq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
export CROSS_COMPILE ?= $(DEB_HOST_GNU_TYPE)-
endif

export DEB_BUILD_MAINT_OPTIONS = hardening=+all
export DEB_CFLAGS_MAINT_APPEND  = -Wall -pedantic -I/usr/include/p11-kit-1
export LIBDIR=usr/lib/${DEB_HOST_MULTIARCH}
export HAVE_LUA=n
ifeq (,$(filter nolua,$(DEB_BUILD_PROFILES)))
export LUA_VERSION=5.3
export LUA_MODNAME=lua_swupdate
export PKG_NAME=swupdate
export DH_WITH=,lua
export HAVE_LUA=y
endif

BU_SWU=
ifeq (linux,$(DEB_HOST_ARCH_OS))
	BU_SWU += -VBuilt-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libmtd-dev libubi-dev)"
endif
ifeq (,$(filter pkg.swupdate.bpo,$(DEB_BUILD_PROFILES)))
	# Bootstrap's scss file is derived from
	BU_SWU += -VB-U-www="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libjs-bootstrap4)"
endif

override_dh_auto_configure:
	cp debian/configs/defconfig  configs/debian_defconfig
ifeq (linux,$(DEB_HOST_ARCH_OS))
	echo CONFIG_UBOOT=y                >> configs/debian_defconfig
	echo CONFIG_UCFWHANDLER=y          >> configs/debian_defconfig
	echo CONFIG_CFI=y                  >> configs/debian_defconfig
	echo CONFIG_CFIHAMMING1=y          >> configs/debian_defconfig
	echo CONFIG_UBIVOL=y               >> configs/debian_defconfig
	echo CONFIG_SSBLSWITCH=y           >> configs/debian_defconfig
else
	echo "# CONFIG_MTD is not set"     >> configs/debian_defconfig
endif
ifeq (,$(filter pkg.swupdate.bpo,$(DEB_BUILD_PROFILES)))
	echo CONFIG_DELTA=y >> configs/debian_defconfig
endif
ifneq (,$(findstring $(DEB_HOST_ARCH),amd64 i386 arm64 armhf riscv64 ia64))
	echo CONFIG_BOOTLOADER_EBG=y                    >> configs/debian_defconfig
endif
ifeq (,$(filter pkg.swupdate.nohwcompat,$(DEB_BUILD_PROFILES)))
	echo CONFIG_HW_COMPATIBILITY=y                   >> configs/debian_defconfig
endif
ifeq (,$(filter pkg.swupdate.nosigning,$(DEB_BUILD_PROFILES)))
	echo CONFIG_SIGNED_IMAGES=y >> configs/debian_defconfig
endif
ifeq (,$(filter pkg.swupdate.noswuforwarder,$(DEB_BUILD_PROFILES)))
	echo CONFIG_SWUFORWARDER_HANDLER=y       >> configs/debian_defconfig
endif
ifneq (,$(filter pkg.swupdate.p11,$(DEB_BUILD_PROFILES)))
	echo CONFIG_PKCS11=y >> configs/debian_defconfig
endif
ifneq (,$(LUA_VERSION))
	echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig
	echo CONFIG_LUASCRIPTHANDLER=y           >> configs/debian_defconfig
	echo CONFIG_HANDLER_IN_LUA=y             >> configs/debian_defconfig
endif
	echo CONFIG_EXTRA_CFLAGS=\"$(CFLAGS) $(CPPFLAGS)\" >> configs/debian_defconfig
	echo CONFIG_EXTRA_LDFLAGS=\"$(LDFLAGS)\"           >> configs/debian_defconfig
	echo CONFIG_EXTRA_LDLIBS=\"$(LDLIBS)\"             >> configs/debian_defconfig
	$(MAKE) debian_defconfig

override_dh_auto_build:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	$(MAKE) man latexpdf
	mv doc/build/man/client.1 doc/build/man/swupdate-client.1
	mv doc/build/man/ipc.1 doc/build/man/swupdate-ipc.1
	mv doc/build/man/progress.1 doc/build/man/swupdate-progress.1
endif
	dh_auto_build -- V=1

	# Build web-app without gulp
	cd web-app && pkgjs-install-minimal
ifeq (,$(filter pkg.swupdate.bpo,$(DEB_BUILD_PROFILES)))
	sassc -Iweb-app web-app/scss/bootstrap.scss > web-app/css/bootstrap.css
	# replace rule from gulp's minify-html
	sed -i 's|node_modules/bootstrap/dist/css|css|' web-app/index.html
endif

override_dh_auto_test:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
ifeq (,$(findstring mips,$(DEB_HOST_ARCH)))
	dh_auto_test -- V=1
endif
endif

override_dh_auto_install:
	dh_auto_install -- V=1

override_dh_installsystemd:
	dh_installsystemd --no-start
	dh_installsystemd --name=swupdate-progress
	dh_installsystemd --no-start --name=swupdate-usb@

override_dh_gencontrol:
	dh_gencontrol -- $(BU_SWU)

override_dh_dwz:
	dh_dwz --no-dwz-multifile

override_dh_missing:
	dh_missing --fail-missing

%:
	dh $@ --with sysuser$(DH_WITH)