summaryrefslogtreecommitdiff
path: root/packaging/dbus.spec
blob: 8850086450a50b4b1b7a00b2d027cd76cc7a37fd (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
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
%define dbus_user_uid           81

%bcond_with kdbus
%bcond_with dbuspolicy
%bcond_with coverage

Name:           dbus
Url:            http://dbus.freedesktop.org/
Summary:        D-Bus Message Bus System
License:        GPL-2.0+ or AFL-2.1, BSD-2.0, LGPL-2.1+, MIT, Apache-2.0
Group:          Base/IPC
# COMMON1-BEGIN

%define with_systemd 1

BuildRequires:  expat-devel
BuildRequires:  libtool
BuildRequires:  libzio
BuildRequires:  pkg-config
%if %{with_systemd}
BuildRequires:  pkgconfig(libsystemd)
%endif
BuildRequires:  pkgconfig(libsmack)
BuildRequires:  pkgconfig(cynara-client-async)
BuildRequires:  pkgconfig(cynara-session)
Version:        1.10.6
Release:        0
Source0:        http://dbus.freedesktop.org/releases/dbus/dbus-%{version}.tar.gz
Source1:        rc.boot.dbus
Source3:        dbus_at_console.ck
Source4:        baselibs.conf
Source5:        dbus-user.service
Source6:        dbus-user.socket
Source7:        dbus.sh
Source1001:     dbus.manifest
BuildRequires:  libcap-ng-devel
# Enable support for libdbuspolicy (only for kdbus transport)
%if %{with kdbus}
%if %{with dbuspolicy}
BuildRequires:  pkgconfig(libdbuspolicy1)
BuildRequires:  pkgconfig(cynara-client)
%endif
%endif
BuildRequires:	pkgconfig(glib-2.0)
# COMMON1-END
Requires(pre):  /usr/sbin/groupadd /usr/sbin/useradd
Provides:       dbus-1

%description
D-Bus is a message bus system, a simple way for applications to talk to
one another. D-Bus supplies both a system daemon and a
per-user-login-session daemon. Also, the message bus is built on top of
a general one-to-one message passing framework, which can be used by
any two apps to communicate directly (without going through the message
bus daemon).
.
This package provides dbus-daemon.

%package devel
Summary:        Developer package for D-Bus
Group:          Development/Libraries
Requires:       dbus-libs = %{version}

%description devel
D-Bus is a message bus system, a simple way for applications to talk to
one another.
.
This package provides development libraries.

%package libs
Summary:         Library package for D-Bus
Group:           System/Libraries

%description libs
D-Bus is a message bus system, a simple way for applications to talk to
one another.
.
This package provides shared libraries.

%package tests
Summary:	Package with binaries and data for dbus tests

%description tests
This package contains installable tests. Tests are compatible with 'dbus-integration-tests' framework.

%if %{with coverage}
%package coverage
Summary:    Special version of dbus library for getting coverage analysis

%description coverage
Special version of dbus library for getting coverage analysis. *.gcda coverage files
are generated on each use of library in directory set by GCOV_PREFIX and GCOV_PREFIX_STRIP.
Use the library by modifying LD_LIBRARY_PATH.
This package is intended for debug/test use only.

%package coverage-objects
Summary:    Generated object files and gcov notes for coverage analysis

%description coverage-objects
We need to keep objects and gcno files to analyze coverage.
This package is intended for debug/test use only.
%endif

%prep
# COMMON2-BEGIN
%setup -n dbus-%{version} -q

%build
cp %{SOURCE1001} .
# We use -fpie/-pie for the whole build; this is the recommended way to harden
# the build upstream, see discussion in fdo#46570
export CFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing -fPIC -fpie"
export LDFLAGS="-pie"
export CXXFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing"
export CFLAGS="$CFLAGS -fstack-protector"
export CXXFLAGS="$CXXFLAGS -fstack-protector"
export V=1

# Support for generating separate packages with libraries generating coverage files
# WARNING: if coverage build is enabled, incremental builds will not work correctly.
#          Use the option only to generate dbus-coverage packages.
%if %{with coverage}
%reconfigure \
    --disable-static 							\
    --with-pic 								\
    --with-dbus-user=dbus 						\
    --libexecdir=%{_libdir}/%{name}					\
    --libdir=%{_libdir}							\
    --with-init-scripts=suse						\
    --enable-inotify							\
    --disable-doxygen-docs						\
    --disable-xml-docs							\
%if %{with_systemd}
    --enable-systemd							\
%endif
%if %{with kdbus}
    --enable-kdbus-transport                                            \
%if %{with dbuspolicy}
    --enable-libdbuspolicy                      			\
%endif
%endif
    --with-system-pid-file=/tmp/dbus_launch				\
    --with-console-auth-dir=/var/run/dbus/at_console/			\
    --with-systemdsystemunitdir=%{_unitdir}				\
    --enable-smack \
    --enable-cynara \
    --enable-modular-tests \
    --enable-installed-tests \
	--enable-compiler-coverage
make %{?_smp_mflags}
mkdir coverage
cp dbus/.libs/libdbus-1.so.3 coverage
mkdir coverage-objects
find dbus -name '*.o' -exec cp '{}' coverage-objects ';'
find dbus -name '*.gcno' -exec cp '{}' coverage-objects ';'

%endif

%reconfigure \
    --disable-static 							\
    --with-pic 								\
    --with-dbus-user=dbus 						\
    --libexecdir=%{_libdir}/%{name}					\
    --libdir=%{_libdir}							\
    --with-init-scripts=suse						\
    --enable-inotify							\
    --disable-doxygen-docs						\
    --disable-xml-docs							\
%if %{with_systemd}
    --enable-systemd							\
%endif
%if %{with kdbus}
    --enable-kdbus-transport                                            \
%if %{with dbuspolicy}
    --enable-libdbuspolicy                      			\
%endif
%endif
    --with-system-pid-file=/tmp/dbus_launch				\
    --with-console-auth-dir=/var/run/dbus/at_console/			\
    --with-systemdsystemunitdir=%{_unitdir}				\
    --enable-smack \
    --enable-cynara \
    --enable-modular-tests \
    --enable-installed-tests

make %{?_smp_mflags}

%install
# COMMON2-END
make DESTDIR=%{buildroot} install
mkdir -p %{buildroot}/usr/sbin
install -d %{buildroot}/%{_localstatedir}/run/dbus
mkdir -p %{buildroot}/%{_libdir}/pkgconfig
mkdir -p %{buildroot}/lib/dbus-1/system-services
mkdir -p %{buildroot}/%{_datadir}/dbus-1/system-services
mkdir -p %{buildroot}/%{_datadir}/dbus-1/interfaces
#
chmod a-x AUTHORS COPYING HACKING NEWS README doc/*.txt doc/file-boilerplate.c doc/TODO
#
install -d %{buildroot}%{_sysconfdir}/ConsoleKit/run-session.d
install -m 755 %{SOURCE3} %{buildroot}%{_sysconfdir}/ConsoleKit/run-session.d
mkdir -p %{buildroot}%{_localstatedir}/lib/dbus
touch %{buildroot}/%{_localstatedir}/lib/dbus/machine-id

mkdir -p %{buildroot}%{_unitdir_user}
install -m 0644 %{SOURCE5} %{buildroot}%{_unitdir_user}/dbus.service
install -m 0644 %{SOURCE6} %{buildroot}%{_unitdir_user}/dbus.socket

mkdir -p %{buildroot}%{_unitdir_user}/basic.target.wants
ln -sf ../dbus.service %{buildroot}%{_unitdir_user}/basic.target.wants/dbus.service

mkdir -p %{buildroot}%{_unitdir_user}/sockets.target.wants
ln -sf ../dbus.service %{buildroot}%{_unitdir_user}/sockets.target.wants/dbus.socket

rm -rf %{buildroot}/%{_libdir}/*.la
rm -rf %{buildroot}/%{_bindir}/dbus-launch

# install script for login shells (/etc/profile.d)
install -d %{buildroot}%{_sysconfdir}/profile.d
install -m 0644 %{SOURCE7} %{buildroot}%{_sysconfdir}/profile.d/dbus.sh

# docs
rm -rf %{buildroot}%{_datadir}/doc

# build test binaries and copy test data
%define relative_dbus_tests_base_dir %{_libdir}/dbus-tests
%define dbus_tests_base_dir %{buildroot}%{relative_dbus_tests_base_dir}
%define dbus_installed_tests_dir %{_libdir}/dbus/installed-tests/dbus
mkdir -p %{dbus_tests_base_dir}/test-suites/dbus-tests/

mkdir -p %{dbus_tests_base_dir}/runner/
%__cc %{_builddir}/%{name}-%{version}/test-runner.c -g -o %{dbus_tests_base_dir}/runner/dbus-tests
rm -fr %{buildroot}/usr/share/installed-tests/dbus
# The tests are installed in standard directory for dbus tests.
# However, we need to have the tests also available for dbus-integration-tests package.
# Thus, we link selected tests to our dbus-integration-tests directory
for f in manual-dir-iter manual-tcp test-corrupt test-dbus-daemon \
		 test-dbus-daemon-eavesdrop test-fdpass test-loopback test-marshal \
		 test-monitor test-printf test-refs test-relay test-sd-activation \
		 test-shell test-syntax test-syslog test-uid-permissions
do ln -s %{dbus_installed_tests_dir}/$f %{dbus_tests_base_dir}/test-suites/dbus-tests/$f; done

%if %{with coverage}
%define relative_cov_lib_dir %{relative_dbus_tests_base_dir}/coverage-libs
%define cov_lib_dir %{buildroot}%{relative_cov_lib_dir}
mkdir -p %{cov_lib_dir}
mkdir -p %{cov_lib_dir}/objects
install -m 0755 coverage/* %{cov_lib_dir}
install -m 0644 coverage-objects/* %{cov_lib_dir}/objects
%endif

%pre
# Add the "dbus" user and group
/usr/sbin/groupadd -r -g %{dbus_user_uid} dbus 2>/dev/null || :
/usr/sbin/useradd -c 'System message bus' -u %{dbus_user_uid} -g %{dbus_user_uid} \
        -s /sbin/nologin -r -d '/' dbus 2> /dev/null || :


%post libs -p /sbin/ldconfig

%postun libs -p /sbin/ldconfig


%files
%manifest %{name}.manifest
%defattr(-, root, root)
%dir %{_localstatedir}/lib/dbus
%dir /lib/dbus-1
%dir /lib/dbus-1/system-services
%license  COPYING
%config(noreplace) %{_sysconfdir}/dbus-1/session.conf
%config(noreplace) %{_sysconfdir}/dbus-1/system.conf
%config(noreplace) %{_datadir}/dbus-1/session.conf
%config(noreplace) %{_datadir}/dbus-1/system.conf
%{_sysconfdir}/ConsoleKit
%{_bindir}/dbus-cleanup-sockets
%{_bindir}/dbus-daemon
%{_bindir}/dbus-monitor
%{_bindir}/dbus-run-session
%{_bindir}/dbus-send
%{_bindir}/dbus-uuidgen
%{_bindir}/dbus-test-tool
%{_bindir}/dbus-update-activation-environment
# See doc/system-activation.txt in source tarball for the rationale
# behind these permissions
%attr(4750,root,dbus) %verify(not mode) %{_libdir}/dbus/dbus-daemon-launch-helper
%ghost %{_localstatedir}/run/dbus
%ghost %{_localstatedir}/lib/dbus/machine-id
%dir %{_unitdir}
%{_unitdir}/dbus.service
%{_unitdir}/dbus.socket
%{_unitdir_user}/dbus.service
%{_unitdir_user}/dbus.socket
%dir %{_unitdir_user}/basic.target.wants
%{_unitdir_user}/basic.target.wants/dbus.service
%dir %{_unitdir_user}/sockets.target.wants
%{_unitdir_user}/sockets.target.wants/dbus.socket
%dir %{_unitdir}/dbus.target.wants
%{_unitdir}/dbus.target.wants/dbus.socket
%dir %{_unitdir}/multi-user.target.wants
%{_unitdir}/multi-user.target.wants/dbus.service
%dir %{_unitdir}/sockets.target.wants
%{_unitdir}/sockets.target.wants/dbus.socket
%dir %{_sysconfdir}/dbus-1
%dir %{_datadir}/dbus-1/session.d
%dir %{_datadir}/dbus-1/system.d
%dir %{_datadir}/dbus-1
%dir %{_datadir}/dbus-1/interfaces
%dir %{_datadir}/dbus-1/services
%dir %{_datadir}/dbus-1/system-services
%{_sysconfdir}/profile.d/dbus.sh

%files libs
%manifest %{name}.manifest
%defattr(-, root, root)
%{_libdir}/libdbus-1.so.*

%files devel
%manifest %{name}.manifest
%defattr(-,root,root)
%{_includedir}/*
%{_libdir}/libdbus-1.so
%{_libdir}/dbus-1.0/include
%{_libdir}/pkgconfig/dbus-1.pc
%dir %{_libdir}/dbus-1.0

%files tests
%manifest %{name}.manifest
%defattr(-,root,root)
%{_libdir}/dbus-tests/test-suites/dbus-tests
%{_libdir}/dbus-tests/runner/dbus-tests
%{_libdir}/dbus/installed-tests

%if %{with coverage}
%files coverage
%{relative_cov_lib_dir}/*
%files coverage-objects
%{relative_cov_lib_dir}/objects/*
%endif

%changelog