File dbus-1-x11.spec of Package dbus-1.4018

#
# spec file for package dbus-1-x11
#
# Copyright (c) 2016 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.

# Please submit bugfixes or comments via http://bugs.opensuse.org/
#


%define with_systemd 1
%define _name   dbus
%define _libname libdbus-1-3
%bcond_without docs
%bcond_without selinux
%if ! %{with_systemd}
%define _unitdir %{_libexecdir}/systemd/system
%endif
Name:           dbus-1-x11
Version:        1.8.22
Release:        14.1.10797.2.PTF.978477
Summary:        D-Bus Message Bus System
License:        GPL-2.0+ or AFL-2.1
Group:          System/Daemons
Url:            http://dbus.freedesktop.org/
#
Source0:        http://dbus.freedesktop.org/releases/dbus/%{_name}-%{version}.tar.gz
Source1:        rc.boot.dbus
Source2:        dbus-1.desktop
Source3:        dbus_at_console.ck
Source4:        baselibs.conf
Patch0:         dbus-log-deny.patch
# PATCH-FIX-OPENSUSE coolo@suse.de -- force a feature configure won't accept without x11 in buildrequires
Patch1:         dbus-do-autolaunch.patch
# fix-timeout-reset.patch (bsc#978477)
Patch2:         fix-timeout-reset.patch
# increase-backlog.patch (bsc#980928)
Patch3:         increase-backlog.patch
BuildRequires:  audit-devel
BuildRequires:  doxygen
BuildRequires:  libcap-ng-devel
BuildRequires:  libexpat-devel
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRequires:  update-desktop-files
BuildRequires:  xmlto
BuildRequires:  pkgconfig(x11)
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %{with_systemd}
BuildRequires:  pkgconfig(libsystemd-daemon)
BuildRequires:  pkgconfig(libsystemd-login)
%endif
%if %{with selinux}
BuildRequires:  libselinux-devel
%endif

%description
D-Bus contains some tools that require Xlib to be installed, those are
in this separate package so server systems need not install X.

%package -n dbus-1-devel-doc
Summary:        Developer documentation package for D-Bus
Group:          Development/Libraries/Other
Requires:       dbus-1 = %{version}
BuildArch:      noarch

%description -n dbus-1-devel-doc
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).

%package -n dbus-1
Summary:        D-Bus Message Bus System
# FIXME: use proper Requires(pre/post/preun/...)
Group:          System/Daemons
PreReq:         %{_sbindir}/groupadd
PreReq:         %{_sbindir}/useradd
PreReq:         permissions
Requires(post): %{_libname} = %{version}
# bug437293
%ifarch ppc64
Obsoletes:      dbus-1-64bit
%endif

%description -n dbus-1
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).

%prep
# COMMON2-BEGIN
# COMMON2-BEGIN
%setup -q -n %{_name}-%{version}
%patch0 -p1
%patch1 -p1
%patch2 -p1
%patch3 -p1

%build
autoreconf -fi
# 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="%{optflags} -fno-strict-aliasing -fPIC -fpie"
export LDFLAGS="-pie"
export CXXFLAGS="%{optflags} -fno-strict-aliasing"
export CFLAGS="$CFLAGS -fstack-protector"
export CXXFLAGS="$CXXFLAGS -fstack-protector"
export V=1
# keeping socket in /var/run as for upstream explanation in:
# http://cgit.freedesktop.org/systemd/systemd/commit/?id=df1e02046144f41176c32ed011369fd8dba36b76
%configure \
    --disable-static 							\
    --with-pic 								\
    --bindir=/bin							\
    --libexecdir=/lib/dbus-1					\
    --libdir=/%{_lib}							\
    --with-init-scripts=suse						\
    --enable-inotify							\
%if %{with docs}
    --enable-doxygen-docs						\
%endif
%if %{with selinux}
    --enable-selinux							\
%endif
%if %{with_systemd}
    --enable-systemd							\
%endif
    --enable-libaudit							\
%if 0%{?suse_version} <= 1315 && !0%{?is_opensuse}
    --with-console-auth-dir=%{_localstatedir}/run/dbus/at_console/			\
    --with-system-pid-file=%{_localstatedir}/run/dbus/pid				\
    --with-system-socket=%{_localstatedir}/run/dbus/system_bus_socket			\
%else
    --with-console-auth-dir=/run/dbus/at_console/			\
    --with-system-pid-file=/run/dbus/pid				\
    --with-system-socket=/run/dbus/system_bus_socket			\
%endif
    --with-systemdsystemunitdir=%{_unitdir}
make %{?_smp_mflags}
%if %{with docs}
doxygen -u && doxygen
./cleanup-man-pages.sh
%endif

%install
# COMMON2-END
# COMMON2-END
make DESTDIR=%{buildroot} install %{?_smp_mflags}
mkdir -p %{buildroot}/%{_bindir}
mkdir -p %{buildroot}/%{_mandir}/man1
mkdir -p %{buildroot}%{_sysconfdir}/init.d
mkdir -p %{buildroot}%{_prefix}/sbin

mv %{buildroot}/bin/dbus-launch %{buildroot}/%{_bindir}
mv %{buildroot}/bin/dbus-run-session %{buildroot}/%{_bindir}
install -m 755 %{SOURCE1} %{buildroot}/%{_sysconfdir}/init.d/dbus
ln -sf %{_sysconfdir}/init.d/dbus %{buildroot}/%{_sbindir}/rcdbus
%if 0%{?suse_version} <= 1315 && !0%{?is_opensuse}
install -d %{buildroot}%{_localstatedir}/run/dbus
%else
install -d %{buildroot}/run/dbus
%endif
mkdir -p %{buildroot}/%{_datadir}/susehelp/meta/Development/Libraries/
install -m 0644 %{SOURCE2} \
    %{buildroot}/%{_datadir}/susehelp/meta/Development/Libraries/dbus-1.desktop
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
mkdir -p %{buildroot}/%{_libdir}/dbus-1.0/include/

chmod a-x AUTHORS COPYING HACKING NEWS README doc/*.txt doc/file-boilerplate.c doc/TODO

rm %{buildroot}%{_includedir}/dbus-1.0/dbus/*.h
rm %{buildroot}/%{_lib}/libdbus-1* %{buildroot}/%{_lib}/pkgconfig/*pc
rm %{buildroot}/%{_lib}/dbus-1.0/include/dbus/*.h

#
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

# Link the /bin/dbus-send binary to /usr/bin/dbus-send. This should be removed once dbus has been fully migrated to /usr
# Currently required to make upower work together with systemd
mkdir -p %{buildroot}%{_prefix}/bin
ln -sf /bin/dbus-send %{buildroot}%{_bindir}/dbus-send

%verifyscript -n dbus-1
%verify_permissions -e /lib/dbus-1/dbus-daemon-launch-helper

%pre -n dbus-1
%{_sbindir}/groupadd -r messagebus 2> /dev/null || :
%if 0%{?suse_version} <= 1315 && !0%{?is_opensuse}
%{_sbindir}/useradd -r -s /bin/false -c "User for D-Bus" -d %{_localstatedir}/run/dbus -g messagebus messagebus 2> /dev/null || :
%else
%{_sbindir}/useradd -r -s /bin/false -c "User for D-Bus" -d /run/dbus -g messagebus messagebus 2> /dev/null || :
%endif

%post -n dbus-1
if [ -e %{_localstatedir}/lib/dbus/machine-id -a -e %{_sysconfdir}/machine-id ]; then
  cmp -s %{_localstatedir}/lib/dbus/machine-id %{_sysconfdir}/machine-id > /dev/null
  if [ $? ]; then
    rm -f %{_localstatedir}/lib/dbus/machine-id
  fi
fi
if [ ! -e %{_localstatedir}/lib/dbus/machine-id ]; then
  if [ -e %{_sysconfdir}/machine-id ]; then
    mkdir -p %{_localstatedir}/lib/dbus/
    ln -s %{_sysconfdir}/machine-id %{_localstatedir}/lib/dbus/machine-id
  else
    /bin/dbus-uuidgen --ensure
  fi
fi
%{insserv_force_if_yast dbus}
/sbin/ldconfig
%set_permissions /lib/dbus-1/dbus-daemon-launch-helper

%postun -n dbus-1
%insserv_cleanup

%files
%defattr(-,root,root)
%{_bindir}/dbus-launch
%{_bindir}/dbus-run-session
%{_mandir}/man1/dbus-launch.1*
%{_mandir}/man1/dbus-run-session.1*

%files -n dbus-1
%defattr(-, root, root)
%dir %{_localstatedir}/lib/dbus
%dir /lib/dbus-1
%dir /lib/dbus-1/system-services
%doc AUTHORS COPYING HACKING NEWS README
%config(noreplace) %{_sysconfdir}/dbus-1/session.conf
%config(noreplace) %{_sysconfdir}/dbus-1/system.conf
%{_sysconfdir}/init.d/dbus
%{_sysconfdir}/ConsoleKit
/bin/dbus-cleanup-sockets
/bin/dbus-daemon
/bin/dbus-monitor
/bin/dbus-send
%{_bindir}/dbus-send
/bin/dbus-uuidgen
%{_mandir}/man1/dbus-cleanup-sockets.1.*
%{_mandir}/man1/dbus-daemon.1.*
%{_mandir}/man1/dbus-monitor.1.*
%{_mandir}/man1/dbus-send.1.*
%{_mandir}/man1/dbus-uuidgen.1.*
%{_sbindir}/rcdbus
# See doc/system-activation.txt in source tarball for the rationale
# behind these permissions
%attr(4750,root,messagebus) %verify(not mode) /lib/dbus-1/dbus-daemon-launch-helper
%if 0%{?suse_version} <= 1315 && !0%{?is_opensuse}
%ghost %{_localstatedir}/run/dbus
%else
%ghost /run/dbus
%endif
%ghost %{_localstatedir}/lib/dbus/machine-id
%if ! %{with_systemd}
%dir %{_libexecdir}/systemd
%dir %{_unitdir}
%endif
%{_unitdir}/dbus.service
%{_unitdir}/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

%files -n dbus-1-devel-doc
%defattr(-,root,root)
%dir %{_datadir}/doc/dbus
%{_datadir}/doc/dbus/api/
%doc %{_datadir}/doc/dbus/dbus-faq.html
%doc %{_datadir}/doc/dbus/dbus-specification.html
%doc %{_datadir}/doc/dbus/dbus-test-plan.html
%doc %{_datadir}/doc/dbus/dbus-tutorial.html
%doc %{_datadir}/doc/dbus/diagram.*
%doc %{_datadir}/doc/dbus/system-activation.txt
%doc %{_datadir}/doc/dbus/dbus-cleanup-sockets.1.html
%doc %{_datadir}/doc/dbus/dbus-daemon.1.html
%doc %{_datadir}/doc/dbus/dbus-launch.1.html
%doc %{_datadir}/doc/dbus/dbus-run-session.1.html
%doc %{_datadir}/doc/dbus/dbus-monitor.1.html
%doc %{_datadir}/doc/dbus/dbus-send.1.html
%doc %{_datadir}/doc/dbus/dbus-uuidgen.1.html
%doc %{_datadir}/doc/dbus/dbus.devhelp
%doc doc/*.txt doc/file-boilerplate.c doc/TODO
%{_datadir}/susehelp

%changelog