File rtpmidid.spec of Package rtpmidid

#
# spec file for package rtpmidi
#
# Copyright (c) 2024 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         soversion 0
Name:           rtpmidid
Version:        23.12
Release:        0
Summary:        Real Time Protocol Musical Instrument Digital Interface Daemon
License:        GPL-3.0-or-later and LGPL 2.1+
URL:            https://github.com/davidmoreno/rtpmidid
Source0:        %{name}-%{version}.tar.xz
BuildRequires:  gcc-c++
BuildRequires:  cmake
BuildRequires:  ninja
BuildRequires:  pkgconfig
BuildRequires:  pkgconfig(avahi-client)
BuildRequires:  pkgconfig(fmt)
BuildRequires:  pkgconfig(alsa)
BuildRequires:  pandoc

# Requires:

%description
rtpmidid allows you to share ALSA sequencer devices on the network using
RTP MIDI, and import other network shared RTP MIDI devices.

rtpmidid is an user daemon, and when a RTP MIDI device is announced using
mDNS (also known as Zeroconf, Avahi, and multicast DNS) it exposes this ALSA
sequencer port.

%package        librtpmidid%{soversion}
Summary:        shared library for %{name}
Requires:       %{name} = %{version}

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

%package        %{name}-devel
Summary:        static library for %{name}
Requires:       %{name} = %{version}

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

%prep
%autosetup

%build
make build
make man

%install
mkdir -p %{buildroot}%{_bindir}
cp build/src/%{name}       %{buildroot}%{_bindir}/
cp cli/%{name}-cli.py      %{buildroot}%{_bindir}/%{name}-cli

mkdir -p %{buildroot}%{_unitdir}
cp debian/%{name}.service  %{buildroot}%{_unitdir}/

mkdir -p %{buildroot}/etc/%{name}/
cp default.ini              %{buildroot}/etc/%{name}/

mkdir -p %{buildroot}%{_libdir}
cp -a build/lib/lib*so*     %{buildroot}%{_libdir}/

mkdir -p %{buildroot}/usr/share/man/man1/
cp build/man/%{name}.1     %{buildroot}%{_mandir}/man1/
cp build/man/%{name}-cli.1 %{buildroot}%{_mandir}/man1/

mkdir -p %{buildroot}%{_includedir}/
cp -a build/lib/lib*.a      %{buildroot}%{_libdir}/
cp -a include/%{name}      %{buildroot}%{_includedir}/

find %{buildroot} -type f -name "*.la" -delete -print

%pre
%service_add_pre %{name}.service

%post -p /sbin/ldconfig
%service_add_post %{name}.service

%preun
%service_del_preun %{name}.service

%postun -p /sbin/ldconfig
%service_del_postun %{name}.service


%test

%files
%license LICENSE.md
%license LICENSE-daemon.txt
%doc README.md
%dir /etc/%{name}
%config /etc/%{name}/default.ini
%{_bindir}/*
%{_mandir}/*
%{_unitdir}/*

%files librtpmidid%{soversion}
%license LICENSE-lib.txt
%doc README.md README.librtpmidid.md
%{_libdir}/*.so*

%files %{name}-devel
%license LICENSE-lib.txt
%doc README.md README.librtpmidid.md
%{_includedir}/*
%{_libdir}/*.a

%changelog
openSUSE Build Service is sponsored by