%global tarver 2.1-3

%define pkg_name    CUnit
%define pkg_version 2.1.3
%define pkg_release 1%{?_dist_release}

Summary: Unit testing framework for C
Name:    %{pkg_name}
Version: %{pkg_version}
Release: %{pkg_release}

License: LGPLv2+
Group:   System Environment/Libraries
URL:     http://cunit.sourceforge.net/

Source0: http://downloads.sourceforge.net/cunit/%{name}-%{tarver}.tar.bz2


%description
CUnit is a lightweight system for writing, administering,
and running unit tests in C.  It provides C programmers a basic
testing functionality with a flexible variety of user interfaces.

%package devel
Summary:  Header files and libraries for CUnit development
Requires: %{name} = %{version}-%{release}

%description devel
The %{name}-devel package contains the header files
and libraries for use with CUnit package.


%prep
%setup -q -n %{name}-%{tarver}
find -name *.c -exec chmod -x {} \;

%build
autoreconf -f -i
%configure --disable-static
%{__make} %{?_smp_mflags}

%install
%{makeinstall}
%{__rm} -f `find %{buildroot} -name *.la`

# work around bad docdir= in doc/Makefile*
%{__mkdir_p} ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}
%{__mv} ${RPM_BUILD_ROOT}%{_prefix}/doc/%{name} \
 ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/html

# add some doc files into the buildroot manually (#1001276)
for f in AUTHORS ChangeLog COPYING NEWS README TODO VERSION ; do
    %{__install} -p -m0644 -D $f \
     ${RPM_BUILD_ROOT}%{_docdir}/%{name}-%{version}/${f}
done

%clean
%{__rm} -rf ${RPM_BUILD_ROOT}

%post -p %{_syssbindir}/ldconfig
%postun -p %{_syssbindir}/ldconfig


%files
%{_datadir}/%{name}/
%{_libdir}/libcunit.so.*
%dir %{_docdir}/%{name}-%{version}
%{_docdir}/%{name}-%{version}/AUTHORS
%{_docdir}/%{name}-%{version}/ChangeLog
%{_docdir}/%{name}-%{version}/COPYING
%{_docdir}/%{name}-%{version}/NEWS
%{_docdir}/%{name}-%{version}/README
%{_docdir}/%{name}-%{version}/TODO
%{_docdir}/%{name}-%{version}/VERSION

%files devel
%{_docdir}/%{name}-%{version}/html/
%{_includedir}/%{name}/
%{_libdir}/libcunit.so
%{_libdir}/pkgconfig/cunit.pc
%{_mandir}/man3/CUnit.3*


%changelog
* Tue Mar 12 2019 Toshiaki Ara <ara_t@384.jp> 2.1.3-1
- first release for Vine Linux
