File ConsoleKit-doc.spec of Package ConsoleKit

#
# spec file for package ConsoleKit-doc
#
# Copyright (c) 2014 SUSE LINUX Products 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/
#


Name:           ConsoleKit-doc
%define         build_doc 1
%define         pkg_name ConsoleKit
%define         _udevdir %(pkg-config --variable=udevdir udev)
# WARNING: If you are editing ConsoleKit-doc.spec, STOP. Always edit
# ConsoleKit.spec and then run pre-checkin.sh which will create
# ConsoleKit-doc.spec based upon ConsoleKit.spec.
Url:            http://www.freedesktop.org/wiki/Software/ConsoleKit/
BuildRequires:  dbus-1-glib-devel
BuildRequires:  glib2-devel
BuildRequires:  glibc-devel
BuildRequires:  libacl-devel
BuildRequires:  libtool
BuildRequires:  pam-devel
BuildRequires:  pkgconfig
BuildRequires:  polkit-devel
BuildRequires:  xorg-x11-libX11-devel
BuildRequires:  zlib-devel
BuildRequires:  pkgconfig(libudev)
BuildRequires:  pkgconfig(systemd)
BuildRequires:  pkgconfig(udev)
%if %build_doc
BuildRequires:  gtk2-devel
BuildRequires:  xmlto
Provides:       ConsoleKit:/usr/share/doc/packages/ConsoleKit/spec/ConcoleKit.html
%endif
Summary:        System daemon for tracking users, sessions and seats
License:        GPL-2.0+
Group:          System/Daemons
Version:        0.4.6
Release:        0
Source:         http://www.freedesktop.org/software/%{pkg_name}/dist/%{pkg_name}-%{version}.tar.xz
Source2:        baselibs.conf
Patch0:         move-pid-and-database-to-run-directory.patch
Obsoletes:      udev-acl <= 173
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%{?systemd_requires}
%if %build_doc == 0
PreReq:         pwdutils login
PreReq:         pam-config >= 0.22
%endif

%description
ConsoleKit is a system daemon for tracking what users are logged into
the system and how they interact with the computer (e.g. which keyboard
and mouse they use).

%if !%{build_doc}

%package -n ConsoleKit-devel
Summary:        Developer package for ConsoleKit
Group:          Development/Libraries/Other
Requires:       %{pkg_name} = %{version}-%{release}
Requires:       dbus-1-devel

%description -n ConsoleKit-devel
Developer package for ConsoleKit and libck-connector

%package -n ConsoleKit-x11
Summary:        System daemon for tracking users, sessions and seats
Group:          System/Daemons
Requires:       %{pkg_name} = %{version}-%{release}
Supplements:    packageand(xorg-x11:ConsoleKit)

%description -n ConsoleKit-x11
ConsoleKit is a system daemon for tracking what users are logged into
the system and how they interact with the computer (e.g. which keyboard
and mouse they use).

%endif

%prep
%setup -q -n ConsoleKit-%{version}
%patch0 -p1

%build
export V=1
autoreconf -fi
./configure CFLAGS="$RPM_OPT_FLAGS -fno-strict-aliasing" \
  --prefix=/usr \
  --libdir=%_libdir \
  --mandir=%_mandir \
  --sysconfdir=%_sysconfdir \
  --libexecdir=%{_prefix}/lib/ConsoleKit \
  --enable-pam-module \
  --enable-udev-acl \
  --with-pam-module-dir=/%_lib/security \
  --with-pid-file=/run/ConsoleKit/pid \
  --localstatedir=%{_localstatedir} \
%if %{build_doc}
  --enable-docbook-docs \
%endif
  --docdir=%{_datadir}/doc/packages/ConsoleKit
make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} UDEVDIR=%{_udevdir} install
mkdir -p $RPM_BUILD_ROOT/etc/init.d
mkdir -p $RPM_BUILD_ROOT/etc/ConsoleKit/seats.d
mkdir -p $RPM_BUILD_ROOT%{_udevdir}/rules.d
rm -f $RPM_BUILD_ROOT/%_lib/security/pam_ck_connector.la
rm -f $RPM_BUILD_ROOT/%_libdir/*.la
%if %{build_doc}
rm -rf $RPM_BUILD_ROOT/%_libdir/*.so*
rm -rf $RPM_BUILD_ROOT/%{_datadir}/dbus-1/system-services/org.freedesktop.ConsoleKit.service
rm -rf $RPM_BUILD_ROOT/%_sysconfdir/dbus-1/system.d/ConsoleKit.conf
rm -rf $RPM_BUILD_ROOT/%_sysconfdir/ConsoleKit/seats.d/00-primary.seat
rm -rf $RPM_BUILD_ROOT/%_sysconfdir/init.d/consolekit
rm -rf $RPM_BUILD_ROOT/%_bindir/
rm -rf $RPM_BUILD_ROOT/%_includedir/ConsoleKit
rm -rf $RPM_BUILD_ROOT/%_libdir/
rm -rf $RPM_BUILD_ROOT/%_sbindir/
rm -rf $RPM_BUILD_ROOT/%_mandir/
rm -rf $RPM_BUILD_ROOT/%{_prefix}/lib
rm -rf $RPM_BUILD_ROOT/%_lib/security
rm -rf $RPM_BUILD_ROOT/%_datadir/polkit-1/actions/org.freedesktop.consolekit.policy
rm -rf $RPM_BUILD_ROOT/%_datadir/dbus-1/interfaces/org.freedesktop.ConsoleKit.Manager.xml
rm -rf $RPM_BUILD_ROOT/%_datadir/dbus-1/interfaces/org.freedesktop.ConsoleKit.Seat.xml
rm -rf $RPM_BUILD_ROOT/%_datadir/dbus-1/interfaces/org.freedesktop.ConsoleKit.Session.xml
rm -rf $RPM_BUILD_ROOT/lib/systemd/
%endif
%if !%{build_doc}

%pre
%service_add_pre console-kit-daemon.service

%post
/sbin/ldconfig
%service_add_post console-kit-daemon.service
if [ -n "$YAST_IS_RUNNING" ]; then
	/usr/sbin/pam-config --service login -a -f --ck_connector
else
	/usr/sbin/pam-config --service login -a --ck_connector || echo "please call \"/usr/sbin/pam-config --service login -a --ck_connector\" manually"
fi

%preun
%service_del_preun console-kit-daemon.service

%postun
%service_del_postun console-kit-daemon.service
# make sure this is not called on update
if [ "$1" = 0 ]; then
    /usr/sbin/pam-config --service login -d --ck_connector ||:
fi
/sbin/ldconfig
%endif

%files
%defattr(-,root,root)
%if %{build_doc}
%{_datadir}/doc/packages/ConsoleKit
%else
%dir %{_sysconfdir}/ConsoleKit
%dir %{_sysconfdir}/ConsoleKit/seats.d
%dir %{_sysconfdir}/ConsoleKit/run-seat.d
%dir %{_sysconfdir}/ConsoleKit/run-session.d
%dir %{_prefix}/lib/ConsoleKit
%dir %{_prefix}/lib/ConsoleKit/run-seat.d
%dir %{_prefix}/lib/ConsoleKit/run-session.d
%dir %{_prefix}/lib/ConsoleKit/scripts
%dir %{_udevdir}
%dir %{_udevdir}/rules.d
%dir %{_localstatedir}/log/ConsoleKit
%{_udevdir}/udev-acl
%{_udevdir}/rules.d/70-udev-acl.rules
%{_prefix}/lib/ConsoleKit/run-seat.d/udev-acl.ck
%{_prefix}/lib/ConsoleKit/scripts/ck-system-restart
%{_prefix}/lib/ConsoleKit/scripts/ck-system-stop
%{_prefix}/lib/ConsoleKit/ck-collect-session-info
%{_datadir}/dbus-1/system-services/org.freedesktop.ConsoleKit.service
%config %{_sysconfdir}/dbus-1/system.d/ConsoleKit.conf
%config %{_sysconfdir}/ConsoleKit/seats.d/00-primary.seat
%{_bindir}/*
%{_libdir}/*.so.*
%{_sbindir}/*
%{_mandir}/man8/pam_ck_connector.8.gz
/%{_lib}/security
%ghost /run/ConsoleKit
%{_datadir}/polkit-1/actions/org.freedesktop.consolekit.policy
%{_datadir}/dbus-1/interfaces/org.freedesktop.ConsoleKit.Manager.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.ConsoleKit.Seat.xml
%{_datadir}/dbus-1/interfaces/org.freedesktop.ConsoleKit.Session.xml
%{_unitdir}/console-kit-daemon.service
%{_unitdir}/console-kit-log-system-restart.service
%{_unitdir}/console-kit-log-system-start.service
%{_unitdir}/console-kit-log-system-stop.service
%{_unitdir}/basic.target.wants/console-kit-log-system-start.service
%{_unitdir}/halt.target.wants/console-kit-log-system-stop.service
%{_unitdir}/kexec.target.wants/console-kit-log-system-restart.service
%{_unitdir}/poweroff.target.wants/console-kit-log-system-stop.service
%{_unitdir}/reboot.target.wants/console-kit-log-system-restart.service

%files -n ConsoleKit-devel
%defattr(-,root,root)
%{_includedir}/ConsoleKit
%{_libdir}/*.so
%{_libdir}/pkgconfig/ck-connector.pc

%files -n ConsoleKit-x11
%defattr(-,root,root)
%{_prefix}/lib/ConsoleKit/ck-get-x11-server-pid
%{_prefix}/lib/ConsoleKit/ck-get-x11-display-device
%endif

%changelog