File cxxtest.spec of Package cxxtest

#
# spec file for package cxxtest
#
# Copyright (c) 2021 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/
#


Name:           cxxtest
Version:        4.4
Release:        0
Summary:        A JUnit-like testing framework for C++
License:        LGPL-3.0-only
Group:          Development/Tools/Other
URL:            http://cxxtest.com
Source0:        http://downloads.sourceforge.net/%{name}/%{name}-%{version}.tar.gz
BuildRequires:  asciidoc >= 8.5.0
BuildRequires:  python-devel
Recommends:     %{name}-devel
BuildArch:      noarch

%description
CxxTest is a unit testing framework for C++ that is similar in spirit to
JUnit, CppUnit, and xUnit. CxxTest is easy to use because it does not require
precompiling a CxxTest testing library, it employs no advanced features of
C++ (e.g. RTTI) and it supports a very flexible form of test discovery.

%package devel
Summary:        Headers of CxxTest
Group:          Development/Languages/C and C++
Requires:       %{name} = %{version}-%{release}

%description devel
This package contains the headers needed for developing tests with cxxtest.

%package doc
Summary:        Documentation on how to use CxxTest
Group:          Documentation/HTML
Requires:       %{name} = %{version}-%{release}

%description doc
This package contains the documentation on how to use CxxTest.
It also provides code examples.

%prep
%setup -q
#remove Windows-related stuff
rm -rf sample/msvc/
rm -f sample/Makefile.bcc32

find . "(" -name ".gitignore" -o -name ".cvsignore" ")" -delete

%build
cd python
CFLAGS="%{optflags}" python setup.py build

# create pkgconfig file
cd ..
cat <<EOF >%{name}.pc
prefix=%{_prefix}
exec_prefix=%{_prefix}
includedir=%{_includedir}/%{name}

Name:           %{name}
Description: A JUnit-like testing framework for C++
Version:        %{version}
Cflags: -I\${includedir}
EOF

cd doc

# script to create asciidoc file for manpage of cxxtestgen
cat <<EOF >create_manpage.py
import sys
if sys.version_info < (3,0):
	sys.path.insert(0, '../python')
else:
	sys.path.insert(0, '../python/python3')
import cxxtest
cxxtest.create_manpage()
EOF

# create manpage
python create_manpage.py
a2x -f manpage cxxtestgen.1.txt

# build documentation in HTML (requires asciidoc >= 8.5.0)
make %{?_smp_mflags} html

%install
mkdir -p %{buildroot}%{_includedir}/cxxtest
install -D -p -m 644 cxxtest/* %{buildroot}%{_includedir}/cxxtest
install -D -p -m 644 %{name}.pc %{buildroot}%{_datadir}/pkgconfig/%{name}.pc
cd python
python setup.py install --skip-build --root %{buildroot}

%if 0%{?fedora} < 19 || 0%{?rhel} == 6
# add symlink present in previous release of cxxtest
ln -s %{_bindir}/cxxtestgen %{buildroot}%{_bindir}/cxxtestgen.py
%endif

cd ..
install -D -p -m 644 doc/cxxtestgen.1 %{buildroot}%{_mandir}/man1/cxxtestgen.1

%files
%license COPYING
%doc README Versions
%{_bindir}/cxxtestgen*
%{_mandir}/man1/cxxtestgen.1%{?ext_man}
%{python2_sitelib}/%{name}/
%{python2_sitelib}/%{name}-*.egg-info

%files devel
%license COPYING
%{_includedir}/%{name}/
%{_datadir}/pkgconfig/%{name}.pc

%files doc
%doc doc/guide.html doc/images/
%doc sample/

%changelog
openSUSE Build Service is sponsored by