File spice-gtk.spec of Package spice-gtk

%define realname spice-gtk
%define realver  0.41
%define srcext   tar.xz

%define gtk_so_ver        5
%define glib_so_ver       8

%define glib_ver     2.0
%define pkg_glib_ver 2_0
%define gtk_ver      3.0
%define pkg_gtk_ver  3_0

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

# Common info
Name:          %{realname}
Version:       %{realver}
Release:       %{?extraver:0.}1%{?rhel:.el%{rhel}}%{?fedora:.fc%{fedora}}
License:       LGPL-2.1
Group:         System/Libraries
URL:           http://www.spice-space.org/
Summary:       GTK+ SPICE widget

# Build-time parameters
BuildRequires: xz
BuildRequires: pkg-config
BuildRequires: meson >= 0.53.0 ninja
BuildRequires: python3-six python3-pyparsing
# mandatory dependencies
BuildRequires: pkgconfig(spice-protocol) >= 0.14.3
BuildRequires: pkgconfig(glib-2.0) >= 2.52
BuildRequires: pkgconfig(gio-2.0) >= 2.52
BuildRequires: pkgconfig(gobject-2.0) >= 2.52
BuildRequires: pkgconfig(gio-unix-2.0)
BuildRequires: pkgconfig(pixman-1) >= 0.17.7
BuildRequires: pkgconfig(openssl) >= 1.0.0
# mandatory dependencies, without specific version requirement
BuildRequires: pkgconfig(cairo)
BuildRequires: pkgconfig(libjpeg)
BuildRequires: pkgconfig(zlib)
BuildRequires: pkgconfig(json-glib-1.0)
# Non-mandatory/optional dependencies
BuildRequires: pkgconfig(opus) >= 0.9.14
# gtk
BuildRequires: pkgconfig(gtk+-3.0) >= 3.22
BuildRequires: pkgconfig(epoxy) pkgconfig(egl)
BuildRequires: pkgconfig(x11)
BuildRequires: pkgconfig(libva-x11)
# wayland protocols
BuildRequires: pkgconfig(wayland-protocols) >= 1.17
BuildRequires: pkgconfig(wayland-server) >= 1.17.0
BuildRequires: pkgconfig(wayland-cursor) >= 1.17.0
BuildRequires: pkgconfig(wayland-client) >= 1.17.0
# webdav
### BuildRequires: pkgconfig(libphodav-2.0)
### BuildRequires: pkgconfig(libsoup-2.4) >= 2.49.91
# gstreamer
BuildRequires: pkgconfig(gstreamer-1.0) pkgconfig(gstreamer-base-1.0) pkgconfig(gstreamer-app-1.0)
BuildRequires: pkgconfig(gstreamer-audio-1.0)
BuildRequires: pkgconfig(gstreamer-video-1.0)
# usbredir
BuildRequires: pkgconfig(libusbredirparser-0.5)
BuildRequires: pkgconfig(libusbredirhost)
BuildRequires: pkgconfig(libusb-1.0) >= 1.0.21
# libcap-ng
BuildRequires: pkgconfig(libcap-ng)
# PolicyKit
BuildRequires: pkgconfig(polkit-gobject-1) >= 0.101
BuildRequires: libacl-devel
# usb-ids-path
#BuildRequires: pkgconfig(usbutils)
# lz4
BuildRequires: pkgconfig(liblz4)
# sasl
BuildRequires: pkgconfig(libsasl2)
# Smartcard
BuildRequires: pkgconfig(libcacard) >= 0.1.2
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://www.spice-space.org/download/gtk/%{realname}-%{realver}%{?extraver}.%{srcext}

%description
spice-gtk is a GTK+2 and GTK+3 SPICE widget. It features glib-based objects for
SPICE protocol parsing and a gtk widget for embedding the SPICE display into
other applications such as virt-manager or Boxes.

%package -n libspice-client-gtk-%{pkg_gtk_ver}-%{gtk_so_ver}
Group:         System/Libraries
Summary:       GTK+ SPICE widget
Provides:      libspice-client-gtk
Provides:      libspice-client-gtk%{gtk_so_ver}

%description -n libspice-client-gtk-%{pkg_gtk_ver}-%{gtk_so_ver}
GTK+ SPICE widget

%package -n libspice-client-gtk-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      libspice-client-gtk-%{pkg_gtk_ver}-%{gtk_so_ver} = %{version}-%{release}
Requires:      pkgconfig(gtk+-3.0) >= 3.12
Requires:      pkgconfig(spice-client-glib-2.0) = %{version}-%{release}
Provides:      spice-gtk-devel = %{version}

%description -n libspice-client-gtk-devel
Development files for libspice-client-gtk

%package -n libspice-client-glib-%{pkg_glib_ver}-%{glib_so_ver}
Group:         System/Libraries
Summary:       SPICE Client GLib 2.0 library
Provides:      spice-glib
Provides:      libspice-client-glib
Provides:      libspice-client-glib%{glib_so_ver}
%if 0%{?suse_version} >= 1140
Requires:      permissions
PreReq:        permissions
%endif

%description -n libspice-client-glib-%{pkg_glib_ver}-%{glib_so_ver}
SPICE Client GLib 2.0 library

%package -n libspice-client-glib-devel
Group:         Development/Languages/C and C++
Summary:       Development files for libspice-client-glib
Requires:      libspice-client-glib-%{pkg_glib_ver}-%{glib_so_ver} = %{version}
Requires:      pkgconfig(spice-protocol)
Requires:      pkgconfig(pixman-1) >= 0.17.7
Requires:      pkgconfig(openssl)
Provides:      spice-glib-devel = %{version}

%description -n libspice-client-glib-devel
Development files for libspice-client-glib

# Preparation step (unpackung and patching if necessary)
%prep
%setup -q -n %{realname}-%{realver}%{?extraver}

%build
_CFLAGS='%{optflags}'
_LDFLAGS='-Wl,--strip-all -Wl,-z,now -Wl,-z,noexecstack -Wl,-z,relro'
meson setup build \
 --buildtype=release \
 --strip \
 --optimization=2 \
 \
 --prefix=%{_prefix} \
 --libexecdir=%{_libexecdir} \
 --default-library=shared \
 \
 -Dgtk=enabled \
 -Dwayland-protocols=enabled \
 -Dusbredir=enabled \
 -Dlibcap-ng=enabled \
 -Dpolkit=enabled \
 -Dlz4=enabled \
 -Dsasl=enabled \
 -Dopus=enabled \
 -Dsmartcard=enabled \
 -Dgtk_doc=disabled \
 -Drecorder=true \
 -Dusb-ids-path=%{_datadir}/usb.ids \
 \
 -Db_lto=%{?gcc_lto:true}%{!?gcc_lto:false} \
 -Db_ndebug=if-release \
 -Dc_args="$_CFLAGS" \
 -Dc_link_args="$_LDFLAGS"
ninja -v -C build %{?_smp_mflags}

%install
DESTDIR=%{buildroot} ninja -v -C build install
%if 0%{?suse_version} >= 1140
%{__install} -d -m 755 %{buildroot}%{_sysconfdir}/permissions.d
echo "%{_libexecdir}/spice-client-glib-usb-acl-helper root:root 4755" > %{buildroot}%{_sysconfdir}/permissions.d/spice-client-glib-usb-acl-helper
%endif
%find_lang %{name}

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

%files -f %{name}.lang
%defattr(-,root,root)
%doc AUTHORS CHANGELOG.md COPYING README.md
%{_bindir}/spicy*
%doc %{_mandir}/man1/*

%files -n libspice-client-gtk-%{pkg_gtk_ver}-%{gtk_so_ver}
%defattr(-,root,root)
%{_libdir}/libspice-client-gtk-%{gtk_ver}.so.%{gtk_so_ver}*

%files -n libspice-client-gtk-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/spice-client-gtk-%{gtk_ver}.pc
%dir %{_includedir}/spice-client-gtk-%{gtk_ver}/
%{_includedir}/spice-client-gtk-%{gtk_ver}/*.h
%{_libdir}/libspice-client-gtk-%{gtk_ver}.so

%files -n libspice-client-glib-%{pkg_glib_ver}-%{glib_so_ver}
%defattr(-,root,root)
%verify(not mode) %attr(4755, root, root) %{_libexecdir}/spice-client-glib-usb-acl-helper
%if 0%{?suse_version} >= 1140
%config %{_sysconfdir}/permissions.d/spice-client-glib-usb-acl-helper
%endif
%{_libdir}/libspice-client-glib-%{glib_ver}.so.%{glib_so_ver}*
%dir %{_datadir}/polkit-1/actions
%dir %{_datadir}/polkit-1
%{_datadir}/polkit-1/actions/org.spice-space.lowlevelusbaccess.policy

%files -n libspice-client-glib-devel
%defattr(-,root,root)
%{_libdir}/pkgconfig/spice-client-glib-%{glib_ver}.pc
%dir %{_includedir}/spice-client-glib-%{glib_ver}/
%{_includedir}/spice-client-glib-%{glib_ver}/*.h
%{_libdir}/libspice-client-glib-%{glib_ver}.so
%if 0%{?suse_version} >= 1140
%verifyscript -n libspice-client-glib-%{pkg_glib_ver}-%{glib_so_ver}
%verify_permissions -e %{_libexecdir}/spice-client-glib-usb-acl-helper
%endif

%post -n libspice-client-glib-%{pkg_glib_ver}-%{glib_so_ver}
/sbin/ldconfig
%if 0%{?suse_version} >= 1140
%set_permissions %{_libexecdir}/spice-client-glib-usb-acl-helper
%else
%run_permissions
%endif

%postun -n libspice-client-glib-%{pkg_glib_ver}-%{glib_so_ver} -p /sbin/ldconfig

%post   -n libspice-client-gtk-%{pkg_gtk_ver}-%{gtk_so_ver} -p /sbin/ldconfig
%postun -n libspice-client-gtk-%{pkg_gtk_ver}-%{gtk_so_ver} -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by