File librist.spec of Package librist

#
# spec file for package librist
#
# Copyright (c) 2022 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


%define sover   4
%define libname %{name}%{sover}
Name:           librist
Version:        0.2.7
Release:        0
Summary:        Easily add the RIST protocol to your application
License:        BSD-2-Clause
URL:            https://code.videolan.org/rist/librist
Source0:        https://code.videolan.org/rist/librist/-/archive/v%{version}/librist-v%{version}.tar.gz
Group:          Development/Libraries/C and C++
BuildRequires:  meson >= 0.47
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  chrpath
#Requires:       

%description
A library that can be used to easily add the RIST protocol to your application.

%package        -n %{libname}
Summary:        Development files for %{name}
Group:          System/Libraries

%description    -n %{libname}
A library that can be used to easily add the RIST protocol to your application.

%package        devel
Summary:        Development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{libname} = %{version}

%description    devel
The %{name}-devel package contains libraries and header files for
developing applications that use %{name}.

%prep
%setup -q -n %{name}-v%{version}

%build
mkdir build
pushd build
meson ..
ninja
popd

%install
mkdir -p %{buildroot}%{_bindir}
mv  build/tools/rist2rist %{buildroot}%{_bindir}
mv  build/tools/ristreceiver %{buildroot}%{_bindir}
mv build/tools/ristsender %{buildroot}%{_bindir}
mv build/tools/ristsrppasswd %{buildroot}%{_bindir}
chrpath --delete %{buildroot}%{_bindir}/rist2rist
chrpath --delete %{buildroot}%{_bindir}/ristreceiver
chrpath --delete %{buildroot}%{_bindir}/ristsender
chrpath --delete %{buildroot}%{_bindir}/ristsrppasswd
mkdir -p %{buildroot}%{_libdir}
mv build/librist.so %{buildroot}%{_libdir}
mv build/librist.so.4 %{buildroot}%{_libdir}
mv build/librist.so.4.2.0 %{buildroot}%{_libdir}
mkdir -p %{buildroot}%{_includedir}
chmod -x include/librist/*
mv include/librist %{buildroot}%{_includedir}
cp -r build/include/librist %{buildroot}%{_includedir}
mkdir -p %{buildroot}%{_libdir}/pkgconfig
mv build/meson-private/librist.pc %{buildroot}%{_libdir}/pkgconfig
sed -i -e 's|{prefix}\/lib|{prefix}\/lib64|g' %{buildroot}%{_libdir}/pkgconfig/librist.pc
sed -i -e 's|{prefix}\/include|{prefix}\/include\/librist|g' %{buildroot}%{_libdir}/pkgconfig/librist.pc
chmod -x docs/*

%post -n %{libname} -p /sbin/ldconfig
%postun -n %{libname} -p /sbin/ldconfig

%files -n %{libname}
%license COPYING
%doc README.md
%doc docs
%{_bindir}/rist*
%{_libdir}/*.so.*

%files devel
%doc CONTRIBUTING.md
%{_includedir}/*
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc

%changelog
openSUSE Build Service is sponsored by