File libusbredir.spec of Package libusbredir

%define realname usbredir
%define srcext   tar.bz2

%define so_ver   1

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

# Common info
Name:          lib%{realname}%{?so_ver}
Version:       0.11.0
Release:       %{?extraver:0.}1%{?dist}
License:       GPL-2.0 and LGPL-2.1
Group:         System/Libraries
URL:           http://www.spice-space.org/page/UsbRedir
Summary:       USB Network Redirection protocol

# Install-time parameters
Provides:      %{realname}
Provides:      libusbredirhost%{?so_ver} = %{version}-%{release}
Provides:      libusbredirparser%{?so_ver} = %{version}-%{release}
Obsoletes:     libusbredirhost%{?so_ver} < %{version}-%{release}
Obsoletes:     libusbredirparser%{?so_ver} < %{version}-%{release}

# Build-time parameters
BuildRequires: meson >= 0.53 ninja
BuildRequires: pkg-config
# usbredirhost
BuildRequires: pkgconfig(libusb-1.0) >= 1.0.22
# tools
BuildRequires: pkgconfig(glib-2.0) >= 2.44
BuildRequires: pkgconfig(gio-unix-2.0) >= 2.44
BuildRoot:     %{_tmppath}/%{name}-root
Source:        http://spice-space.org/download/usbredir/%{realname}-%{version}%{?extraver}.%{srcext}

%description
usbredir is a protocol for redirection USB traffic from a single USB device,
to a different (virtual) machine then the one to which the USB device is
attached. See usb-redirection-protocol.txt for the description / definition
of this protocol.

%package -n lib%{realname}-devel
Group:         Development/Languages/C and C++
Summary:       Development files for %{name}
Requires:      %{name} = %{version}
Provides:      %{name}-devel

%description -n lib%{realname}-devel
Development files for %{name}

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

%build
_CFLAGS='%{optflags}'
_LDFLAGS='-Wl,--strip-all -Wl,-z,noexecstack -Wl,-z,now -Wl,-z,relro'
meson setup build \
 --buildtype=release \
 --strip \
 \
 --prefix=%{_prefix} \
 --libexecdir=%{_libexecdir} \
 --default-library=shared \
 \
 -Db_lto=true \
 -Db_ndebug=if-release \
 -Dc_args="$_CFLAGS" \
 -Dc_link_args="$_LDFLAGS"
ninja -v -C build %{?_smp_mflags}

%install
DESTDIR=%{buildroot} ninja -C build install

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

%files
%defattr(-,root,root)
%license COPYING COPYING.LIB
%doc ChangeLog.md README.md
%{_bindir}/usbredirect
%{_sbindir}/usbredirserver
%{_libdir}/*.so.%{?so_ver}*
%doc %{_mandir}/man1/usbredirect.1*
%doc %{_mandir}/man1/usbredirserver.1*

# Development stuff
%files -n lib%{realname}-devel
%defattr(-,root,root)
%license COPYING.LIB
%doc docs/*.md
%{_libdir}/pkgconfig/*.pc
%{_includedir}/*.h
%{_libdir}/*.so

%post   -p /sbin/ldconfig
%postun -p /sbin/ldconfig

%changelog
openSUSE Build Service is sponsored by