rules 10.5 KB
Newer Older
Tollef Fog Heen's avatar
Tollef Fog Heen committed
1
2
#! /usr/bin/make -f

3
#export DH_VERBOSE=1
Tollef Fog Heen's avatar
Tollef Fog Heen committed
4
#export DEB_BUILD_OPTIONS="nostrip"
Tollef Fog Heen's avatar
Tollef Fog Heen committed
5

6
7
DEB_HOST_MULTIARCH ?= $(shell dpkg-architecture -qDEB_HOST_MULTIARCH)

8
9
10
11
ifneq (,$(findstring stage1,$(DEB_BUILD_PROFILES)))
BOOTSTRAP_DH_FLAGS := -Ngir1.2-gudev-1.0 -Nlibgudev-1.0-0 -Nlibgudev-1.0-dev
endif

Michael Biebl's avatar
Michael Biebl committed
12
13
14
CONFFLAGS = \
	--with-rootprefix= \
	--with-rootlibdir=/lib/$(DEB_HOST_MULTIARCH) \
15
	--with-zshcompletiondir=/usr/share/zsh/vendor-completions \
Michael Biebl's avatar
Michael Biebl committed
16
17
18
	--with-sysvinit-path=/etc/init.d \
	--with-sysvrcnd-path=/etc \
	--with-firmware-path=/lib/firmware \
Michael Biebl's avatar
Michael Biebl committed
19
	--with-debug-shell=/bin/bash \
20
	--with-telinit=/lib/sysvinit/telinit \
Michael Biebl's avatar
Michael Biebl committed
21
22
23
	--disable-coredump \
	--disable-efi \
	--disable-myhostname \
24
	--disable-vconsole \
Sjoerd Simons's avatar
Sjoerd Simons committed
25
	--disable-microhttpd \
26
	--disable-sysusers \
27
28
29
30
31
	--disable-silent-rules \
	--with-ntp-servers="0.debian.pool.ntp.org 1.debian.pool.ntp.org 2.debian.pool.ntp.org 3.debian.pool.ntp.org"  \
	--with-system-uid-max=999 \
	--with-system-gid-max=999

32
33
34
ifeq (,$(findstring stage1,$(DEB_BUILD_PROFILES)))
CONFFLAGS += --enable-libcryptsetup
endif
Michael Biebl's avatar
Michael Biebl committed
35
36
37
38

CONFFLAGS_deb = \
	--enable-selinux \
	--enable-introspection \
39
	--enable-gtk-doc \
40
	--enable-compat-libs \
41
42
	PYTHON=python3 \
	$(NULL)
Michael Biebl's avatar
Michael Biebl committed
43
44

CONFFLAGS_udeb = \
Michael Biebl's avatar
Michael Biebl committed
45
46
47
	--disable-libcryptsetup \
	--disable-pam \
	--disable-audit \
Michael Biebl's avatar
Michael Biebl committed
48
	--disable-selinux \
49
50
	--disable-smack \
	--disable-ima \
Michael Biebl's avatar
Michael Biebl committed
51
52
53
54
55
56
	--disable-introspection \
	--disable-gtk-doc \
	--disable-binfmt \
	--disable-readahead \
	--disable-bootchart \
	--disable-quotacheck \
57
	--disable-tmpfiles \
Michael Biebl's avatar
Michael Biebl committed
58
	--disable-randomseed \
59
	--disable-backlight \
Michael Biebl's avatar
Michael Biebl committed
60
	--disable-logind \
61
	--disable-machined \
Michael Biebl's avatar
Michael Biebl committed
62
63
	--disable-hostnamed \
	--disable-timedated \
64
65
	--disable-networkd \
	--disable-timesyncd \
Michael Biebl's avatar
Michael Biebl committed
66
	--disable-localed \
67
	--disable-resolved \
Michael Biebl's avatar
Michael Biebl committed
68
69
	--disable-polkit \
	--disable-acl \
Michael Biebl's avatar
Michael Biebl committed
70
	--disable-gcrypt \
Michael Biebl's avatar
Michael Biebl committed
71
	--disable-gudev \
72
	--disable-rfkill \
Michael Biebl's avatar
Michael Biebl committed
73
	--disable-multi-seat-x \
Michael Biebl's avatar
Michael Biebl committed
74
75
76
	--disable-manpages \
	--without-python

77
override_dh_auto_configure:
Michael Biebl's avatar
Michael Biebl committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
	dh_auto_configure --builddirectory=build-deb \
		-- $(CONFFLAGS) $(CONFFLAGS_deb)
	dh_auto_configure --builddirectory=build-udeb \
		-- $(CONFFLAGS) $(CONFFLAGS_udeb)

override_dh_auto_build:
	dh_auto_build --builddirectory=build-deb
	dh_auto_build --builddirectory=build-udeb

override_dh_auto_install:
	dh_auto_install --builddirectory=build-deb \
		--destdir=debian/install/deb
	dh_auto_install --builddirectory=build-udeb \
		--destdir=debian/install/udeb
92

93
override_dh_auto_clean:
Michael Biebl's avatar
Michael Biebl committed
94
95
96
97
98
	dh_auto_clean --builddirectory=build-deb
	dh_auto_clean --builddirectory=build-udeb
	rm -rf debian/install/
	# remove pre-generated man pages so they are rebuilt
	rm -f man/*.[13578]
99
100
101
102
103
104
	# remove pre-generated rules and unit files so they are rebuilt
	rm -f rules/99-systemd.rules \
		units/emergency.service \
		units/systemd-udevd.service \
		units/systemd-udev-settle.service \
		units/systemd-udev-trigger.service
105
106
	# remove Python byte code files
	rm -f *.pyc
107

108
override_dh_install:
Michael Biebl's avatar
Michael Biebl committed
109
	# remove unnecessary / unused files
Michael Biebl's avatar
Michael Biebl committed
110
111
112
	rm -f debian/install/*/usr/share/doc/systemd/LICENSE.*
	rm -f debian/install/*/var/log/README
	rm -f debian/install/*/etc/init.d/README
113
	rm -f debian/install/*/usr/share/man/man8/kernel-install.8
114
	rm -f debian/install/*/usr/bin/kernel-install
115
	rm -f debian/install/*/usr/share/zsh/vendor-completions/_kernel-install
116
	rm -f debian/install/*/usr/share/bash-completion/completions/kernel-install
117
	rm -rf debian/install/*/usr/lib/kernel/install.d
Michael Biebl's avatar
Michael Biebl committed
118
	rm -rf debian/install/*/etc/rpm/
119
	rm -rf debian/install/*/usr/lib/rpm/
Michael Biebl's avatar
Michael Biebl committed
120
	rm -rf debian/install/*/etc/kernel/
121
	rm -f debian/install/*/usr/lib/sysctl.d/50-default.conf
Michael Biebl's avatar
Michael Biebl committed
122
	find debian/install/ -name '*.la' -delete
123
	# remove files related to factory-reset feature
124
	find debian/install/ \( -name 'systemd-update-done*' -o \
125
126
		-name systemd-journal-catalog-update.service -o \
		-name systemd-udev-hwdb-update.service -o \
127
128
		-name ldconfig.service -o \
		-name etc.conf \) -delete
129
	# remove .so for deprecated compatibility libraries
130
131
132
133
	rm -f debian/install/*/usr/lib/*/libsystemd-daemon.so
	rm -f debian/install/*/usr/lib/*/libsystemd-login.so
	rm -f debian/install/*/usr/lib/*/libsystemd-id128.so
	rm -f debian/install/*/usr/lib/*/libsystemd-journal.so
134
	# remove symlinks enabling default-on services
135
	rm -rf debian/install/*/etc/systemd/system/*.target.wants/
Michael Biebl's avatar
Michael Biebl committed
136
	dh_install -pudev-udeb -plibudev1-udeb --sourcedir=debian/install/udeb
137
	dh_install $(BOOTSTRAP_DH_FLAGS) -Nudev-udeb -Nlibudev1-udeb --sourcedir=debian/install/deb --fail-missing
138
	# install some files manually, --sourcedir makes that necessary
139
140
141
142
143
	# udev-udeb
	install -D --mode=755 debian/extra/udev.startup \
		debian/udev-udeb/lib/debian-installer/start-udev
	install -D --mode=755 debian/extra/udev.base-installer \
		debian/udev-udeb/usr/lib/base-installer.d/05udev
144
145
	mkdir -p debian/udev-udeb/lib/udev/rules.d/
	install -D --mode=644 \
146
		debian/extra/rules/73-idrac.rules \
147
148
149
150
151
152
153
154
155
156
		debian/extra/rules/75-persistent-net-generator.rules \
		debian/udev-udeb/lib/udev/rules.d/
	mkdir -p debian/udev-udeb/lib/udev
	install -D --mode=644 \
		debian/extra/hotplug.functions \
		debian/extra/rule_generator.functions \
		debian/udev-udeb/lib/udev/
	install -D --mode=755 \
		debian/extra/write_net_rules \
		debian/udev-udeb/lib/udev/
157
158
159
160
161
162
163
164
	# udev: initramfs-tools support
	install -D --mode=755 debian/extra/initramfs.hook \
		debian/udev/usr/share/initramfs-tools/hooks/udev
	install -D --mode=755 debian/extra/initramfs.top \
		debian/udev/usr/share/initramfs-tools/scripts/init-top/udev
	install -D --mode=755 debian/extra/initramfs.bottom \
		debian/udev/usr/share/initramfs-tools/scripts/init-bottom/udev
	# udev: debian specific rules and helpers
165
166
167
168
169
170
171
172
173
174
175
176
	install -D --mode=644 debian/extra/rules/* \
		debian/udev/lib/udev/rules.d/
	install -D --mode=644 debian/extra/fbdev-blacklist.conf \
		debian/udev/etc/modprobe.d/fbdev-blacklist.conf
	install -D --mode=644 \
		debian/extra/hotplug.functions \
		debian/extra/rule_generator.functions \
		debian/udev/lib/udev/
	install -D --mode=755 \
		debian/extra/dsl-modem.agent \
		debian/extra/logger.agent \
		debian/extra/net.agent \
177
		debian/extra/udev-finish \
178
179
		debian/extra/write_net_rules \
		debian/udev/lib/udev/
180
181
182
183
184
185
	# systemd
	cp -a debian/pam-configs debian/libpam-systemd/usr/share/
	install -D --mode=644 debian/init-functions.d/40-systemd \
		debian/systemd/lib/lsb/init-functions.d/40-systemd
	install --mode=644 debian/tmpfiles.d/debian.conf \
		debian/systemd/usr/lib/tmpfiles.d/
186
	install --mode=644 debian/debian-fixup.service debian/ifup@.service debian/extra/getty-static.service \
187
		debian/systemd/lib/systemd/system/
188
189
	install -D --mode=644 debian/extra/network-pre.conf \
		debian/systemd/lib/systemd/system/networking.service.d/network-pre.conf
190
191
192
	install --mode=644 debian/extra/udev-finish.service \
		debian/udev/lib/systemd/system/
	ln -s ../udev-finish.service debian/udev/lib/systemd/system/sysinit.target.wants/
193
	install --mode=755 debian/debian-fixup \
194
		debian/systemd/lib/systemd/
195
196
197
198
199
200
201
	# Make sure the runlevel services are known by systemd so their targets
	# get launches. See https://bugzilla.redhat.com/show_bug.cgi?id=1002806
	for t in poweroff rescue multi-user graphical reboot; do \
		mkdir -p debian/systemd/lib/systemd/system/$${t}.target.wants;\
		ln -s ../systemd-update-utmp-runlevel.service \
			debian/systemd/lib/systemd/system/$${t}.target.wants ;\
	done
202
203
204
205
206
	# man files for example code in /usr/share/doc
	mkdir -p debian/systemd/usr/share/man/man3/
	mv debian/libsystemd-dev/usr/share/man/man3/sd-readahead.3 \
		debian/libsystemd-dev/usr/share/man/man3/sd_readahead.3 \
		debian/systemd/usr/share/man/man3/
207
208
	install --mode=755 debian/systemd-logind-launch \
		debian/systemd/lib/systemd/
Michael Biebl's avatar
Michael Biebl committed
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
	# remove duplicates
	# files shipped by systemd-sysv / sysvinit
	rm debian/systemd/usr/share/man/man1/init.1
	rm debian/systemd/usr/share/man/man8/halt.8
	rm debian/systemd/usr/share/man/man8/poweroff.8
	rm debian/systemd/usr/share/man/man8/reboot.8
	rm debian/systemd/usr/share/man/man8/shutdown.8
	rm debian/systemd/usr/share/man/man8/telinit.8
	rm debian/systemd/usr/share/man/man8/runlevel.8
	# files shipped by libpam-systemd
	rm debian/systemd/usr/share/man/man8/pam_systemd.8
	# files shipped by udev
	rm -r debian/systemd/etc/udev/
	rm debian/systemd/lib/systemd/system/systemd-udev*
	rm debian/systemd/lib/systemd/system/*.target.wants/systemd-udev*
	rm debian/systemd/lib/systemd/systemd-udevd
	rm debian/systemd/usr/share/man/man7/udev.7
	rm debian/systemd/usr/share/man/man8/*udev*.8
	# files shipped by udev / bash-completion
	rm debian/systemd/usr/share/bash-completion/completions/udevadm
	# files systemd by cryptsetup
230
ifeq (,$(findstring stage1,$(DEB_BUILD_PROFILES)))
Michael Biebl's avatar
Michael Biebl committed
231
	rm debian/systemd/usr/share/man/man5/crypttab.5
232
endif
Michael Biebl's avatar
Michael Biebl committed
233
234
235
236
237
	# files shipped by systemd
	rm debian/udev/lib/udev/rules.d/70-uaccess.rules
	rm debian/udev/lib/udev/rules.d/73-seat-late.rules
	rm debian/udev/lib/udev/rules.d/71-seat.rules
	rm debian/udev/lib/udev/rules.d/99-systemd.rules
238

239
240
241
# use symlinked doc directories as the old udev package did
override_dh_installdocs:
	dh_installdocs -pudev -plibudev-dev --link-doc=libudev1
242
243
	# we have to manually install udev's README for the above
	install -D --mode 644 debian/udev.README.Debian debian/libudev1/usr/share/doc/libudev1/README.Debian
244
245
246
	dh_installdocs -pgir1.2-gudev-1.0 -plibgudev-1.0-dev --link-doc=libgudev-1.0-0
	dh_installdocs --remaining-packages

247
override_dh_installinit:
248
249
	dh_installinit --no-start
	dh_installinit --name=udev-finish --no-start
250
251
252
	dh_installinit --name=udevtrigger --no-start
	dh_installinit --name=udevmonitor --no-start
	dh_installinit --name=udev-fallback-graphics --no-start
253

254
255
256
257
258
259
260
# The SysV compat tools (which are symlinks to systemctl) are
# quasi-essential, so add its dependencies to Pre-Depends
# https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=753589
override_dh_shlibdeps:
	dh_shlibdeps -psystemd -- -dPre-Depends -edebian/systemd/bin/systemctl -dDepends
	dh_shlibdeps --remaining-packages

261
262
263
264
override_dh_makeshlibs:
	dh_makeshlibs -plibudev1 --add-udeb=libudev1-udeb
	dh_makeshlibs --remaining-packages

Michael Biebl's avatar
Michael Biebl committed
265
autoreconf:
Michael Biebl's avatar
Michael Biebl committed
266
	gtkdocize --copy --docdir docs/
267
	intltoolize -f -c
Michael Biebl's avatar
Michael Biebl committed
268
269
270
271
272
	autoreconf -f -i

override_dh_autoreconf:
	dh_autoreconf debian/rules -- autoreconf

273
274
275
override_dh_strip:
	dh_strip --dbg-package=systemd-dbg

Martin Pitt's avatar
Martin Pitt committed
276
277
278
279
280
281
282
283
284
285
286
override_dh_auto_test:
ifeq (, $(findstring nocheck, $(DEB_BUILD_OPTIONS)))
	# some tests hang under fakeroot, so disable fakeroot
	echo "01234567890123456789012345678901" > build-deb/machine-id
	env -u LD_PRELOAD SYSTEMD_MACHINE_ID_PATH=$(CURDIR)/build-deb/machine-id \
		make -C build-deb check || ( \
		cd build-deb; \
		for f in test-*.log; do echo "==== $$f ===="; cat $$f; done; \
		exit 0; )  # replace with 1 to make failures fatal
endif

Tollef Fog Heen's avatar
Tollef Fog Heen committed
287
%:
288
ifeq (,$(findstring stage1,$(DEB_BUILD_PROFILES)))
289
	dh $@ --with autoreconf,gir,python3 --parallel
290
else
291
	dh $@ --with autoreconf,python3 $(BOOTSTRAP_DH_FLAGS)
292
endif