File: rules

package info (click to toggle)
swupdate 2025.12%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 10,004 kB
  • sloc: ansic: 66,621; python: 6,291; makefile: 791; sh: 538; javascript: 229
file content (117 lines) | stat: -rwxr-xr-x 4,411 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
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/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 LIBDIR=usr/lib/${DEB_HOST_MULTIARCH}
export HAVE_LUA=n
ifeq (,$(filter nolua,$(DEB_BUILD_PROFILES)))
export LUA_VERSION=5.4
export LUA_MODNAME=lua_swupdate
export PKG_NAME=swupdate
export HAVE_LUA=y
endif

override_dh_auto_configure-arch:
	cp debian/configs/defconfig  configs/debian_defconfig
ifeq (linux,$(DEB_HOST_ARCH_OS))
	echo CONFIG_BTRFS_FILESYSTEM=y     >> configs/debian_defconfig
	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
ifneq (,$(findstring $(DEB_HOST_ARCH),amd64 i386 arm64 armhf loong64 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 (,$(LUA_VERSION))
	echo CONFIG_LUAPKG=\"lua$(LUA_VERSION)\" >> configs/debian_defconfig
	echo CONFIG_LUASCRIPTHANDLER=y           >> configs/debian_defconfig
	echo CONFIG_SURICATTA_LUA=y              >> configs/debian_defconfig
	echo CONFIG_SURICATTA_WFX=y              >> configs/debian_defconfig
	echo CONFIG_EMBEDDED_SURICATTA_LUA=y     >> configs/debian_defconfig
	echo CONFIG_EMBEDDED_SURICATTA_LUA_SOURCE=\"suricatta/server_wfx.lua\" >> configs/debian_defconfig
endif
	echo CONFIG_DELTA=y                                >> configs/debian_defconfig
	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-indep:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	$(MAKE) latexpdf
endif
	# Build web-app without gulp
	cd web-app && pkgjs-install-minimal
	sassc -Iweb-app web-app/scss/bootstrap.scss > web-app/css/bootstrap.css
	cp web-app/index.html index.html
	# replace rule from gulp's minify-html
	sed -i 's|node_modules/bootstrap/dist/css|css|' index.html
	# replace upstream bootstrap location with Debian's
	sed -i 's|node_modules/bootstrap/dist/js|node_modules/bootstrap/js|' index.html

override_dh_auto_build-arch:
ifeq (,$(filter nodoc,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
	$(MAKE) man
	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

override_dh_auto_test-arch:
ifeq (,$(filter nocheck,$(DEB_BUILD_OPTIONS) $(DEB_BUILD_PROFILES)))
ifeq (,$(filter armhf armel,$(DEB_HOST_ARCH)))
	dh_auto_test -- V=1
else
	# test_flash_handler/mtd-utils has issues on arm 32 bit, so ignore test failures
	-dh_auto_test -- V=1
endif
endif

override_dh_auto_install-arch:
	dh_auto_install -- V=1

override_dh_auto_test-indep:
override_dh_auto_install-indep:

# Can be dropped in compat level 14
execute_after_dh_installinit:
	dh_installsysusers

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

ifeq (linux,$(DEB_HOST_ARCH_OS))
override_dh_gencontrol-arch:
	dh_gencontrol -- -VBuilt-Using="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W libmtd-dev libubi-dev)"
endif

override_dh_gencontrol-indep:
	# Bootstrap's scss file is derived from
	dh_gencontrol -- -VB-U-www="$(shell dpkg-query -f '$${source:Package} (= $${source:Version}), ' -W node-bootstrap)"

override_dh_dwz:
	dh_dwz --no-dwz-multifile

%:
	dh $@