Blob Blame History Raw
# Sphinx-generated HTML documentation is not suitable for packaging; see
# for discussion.
# We can generate PDF documentation as a substitute.
%bcond_without doc_pdf

%global debug_package %{nil}

%global common_description %{expand:
Termcolor is a header-only C++ library for printing colored messages to the
terminal. Written just for fun with a help of the Force.

Termcolor uses ANSI color formatting, so you can use it on every system that is
used such terminals (most *nix systems, including Linux and Mac OS).}

Name:           termcolor
Version:        2.0.0
Release:        %autorelease
Summary:        Header-only C++ library for printing colored messages to the terminal

License:        BSD
Source0:        %{url}/archive/refs/tags/v%{version}.tar.gz
Patch0:         0001-Use-GNUInstallDirs-for-install-targets.patch

BuildRequires:  gcc-c++
BuildRequires:  cmake

%if %{with doc_pdf}
BuildRequires:  make
BuildRequires:  python3-devel
BuildRequires:  python3dist(sphinx)
BuildRequires:  python3-sphinx-latex
BuildRequires:  latexmk

%description %{common_description}

%package devel
Summary:        %{summary}
Provides:       %{name}-static = %{version}-%{release}
Requires:  cmake-filesystem

%description devel %{common_description}

%package        doc
Summary:        Documentation and examples for %{name}
BuildArch:      noarch

%description    doc %{common_description}

%autosetup -p1


%if %{with doc_pdf}
sphinx-build -b latex docs %{_vpath_builddir}/_latex
%make_build -C %{_vpath_builddir}/_latex LATEXMKOPTS='-quiet'


# test_termcolor is a visual test
# It should show colors, but mock will show without colors.

%files devel
%license LICENSE
%doc README.rst

%files doc
%license LICENSE
%doc README.rst
%doc examples
%if %{with doc_pdf}
%doc %{_vpath_builddir}/_latex/termcolor.pdf