add packaging
[platform/upstream/dbus.git] / packaging / dbus.spec
1 %define dbus_user_uid           81
2
3 Name:           dbus
4 %define _libname libdbus
5 Url:            http://dbus.freedesktop.org/
6 Summary:        D-Bus Message Bus System
7 License:        GPL-2.0+ or AFL-2.1
8 Group:          System/Daemons
9 # COMMON1-BEGIN
10
11 # We can't enable this right now, because it will create a build cycle between
12 # dbus-1 and systemd. Fun!
13 %define with_systemd 1
14
15 BuildRequires:  doxygen
16 BuildRequires:  expat-devel
17 BuildRequires:  libtool
18 BuildRequires:  libzio
19 BuildRequires:  pkg-config
20 %if %{with_systemd}
21 BuildRequires:  pkgconfig(libsystemd-daemon)
22 BuildRequires:  pkgconfig(libsystemd-login)
23 %endif
24 Version:        1.6.8
25 Release:        0
26 Source0:        http://dbus.freedesktop.org/releases/dbus/%{name}-%{version}.tar.gz
27 Source1:        rc.boot.dbus
28 Source3:        dbus_at_console.ck
29 Source4:        baselibs.conf
30 BuildRequires:  libcap-ng-devel
31 # COMMON1-END
32 Requires(pre):  /usr/sbin/groupadd /usr/sbin/useradd
33
34 Provides:       dbus-1
35
36 %package -n %{_libname}
37
38 Summary:        Library package for D-Bus
39 Group:          Development/Libraries/Other
40
41 %package devel
42
43 Summary:        Developer package for D-Bus
44 Group:          Development/Libraries/Other
45 Requires:       %{_libname} = %{version}
46 Requires:       dbus
47 Requires:       glibc-devel
48
49 %package devel-doc
50
51 Summary:        Developer documentation package for D-Bus
52 Group:          Development/Libraries/Other
53 Requires:       %{name} = %{version}
54 BuildArch:      noarch
55
56 %description
57 D-Bus is a message bus system, a simple way for applications to talk to
58 one another. D-Bus supplies both a system daemon and a
59 per-user-login-session daemon. Also, the message bus is built on top of
60 a general one-to-one message passing framework, which can be used by
61 any two apps to communicate directly (without going through the message
62 bus daemon).
63
64 %description -n %{_libname}
65 D-Bus is a message bus system, a simple way for applications to talk to
66 one another. D-Bus supplies both a system daemon and a
67 per-user-login-session daemon. Also, the message bus is built on top of
68 a general one-to-one message passing framework, which can be used by
69 any two apps to communicate directly (without going through the message
70 bus daemon).
71
72 %description devel
73 D-Bus is a message bus system, a simple way for applications to talk to
74 one another. D-Bus supplies both a system daemon and a
75 per-user-login-session daemon. Also, the message bus is built on top of
76 a general one-to-one message passing framework, which can be used by
77 any two apps to communicate directly (without going through the message
78 bus daemon).
79
80 %description devel-doc
81 D-Bus is a message bus system, a simple way for applications to talk to
82 one another. D-BUS supplies both a system daemon and a
83 per-user-login-session daemon. Also, the message bus is built on top of
84 a general one-to-one message passing framework, which can be used by
85 any two apps to communicate directly (without going through the message
86 bus daemon).
87
88 %prep
89 # COMMON2-BEGIN
90 %setup -n %{name}-%{version} -q
91
92 %build
93 autoreconf -fi
94 # We use -fpie/-pie for the whole build; this is the recommended way to harden
95 # the build upstream, see discussion in fdo#46570
96 export CFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing -fPIC -fpie"
97 export LDFLAGS="-pie"
98 export CXXFLAGS="${RPM_OPT_FLAGS} -fno-strict-aliasing"
99 export CFLAGS="$CFLAGS -fstack-protector"
100 export CXXFLAGS="$CXXFLAGS -fstack-protector"
101 export V=1
102 %configure \
103     --disable-static                                                    \
104     --with-pic                                                          \
105     --with-dbus-user=dbus                                               \
106     --libexecdir=%{_libdir}/%{name}                                     \
107     --libdir=%{_libdir}                                                 \
108     --with-init-scripts=suse                                            \
109     --enable-inotify                                                    \
110     --enable-doxygen-docs                                               \
111 %if %{with_systemd}
112     --enable-systemd                                                    \
113 %endif
114     --with-console-auth-dir=/var/run/dbus/at_console/                   \
115     --with-systemdsystemunitdir=%{_unitdir}                     
116 make %{?_smp_mflags}
117
118 %install
119 # COMMON2-END
120 make DESTDIR=%{buildroot} install
121 mkdir -p %{buildroot}/etc/init.d
122 mkdir -p %{buildroot}/usr/sbin
123 install -m 755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/dbus
124 ln -sf %{_sysconfdir}/init.d/dbus %{buildroot}/%{_sbindir}/rcdbus
125 install -d %{buildroot}/%{_localstatedir}/run/dbus
126 mkdir -p %{buildroot}/%{_libdir}/pkgconfig
127 mkdir -p %{buildroot}/lib/dbus-1/system-services
128 mkdir -p %{buildroot}/%{_datadir}/dbus-1/system-services
129 mkdir -p %{buildroot}/%{_datadir}/dbus-1/interfaces
130 #mkdir -p %{buildroot}/%{_libdir}/dbus-1.0/include/
131 rm -f %{buildroot}/%{_libdir}/*.la
132 #
133 rm -f %{buildroot}/%{_bindir}/dbus-launch
134 rm -f %{buildroot}/%{_mandir}/man1/dbus-launch.1*
135 chmod a-x AUTHORS COPYING HACKING NEWS README doc/*.txt doc/file-boilerplate.c doc/TODO
136 #
137 install -d %{buildroot}%{_sysconfdir}/ConsoleKit/run-session.d
138 install -m 755 %{SOURCE3} %{buildroot}%{_sysconfdir}/ConsoleKit/run-session.d
139 mkdir -p %{buildroot}%{_localstatedir}%{_libdir}/dbus
140 touch %{buildroot}/%{_localstatedir}%{_libdir}/dbus/machine-id
141
142
143
144 %pre
145 # Add the "dbus" user and group
146 /usr/sbin/groupadd -r -g %{dbus_user_uid} dbus 2>/dev/null || :
147 /usr/sbin/useradd -c 'System message bus' -u %{dbus_user_uid} -g %{dbus_user_uid} \
148         -s /sbin/nologin -r -d '/' dbus 2> /dev/null || :
149
150 %post -n %{_libname} -p /sbin/ldconfig
151
152 %postun -n %{_libname} -p /sbin/ldconfig
153
154 %docs_package
155
156 %files
157 %defattr(-, root, root)
158 %dir %{_localstatedir}%{_libdir}/dbus
159 %dir /lib/dbus-1
160 %dir /lib/dbus-1/system-services
161 %doc  COPYING 
162 %config(noreplace) %{_sysconfdir}/dbus-1/session.conf
163 %config(noreplace) %{_sysconfdir}/dbus-1/system.conf
164 %{_sysconfdir}/init.d/dbus
165 %{_sysconfdir}/ConsoleKit
166 %{_bindir}/dbus-cleanup-sockets
167 %{_bindir}/dbus-daemon
168 %{_bindir}/dbus-monitor
169 %{_bindir}/dbus-send
170 %{_bindir}/dbus-uuidgen
171 %{_sbindir}/rcdbus
172 # See doc/system-activation.txt in source tarball for the rationale
173 # behind these permissions
174 %attr(4750,root,dbus) %verify(not mode) %{_libdir}/dbus/dbus-daemon-launch-helper
175 %ghost %{_localstatedir}/run/dbus
176 %ghost %{_localstatedir}%{_libdir}/dbus/machine-id
177 %dir %{_unitdir}
178 %{_unitdir}/dbus.service
179 %{_unitdir}/dbus.socket
180 %dir %{_unitdir}/dbus.target.wants
181 %{_unitdir}/dbus.target.wants/dbus.socket
182 %dir %{_unitdir}/multi-user.target.wants
183 %{_unitdir}/multi-user.target.wants/dbus.service
184 %dir %{_unitdir}/sockets.target.wants
185 %{_unitdir}/sockets.target.wants/dbus.socket
186
187 %files -n %{_libname}
188 %defattr(-, root, root)
189 %{_libdir}/libdbus-1.so.*
190 # Own those directories in the library instead of dbus-1, since dbus users
191 # often ship files there
192 %dir %{_sysconfdir}/dbus-1
193 %dir %{_sysconfdir}/dbus-1/session.d
194 %dir %{_sysconfdir}/dbus-1/system.d
195 %dir %{_datadir}/dbus-1
196 %dir %{_datadir}/dbus-1/interfaces
197 %dir %{_datadir}/dbus-1/services
198 %dir %{_datadir}/dbus-1/system-services
199
200 %files devel
201 %defattr(-,root,root)
202 %{_includedir}/*
203 %{_libdir}/libdbus-1.so
204 %dir %{_libdir}/dbus-1.0
205 %{_libdir}/dbus-1.0/include
206 %{_libdir}/pkgconfig/dbus-1.pc
207
208 %files devel-doc
209 %defattr(-,root,root)
210 %dir %{_datadir}/doc/dbus
211 %{_datadir}/doc/dbus/api/
212 %doc %{_datadir}/doc/dbus/dbus-faq.html
213 %doc %{_datadir}/doc/dbus/dbus-specification.html
214 %doc %{_datadir}/doc/dbus/dbus-test-plan.html
215 %doc %{_datadir}/doc/dbus/dbus-tutorial.html
216 %doc %{_datadir}/doc/dbus/diagram.*
217 %doc %{_datadir}/doc/dbus/system-activation.txt
218 %doc doc/*.txt doc/file-boilerplate.c doc/TODO
219
220 %changelog