rules 5.41 KB
Newer Older
1 2 3
#!/usr/bin/make -f
# Copyright  2002,2003 Colin Walters <walters@verbum.org>
# Copyright  2003 Daniel Stone <daniels@debian.org>
4
# Copyright  2006 Sjoerd Simons <sjoerd@debian.org>
Michael Biebl's avatar
Michael Biebl committed
5
# Copyright  2011 Michael Biebl <biebl@debian.org>
6

7 8
include /usr/share/dpkg/default.mk

Michael Biebl's avatar
Michael Biebl committed
9
%:
10
	dh $@ $(dh_options)
11

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

15
LDFLAGS += -Wl,--as-needed
16

17 18 19 20 21 22
dh_options = \
	--builddirectory=build \
	--with autoreconf \
	--parallel \
	$(NULL)

23
common_configure_flags := \
24
		--disable-silent-rules \
25
		--enable-installed-tests \
Michael Biebl's avatar
Michael Biebl committed
26
		--libexecdir=\$${prefix}/lib/dbus-1.0 \
27 28
		$(NULL)

29
ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
30 31
ifeq ($(DEB_HOST_ARCH_OS),linux)
# Non-bootstrap build on Linux: add Linux-specifics
32
with_systemd = yes
33 34 35 36
common_configure_flags += \
		--enable-libaudit \
		--enable-selinux \
		--enable-systemd \
37
		--with-systemdsystemunitdir=/lib/systemd/system \
38
		$(NULL)
39 40
endif
endif
41

42 43 44 45 46 47 48 49 50 51
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 \
52
	--with-valgrind=auto \
53 54 55 56
	--prefix=/usr/lib/$(DEB_HOST_MULTIARCH)/dbus-1.0/debug-build \
	--libdir='$${prefix}/lib' \
	$(NULL)

57
udeb_configure_flags := \
58 59 60 61 62 63 64 65 66 67 68 69
	$(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)
70

71
ifeq ($(filter nodocs,$(DEB_BUILD_OPTIONS))$(filter stage1,$(DEB_BUILD_PROFILES)),)
72 73 74 75 76 77 78
# documentation enabled
normal_configure_flags += \
	--enable-xml-docs \
	--enable-doxygen-docs \
	$(NULL)
else
# documentation disabled
79
dh_options += -Ndbus-1-doc
80
dh_install_options += -X/usr/share/man/
81 82 83 84 85 86
normal_configure_flags += \
	--disable-xml-docs \
	--disable-doxygen-docs \
	$(NULL)
endif

87
ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),)
88 89 90 91 92 93
# not a stage1 build - build all the tests
debug_configure_flags += \
		--enable-tests \
		$(NULL)
endif

94
override_dh_auto_configure:
95
	cp debian/dbus.install-generic debian/dbus.install
96 97
	if [ -n "$(with_systemd)" ]; then \
		cat debian/dbus.install-systemd >> \
98 99
			debian/dbus.install; \
	fi
100 101 102
	dh_auto_configure \
		-- \
		$(common_configure_flags) \
103
		$(normal_configure_flags) \
104
		$(NULL)
105 106 107 108
	dh_auto_configure \
		--builddirectory=build-debug \
		-- \
		$(common_configure_flags) \
109
		$(debug_configure_flags) \
110
		$(NULL)
111 112 113 114 115 116
	dh_auto_configure \
		--builddirectory=build-udeb \
		-- \
		$(common_configure_flags) \
		$(udeb_configure_flags) \
		$(NULL)
117

Michael Biebl's avatar
Michael Biebl committed
118 119
override_dh_auto_build:
	dh_auto_build
120
	dh_auto_build --builddirectory=build-debug
121
	dh_auto_build --builddirectory=build-udeb
122

123 124 125 126
# 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)
127
override_dh_auto_test:
128
	:
129

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

Michael Biebl's avatar
Michael Biebl committed
135
override_dh_link:
136
	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
Michael Biebl's avatar
Michael Biebl committed
137
	dh_link --remaining-packages
138

139 140 141
# 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
Michael Biebl's avatar
Michael Biebl committed
142
override_dh_install:
143 144
	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
145
	rm -f debian/tmp/usr/lib/$(DEB_HOST_MULTIARCH)/dbus-1.0/debug-build/lib/libdbus-1.la
146 147 148
	dh_install -p$(libdbusN) \
		"usr/lib/$(DEB_HOST_MULTIARCH)/$(libdbus_soname)*" \
		lib/$(DEB_HOST_MULTIARCH)
149 150 151 152 153
	dh_install -pdbus-udeb
	dh_install -p$(libdbusN)-udeb \
		--sourcedir=debian/tmp-udeb \
		"usr/lib/$(DEB_HOST_MULTIARCH)/$(libdbus_soname)*" \
		lib/$(DEB_HOST_MULTIARCH)
154
	dh_install --remaining-packages --list-missing $(dh_install_options)
Michael Biebl's avatar
Michael Biebl committed
155
	install -m 644 -D debian/dbus-Xsession debian/dbus-x11/etc/X11/Xsession.d/75dbus_dbus-launch
Michael Biebl's avatar
Michael Biebl committed
156

Michael Biebl's avatar
Michael Biebl committed
157
override_dh_installinit:
158
	dh_installinit -pdbus -r
159

Michael Biebl's avatar
Michael Biebl committed
160 161 162
# 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)
163
	dh_installdocs -pdbus-udeb -p$(libdbusN)-udeb --no-act
Michael Biebl's avatar
Michael Biebl committed
164
	dh_installdocs --remaining-packages --all AUTHORS NEWS README
165

Michael Biebl's avatar
Michael Biebl committed
166 167
override_dh_strip:
	dh_strip --dbg-package=dbus-1-dbg
168

Michael Biebl's avatar
Michael Biebl committed
169
override_dh_makeshlibs:
170
	dh_makeshlibs -V -Ndbus-1-dbg --add-udeb=$(libdbusN)-udeb -- -c4
171

172
override_dh_autoreconf:
173
	cp INSTALL INSTALL.orig
174 175 176 177
	dh_autoreconf
	mv INSTALL.orig INSTALL

override_dh_autoreconf_clean:
178 179 180
	cp INSTALL INSTALL.orig
	dh_autoreconf_clean
	mv INSTALL.orig INSTALL
181

Michael Biebl's avatar
Michael Biebl committed
182 183
override_dh_auto_clean:
	dh_auto_clean
184
	dh_auto_clean --builddirectory=build-debug
185
	dh_auto_clean --builddirectory=build-udeb
186 187
	rm -f build/test/data/valid-config-files/session.conf
	rm -f build/test/data/valid-config-files/system.conf
188 189
	rm -f build-debug/test/data/valid-config-files/session.conf
	rm -f build-debug/test/data/valid-config-files/system.conf
190
	rm -f dbus.devhelp
191 192 193 194

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