%global xapian_core_support OFF

Summary: Generate documentation from source code
Name:    doxygen
Epoch:   1
Version: 1.8.14
Release: 8
License: GPL+
Url:     http://www.doxygen.nl
Source0: https://sourceforge.net/projects/%{name}/files/rel-%{version}/%{name}-%{version}.src.tar.gz
Source1: doxywizard.png
Source2: doxywizard.desktop

BuildRequires: gcc-c++ gcc perl-interpreter
%if ! 0%{?_module_build}
BuildRequires: tex(dvips) tex(latex) tex(multirow.sty) tex(sectsty.sty) tex(tocloft.sty)
BuildRequires: tex(xtab.sty) tex(import.sty) tex(tabu.sty) tex(appendix.sty)
BuildRequires: tex(adjustbox.sty) /usr/bin/epstopdf texlive-epstopdf
BuildRequires: ghostscript gettext desktop-file-utils graphviz
%else
BuildRequires: zlib-devel
%endif
BuildRequires: flex bison cmake
%if %{xapian_core_support} == "ON"
BuildRequires: xapian-core-devel zlib-devel
%endif
Requires: perl-interpreter

%description
Doxygen is the de facto standard tool for generating documentation from
annotated C++ sources, but it also supports other popular programming
languages such as C, Objective-C, C#, PHP, Java, Python, IDL (Corba,
Microsoft, and UNO/OpenOffice flavors), Fortran, VHDL, Tcl, and to some
extent D.

%if ! 0%{?_module_build}
%package doxywizard
Summary: A GUI for creating and editing configuration files
Requires: %{name} = %{epoch}:%{version}-%{release}
BuildRequires: qt5-qtbase-devel

%description doxywizard
Doxywizard is a graphical front-end to read/edit/write doxygen
configuration files.

%package latex
Summary: Support for producing latex/pdf output from doxygen
Requires: %{name} = %{epoch}:%{version}-%{release}
Requires: tex(latex) tex(multirow.sty) tex(sectsty.sty) tex(tocloft.sty)
Requires: tex(xtab.sty) tex(import.sty) tex(tabu.sty) tex(appendix.sty)
Requires: texlive-epstopdf-bin

%description latex
%{summary}.
%endif

%package_help


%prep
%autosetup -p1

iconv --from=ISO-8859-1 --to=UTF-8 LANGUAGE.HOWTO > LANGUAGE.HOWTO.tmp
touch -r LANGUAGE.HOWTO LANGUAGE.HOWTO.tmp
mv LANGUAGE.HOWTO.tmp LANGUAGE.HOWTO

%build
install -d %{_target_platform}
pushd %{_target_platform}
%cmake \
      -DPYTHON_EXECUTABLE=%{_bindir}/python3 \
      -Dbuild_xmlparser=ON \
%if ! 0%{?_module_build}
      -Dbuild_doc=ON \
      -Dbuild_wizard=ON \
      -Dbuild_search=%{xapian_core_support} \
%else
      -Dbuild_doc=OFF \
      -Dbuild_wizard=OFF \
      -Dbuild_search=OFF \
%endif
      -DMAN_INSTALL_DIR=%{_mandir}/man1 \
      -DCMAKE_INSTALL_PREFIX:PATH=%{_prefix} \
      -DBUILD_SHARED_LIBS=OFF \
      ..
popd

%if ! 0%{?_module_build}
make docs %{?_smp_mflags} -C %{_target_platform}
%else
install -d *-redhat-linux-gnu/latex
touch *-redhat-linux-gnu/latex/doxygen_manual.pdf
%endif
%make_build -C %{_target_platform}

%install
%make_install -C %{_target_platform}
find %{_target_platform}/html -name struct*.pdf| xargs sed -i 's/<[0-9,A-F]\{32\}>/<011CC110A540190DBC7FD31B2A2E03B4>/g'

install -pDm 644 %{SOURCE1} %{buildroot}%{_datadir}/pixmaps/doxywizard.png

install -d %{buildroot}/%{_mandir}/man1
cp doc/*.1 %{buildroot}/%{_mandir}/man1/

%if ! 0%{?_module_build}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{SOURCE2}
%endif

%files
%if ! 0%{?_module_build}
%if %{xapian_core_support} == "ON"
%{_bindir}/doxyindexer
%{_bindir}/doxysearch*
%endif
%endif
%{_bindir}/%{name}

%if ! 0%{?_module_build}
%files doxywizard
%{_bindir}/doxywizard
%{_datadir}/applications/doxywizard.desktop
%endif
%{_datadir}/pixmaps/doxywizard.png

%if ! 0%{?_module_build}
%files latex
%endif

%files help
%doc LANGUAGE.HOWTO README.md
%if ! 0%{?_module_build}
%doc %{_target_platform}/latex/doxygen_manual.pdf
%doc %{_target_platform}/html
%endif
%exclude %{_docdir}/packages
%{_mandir}/man1/%{name}.1*
%if %{xapian_core_support} == "ON"
%{_mandir}/man1/doxyindexer.1*
%{_mandir}/man1/doxysearch.1*
%else
%exclude %{_mandir}/man1/doxyindexer.1*
%exclude %{_mandir}/man1/doxysearch.1*
%endif
%if ! 0%{?_module_build}
%{_mandir}/man1/doxywizard*
%else
%exclude %{_mandir}/man1/doxywizard.1*
%endif

%changelog
* Tue Dec 10 2019 mengxian <mengxian@huawei.com> - 1:1.8.14-8
- Package init

* Mon May 6 2019 fanmenggang <fanmenggang@huawei.com> - 1:1.8.14-7.h1
- Type:bugfix
- ID:NA
- SUG:NA
- DESC:Eliminate PDF file Differences
