File spice-vdagent.spec of Package spice-vdagent

%define realname spice-vdagent
%define realver  0.21.0
%define srcext   tar.bz2

# turn off the generation of debuginfo rpm  (RH9) ??
%global debug_package %{nil}

%if ! 0%{?_udevrulesdir:1}
%define _udevrulesdir %(pkg-config --variable=udevdir udev)/rules.d
%endif

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       wiz%{?extraver:0.}1%{?dist}
License:       GPL-2.0
Group:         System/Emulators/Other
URL:           http://www.spice-space.org/
Summary:       Spice agent for Linux

# Install-time parameters
Requires:      udev

# Packages needed to define _unitdir
%if 0%{?suse_version} >= 1230
BuildRequires: systemd-rpm-macros
BuildRequires: pkgconfig(systemd) pkgconfig(libsystemd) >= 209
Requires:      systemd
%endif
%if 0%{?rhel} >= 7
BuildRequires: systemd
BuildRequires: pkgconfig(systemd) pkgconfig(libsystemd) >= 209
Requires:      systemd
%endif
%if 0%{?rhel} && 0%{?rhel} <= 6
BuildRequires: ConsoleKit-devel
Requires:      ConsoleKit ConsoleKit-x11
%endif

# Build-time parameters
BuildRequires: pkg-config
BuildRequires: udev
BuildRequires: pkgconfig(glib-2.0) >= 2.34
BuildRequires: pkgconfig(xfixes) pkgconfig(xrandr) >= 1.3 pkgconfig(xinerama) pkgconfig(x11)
BuildRequires: pkgconfig(spice-protocol) >= 0.14.0
BuildRequires: pkgconfig(alsa) >= 1.0.22
BuildRequires: pkgconfig(dbus-1)
BuildRequires: pkgconfig(libdrm)
BuildRequires: pkgconfig(pciaccess) >= 0.10
BuildRequires: pkgconfig(udev)
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://www.spice-space.org/download/releases/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
The spice guest agent for Linux consists of 2 parts, a system wide daemon
spice-vdagentd and a X11 session agent spice-vdagent of which there is one per
X11 session.

spice-vdagentd gets started through a Sys-V initscript or a systemd unit.

spice-vdagent gets automatically started in desktop environments which
honor /etc/xdg/autostart, and under gdm.

The spice guest agent adds the following features to spice Linux guests:

  * Client mouse mode (no need to grab mouse by client, no mouse lag)

  * Automatic adjustment of the X11 session's number of virtual monitors, and
    their resolution, to the number of client windows and their resolution

  * Support  of copy and paste (text and images) between the active X11 session
    and the client, this supports both the primary selection and the clipboard

  * Support for transfering files from the client to the agent

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}
%{__sed} -ri 's|/var||' data/tmpfiles.d/spice-vdagentd.conf

%build
%configure \
 --disable-static \
%if 0%{?suse_version} >= 1230 || 0%{?rhel} >= 7
 --with-init-script=systemd \
%endif
 --enable-pciaccess \
 CFLAGS="%{optflags} %{?gcc_lto}" \
 CXXFLAGS="%{optflags} %{?gcc_lto}" \
 LDFLAGS="-Wl,--as-needed -Wl,--strip-all %{?gcc_lto}"
%{__make} %{?_smp_mflags}

%install
%{__make} install DESTDIR=%{buildroot} udevrulesdir=%{_udevrulesdir}

%clean
[ "%{buildroot}" != "/" ] && %{__rm} -rf %{buildroot}

%files
%defattr(-,root,root)
%doc CHANGELOG.md COPYING README.md
%config %{_sysconfdir}/xdg/autostart/spice-vdagent.desktop
%if 0%{?suse_version} >= 1230 || 0%{?rhel} >= 7
%{_unitdir}/spice-vdagentd.service
%{_unitdir}/spice-vdagentd.socket
%{_tmpfilesdir}/spice-vdagentd.conf
%{_udevrulesdir}/70-spice-vdagentd.rules
%ghost %dir /run/spice-vdagentd
%else
%{_initrddir}/spice-vdagentd
%endif
%{_bindir}/spice-vdagent
%{_sbindir}/spice-vdagentd
%dir %{_datadir}/gdm/autostart/LoginWindow
%dir %{_datadir}/gdm/autostart
%dir %{_datadir}/gdm/greeter/autostart
%dir %{_datadir}/gdm/greeter
%dir %{_datadir}/gdm
%{_datadir}/gdm/autostart/LoginWindow/spice-vdagent.desktop
%{_datadir}/gdm/greeter/autostart/spice-vdagent.desktop
%doc %{_mandir}/man1/*

%if 0%{?suse_version} && 0%{?_unitdir:1}

%pre
%{service_add_pre spice-vdagentd.socket}
%{service_add_pre spice-vdagentd.service}

%post
%{service_add_post spice-vdagentd.socket}
%{service_add_post spice-vdagentd.service}
%{tmpfiles_create %{_tmpfilesdir}/spice-vdagentd.conf}

%preun
%{service_del_preun spice-vdagentd.socket}
%{service_del_preun spice-vdagentd.service}

%postun
%{service_del_postun spice-vdagentd.socket}
%{service_del_postun spice-vdagentd.service}
%{insserv_cleanup}

%endif

%changelog
openSUSE Build Service is sponsored by