File dbus-1.spec of Package dbus-1.294

#
# spec file for package dbus-1
#
# Copyright (c) 2015 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 0
%define _name   dbus
%define _libname libdbus-1-3
%bcond_with docs
%bcond_without selinux
%if ! %{with_systemd}
%define _unitdir %{_libexecdir}/systemd/system
%endif
Name:           dbus-1
Version:        1.8.16
Release:        0
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
BuildRequires:  libcap-ng-devel
BuildRequires:  libexpat-devel
BuildRequires:  libtool
BuildRequires:  pkg-config
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if %{with_systemd}
BuildRequires:  pkgconfig(libsystemd-daemon)
BuildRequires:  pkgconfig(libsystemd-login)
%endif
%if %{with selinux}
BuildRequires:  libselinux-devel
%endif

%package -n %{_libname}
Summary:        Library package for D-Bus
Group:          Development/Libraries/Other

%package -n dbus-1-devel
Summary:        Developer package for D-Bus
Group:          Development/Libraries/Other
Requires:       %{_libname} = %{version}
Requires:       dbus-1
Requires:       glibc-devel

%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).

%description -n %{_libname}
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).

%description -n dbus-1-devel
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
%setup -q -n %{_name}-%{version}
%patch0 -p1
%patch1 -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							\
    --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			\
    --with-systemdsystemunitdir=%{_unitdir}
make %{?_smp_mflags}
%if %{with docs}
doxygen -u && doxygen
./cleanup-man-pages.sh
%endif

%install
# COMMON2-END
tdir=$(mktemp -d)
make DESTDIR=$tdir install

# devel stuff must not be in /lib
mkdir -p %{buildroot}%{_libdir}
ln -s -v /%{_lib}/$(readlink $tdir/%{_lib}/lib%{name}.so) %{buildroot}%{_libdir}/lib%{name}.so
rm -v $tdir/%{_lib}/lib%{name}.so
mkdir -p %{buildroot}/%{_libdir}/dbus-1.0/include/
mv -f $tdir/%{_lib}/dbus-1.0/include/* %{buildroot}/%{_libdir}/dbus-1.0/include/
rm -f $tdir/%{_lib}/*.la

# fix up pkgconfig file
mkdir -p %{buildroot}/%{_libdir}/pkgconfig
sed -e 's@^\(libdir=\).*@\1%{_libdir}@' $tdir/%{_lib}/pkgconfig/dbus-1.pc > %{buildroot}/%{_libdir}/pkgconfig/dbus-1.pc
rm -f $tdir/%{_lib}/pkgconfig/dbus-1.pc

pushd $tdir
filelist=$(mktemp)
find .%{_includedir} -type f > $filelist
find ./%{_lib} -name "*.so*" >> $filelist
cat $filelist | while read file; do
  mkdir -p $(dirname %{buildroot}/$file)
  cp -a $file %{buildroot}/$file
done
popd
rm -rf $tdir

for i in %{_sysconfdir}/dbus-1/session.d %{_sysconfdir}/dbus-1/system.d \
       %{_datadir}/dbus-1/interfaces %{_datadir}/dbus-1/services %{_datadir}/dbus-1/system-services; do
  mkdir -p %{buildroot}$i
done

%post -n %{_libname} -p /sbin/ldconfig

%postun -n %{_libname} -p /sbin/ldconfig

%files -n %{_libname}
%defattr(-, root, root)
/%{_lib}/libdbus-1.so.*
# Own those directories in the library instead of dbus-1, since dbus users
# often ship files there
%dir %{_sysconfdir}/dbus-1
%dir %{_sysconfdir}/dbus-1/session.d
%dir %{_sysconfdir}/dbus-1/system.d
%dir %{_datadir}/dbus-1
%dir %{_datadir}/dbus-1/interfaces
%dir %{_datadir}/dbus-1/services
%dir %{_datadir}/dbus-1/system-services

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

%changelog
openSUSE Build Service is sponsored by