File canfigger.spec of Package canfigger

#
# spec file for package canfigger
#
# 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 api   0.3
%define sover 0
%define sorel %(echo %{api} | tr . _)
%define libname lib%{name}-%{sorel}-%{sover}
%define devname lib%{name}-%{sorel}-devel

Name:           canfigger
Version:        0.3.0
Release:        0
Summary:        Simple configuration file parser library
License:        GPL-3.0-or-later
Group:          Development/Libraries/C and C++
URL:            https://github.com/andy5995/canfigger
Source:         https://github.com/andy5995/canfigger/releases/download/v%{version}/%{name}-%{version}.tar.xz
BuildRequires:  meson >= 0.48.0

%description
Canfigger is a lightweight C language library designed to parse configuration
files. It provides functionality to read them and represent their contents as
a linked list of key-value pairs, along with associated attributes for each
pair.

%package -n %{libname}
Summary:        Lightweight library for parsing configuration files
Group:          System/Libraries

%description -n %{libname}
Canfigger is a lightweight C language library designed to parse configuration
files. It provides functionality to read them and represent their contents as
a linked list of key-value pairs, along with associated attributes for each
pair.

This package contains the shared library for %{name}

%package -n %{devname}
Summary:        The development files for %{name}
Group:          Development/Libraries/C and C++
Requires:       %{libname} = %{version}

%description -n %{devname}
This package contains the development files for %{name}

%prep
%setup -q

%build
%meson \
	-Ddocdir=%{_docdir}/%{libname} \
%meson_build

%install
%meson_install

rm %{buildroot}%{_docdir}/%{libname}/LICENSE
rm -rf %{buildroot}%{_docdir}/%{libname}/html
cp example.c examplerc %{buildroot}%{_docdir}/%{libname}

%check
%meson_test

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

%files -n %{libname}
%defattr(-,root,root)
%license LICENSE
%doc README.md ChangeLog.txt ReleaseNotes.txt example.c examplerc
%{_libdir}/libcanfigger.so.*

%files -n %{devname}
%defattr(-,root,root)
%{_libdir}/libcanfigger.so
%{_libdir}/pkgconfig/canfigger.pc
%{_includedir}/canfigger.h

%changelog
openSUSE Build Service is sponsored by