summaryrefslogtreecommitdiff
path: root/debian/rules
blob: e40020537c1d948086ffb3ccf684e5efc972a722 (plain)
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
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
#!/usr/bin/make -f
# Copyright © 2002,2003 Colin Walters <walters@verbum.org>
# Copyright © 2003 Daniel Stone <daniels@debian.org>
# Copyright © 2006 Sjoerd Simons <sjoerd@debian.org>
# Copyright © 2011 Michael Biebl <biebl@debian.org>

include /usr/share/dpkg/default.mk

%:
	dh $@ $(dh_options)

libdbusN := $(shell sed -rn 's/Package:[[:space:]]*(libdbus-[0-9-]+)[[:space:]]*$$/\1/p' debian/control | head -n 1)
libdbus_soname := $(patsubst libdbus-1-%,libdbus-1.so.%,$(libdbusN))

LDFLAGS += -Wl,--as-needed

dh_options = \
	--builddirectory=build \
	--with autoreconf \
	--parallel \
	$(NULL)

common_configure_flags := \
		--disable-silent-rules \
		--enable-installed-tests \
		--libexecdir=\$${prefix}/lib/dbus-1.0 \
		$(NULL)

ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
ifeq ($(DEB_HOST_ARCH_OS),linux)
# Non-bootstrap build on Linux: add Linux-specifics
with_systemd = yes
common_configure_flags += \
		--enable-libaudit \
		--enable-selinux \
		--enable-systemd \
		--with-systemdsystemunitdir=/lib/systemd/system \
		$(NULL)
endif
endif

normal_configure_flags := \
	--libdir=/usr/lib/$(DEB_HOST_MULTIARCH) \
	$(NULL)

debug_configure_flags := \
	--disable-xml-docs \
	--disable-doxygen-docs \
	--enable-asserts \
	--enable-checks \
	--enable-verbose-mode \
	--with-valgrind=auto \
	--prefix=/usr/lib/$(DEB_HOST_MULTIARCH)/dbus-1.0/debug-build \
	--libdir='$${prefix}/lib' \
	$(NULL)

udeb_configure_flags := \
	$(normal_configure_flags) \
	--disable-asserts \
	--disable-checks \
	--disable-doxygen-docs \
	--disable-libaudit \
	--disable-selinux \
	--disable-systemd \
	--disable-tests \
	--disable-verbose-mode \
	--disable-xml-docs \
	CFLAGS='$(CFLAGS) -Os' \
	$(NULL)

ifeq ($(filter nodocs,$(DEB_BUILD_OPTIONS))$(filter stage1,$(DEB_BUILD_PROFILES)),)
# documentation enabled
normal_configure_flags += \
	--enable-xml-docs \
	--enable-doxygen-docs \
	$(NULL)
else
# documentation disabled
dh_options += -Ndbus-1-doc
dh_install_options += -X/usr/share/man/
normal_configure_flags += \
	--disable-xml-docs \
	--disable-doxygen-docs \
	$(NULL)
endif

ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
# not a stage1 build - build all the tests
debug_configure_flags += \
		--enable-tests \
		$(NULL)
endif

override_dh_auto_configure:
	cp debian/dbus.install-generic debian/dbus.install
	if [ -n "$(with_systemd)" ]; then \
		cat debian/dbus.install-systemd >> \
			debian/dbus.install; \
	fi
	dh_auto_configure \
		-- \
		$(common_configure_flags) \
		$(normal_configure_flags) \
		$(NULL)
	dh_auto_configure \
		--builddirectory=build-debug \
		-- \
		$(common_configure_flags) \
		$(debug_configure_flags) \
		$(NULL)
	dh_auto_configure \
		--builddirectory=build-udeb \
		-- \
		$(common_configure_flags) \
		$(udeb_configure_flags) \
		$(NULL)

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

# The tests need more environmental setup at the moment: they need our
# home directory, and we can't just set HOME because the nonce-tcp
# transport uses our "official" HOME according to getpwent(), since its
# purpose is to prevent one user from impersonating another. (#630152)
override_dh_auto_test:
	:

override_dh_auto_install:
	dh_auto_install
	make -C build-debug install-exec DESTDIR=$(CURDIR)/debian/tmp
	make -C build-udeb install-exec DESTDIR=$(CURDIR)/debian/tmp-udeb

override_dh_link:
	dh_link -plibdbus-1-dev lib/$(DEB_HOST_MULTIARCH)/$$(basename $$(readlink debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libdbus-1.so)) usr/lib/$(DEB_HOST_MULTIARCH)/libdbus-1.so
	dh_link --remaining-packages

# if bootstrapping (without dbus-glib), no tests will get installed - create
# the directory in case that's happened, so the .install file doesn't need
# modification
override_dh_install:
	install -d debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/dbus-1.0/test
	rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/libdbus-1.la
	rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/dbus-1.0/debug-build/lib/libdbus-1.la
	dh_install -p$(libdbusN) \
		"usr/lib/$(DEB_HOST_MULTIARCH)/$(libdbus_soname)*" \
		lib/$(DEB_HOST_MULTIARCH)
	dh_install -pdbus-udeb
	dh_install -p$(libdbusN)-udeb \
		--sourcedir=debian/tmp-udeb \
		"usr/lib/$(DEB_HOST_MULTIARCH)/$(libdbus_soname)*" \
		lib/$(DEB_HOST_MULTIARCH)
	dh_install --remaining-packages --list-missing $(dh_install_options)
	install -m 644 -D debian/dbus-Xsession debian/dbus-x11/etc/X11/Xsession.d/75dbus_dbus-launch

override_dh_installinit:
	dh_installinit -pdbus -r

# we don't want docs for the debug symbols, just symlink to the library docs
override_dh_installdocs:
	dh_installdocs -pdbus-1-dbg --link-doc=$(libdbusN)
	dh_installdocs -pdbus-udeb -p$(libdbusN)-udeb --no-act
	dh_installdocs --remaining-packages --all AUTHORS NEWS README

override_dh_strip:
	dh_strip --dbg-package=dbus-1-dbg

override_dh_makeshlibs:
	dh_makeshlibs -V -Ndbus-1-dbg --add-udeb=$(libdbusN)-udeb -- -c4

override_dh_autoreconf:
	cp INSTALL INSTALL.orig
	dh_autoreconf
	mv INSTALL.orig INSTALL

override_dh_autoreconf_clean:
	cp INSTALL INSTALL.orig
	dh_autoreconf_clean
	mv INSTALL.orig INSTALL

override_dh_auto_clean:
	dh_auto_clean
	dh_auto_clean --builddirectory=build-debug
	dh_auto_clean --builddirectory=build-udeb
	rm -f build/test/data/valid-config-files/session.conf
	rm -f build/test/data/valid-config-files/system.conf
	rm -f build-debug/test/data/valid-config-files/session.conf
	rm -f build-debug/test/data/valid-config-files/system.conf
	rm -f dbus.devhelp

clean:
	rm -rf debian/tmp-udeb
	dh $@ $(dh_options)