File bcunit.spec of Package bcunit

#
# spec file for package bcunit
#
# Copyright (c) 2023 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 soname  libbcunit
%define sover   1
Name:           bcunit
Version:        5.3.5
# Fedora release look standard from OpenSUSE build service:
# Release:      <CI_CNT>.<B_CNT>
# Release:      %%{?release_prefix}.<CI_CNT>.<B_CNT>
# where rpm macro %%{release_prefix} is defined in spec file
# Normally it looks like:
# Release:      63.fc38 for Fedora packages which is scripted as:
# Release:      0%%{?dist}
# OpenSUSE build service allows for this variant:
# Release:      63.1.fc38
# Release:       <CI_CNT>.<B_CNT>%%{?dist}
#
# Add this to Project Config to tag Fedora packages with fcXX:
# ------------------------------
# # reset release name
# onepercentage%%if 0onepercentage%%{?fedora_version}
# Release: <CI_CNT>.<B_CNT> spec:<CI_CNT>.<B_CNT>twopercentage%%{?dist}
# onepercentage%%endif
# ------------------------------
Release:        0
Summary:        Provide C programmers basic testing functionality
License:        LGPL-2.0-or-later
URL:            https://linphone.org/
#Source:         https://gitlab.linphone.org/BC/public/bcunit/-/archive/%%{version}/%%{name}-%%{version}.tar.bz2
Source:         %{name}-%{version}.tar.bz2
Source99:       baselibs.conf
# PATCH-FIX-OPENSUSE bcunit-link-ncurses.patch jengelh@medozas.de
Patch0:         bcunit-link-ncurses.patch
# PATCH-FIX-OPENSUSE bcunit-ncurses6.patch idonmez@suse.com -- Compile with ncurses6.
Patch1:         bcunit-ncurses6.patch
# PATCH-FIX-OPENSUSE bcunit-sover.patch sor.alexei@meowr.ru -- Correctly set the sover.
Patch2:         bcunit-sover.patch
# PATCH-FIX-UPSTREAM
Patch3:         set_current_version.patch
#BuildRequires:  cmake >= 3.22
BuildRequires:  cmake
BuildRequires:  git-core >= 1.7.10
BuildRequires:  ncurses-devel
BuildRequires:  pkgconfig

%description
BCUnit is a unit testing framework for C, derived from CUnit.
(B)CUnit provides various interfaces to the framework, some of which
are platform dependent (e.g. curses on *nix). The framework complies
with the conventional structure of test cases bundled into suites
which are registered with the framework for running.

%package devel
Summary:        BCUnit development files
%if 0%{?sle_version} == 150500 && 0%{?is_opensuse}
Group:          Development/Libraries/C and C++
%endif
%if 0%{?sle_version} == 150600 && 0%{?is_opensuse}
Group:          Development/Libraries/C and C++
%endif
Requires:       %{soname}%{sover} = %{version}
Requires:       ncurses-devel
Recommends:     %{name}-doc = %{version}

%description devel
BCUnit is a unit testing framework for C.
This package installs the BCUnit development files.

%package doc
Summary:        BCUnit documentation
Requires:       %{soname}%{sover} = %{version}

%description doc
BCUnit is a unit testing framework for C.
This package installs the BCUnit documentation files.

%package -n %{soname}%{sover}
Summary:        BCUnit shared library

%description  -n %{soname}%{sover}
BCUnit is a unit testing framework for C.
This package installs the BCUnit shared library.

%prep
%autosetup -p1

%build
%cmake \
  -DENABLE_STATIC=OFF \
  -DENABLE_BCUNIT_CURSES=ON \
  -DENABLE_BCUNIT_DOC=ON
%cmake_build

%install
%cmake_install

mkdir -p %{buildroot}%{_libdir}/BCUnit/

%post -n %{soname}%{sover} -p /sbin/ldconfig
%postun -n %{soname}%{sover} -p /sbin/ldconfig

%files -n %{soname}%{sover}
%doc AUTHORS ChangeLog NEWS README.md TODO
%license COPYING
%{_libdir}/%{soname}.so.%{sover}*

%files doc
%dir %{_datadir}/BCUnit/
%{_datadir}/BCUnit/*dtd
%{_datadir}/BCUnit/*xsl
#%%dir %%{_datadir}/doc/BCUnit/
#%%doc %%{_datadir}/doc/BCUnit/*
#%%doc %%{_datadir}/BCUnit/*
%{_mandir}/man3/BCUnit.3%{?ext_man}

%files devel
%{_includedir}/BCUnit/
%dir %{_datadir}/BCUnit/
%{_libdir}/BCUnit/
%{_libdir}/%{soname}.so
%{_libdir}/pkgconfig/bcunit.pc
%dir %{_datadir}/BCUnit/cmake
%{_datadir}/BCUnit/cmake/*

%changelog
openSUSE Build Service is sponsored by