Blob Blame History Raw
%bcond_without  gui

Name:           ansifilter
Version:        1.16
Release:        1%{?dist}
Summary:        ANSI terminal escape code converter
License:        GPLv3+
URL:            http://www.andre-simon.de/doku/ansifilter/ansifilter.php
Source0:        http://www.andre-simon.de/zip/%{name}-%{version}.tar.bz2
%if %{with gui}
Source1:        ansifilter.desktop
Source2:        http://www.andre-simon.de/img/af_icon.png
%endif

%description
Ansifilter handles text files containing ANSI terminal escape codes. The
command sequences may be stripped or be interpreted to generate formatted
output (HTML, RTF, TeX, LaTeX, BBCode).

%if %{with gui}
%package        gui
Summary:        GUI for %{name} based on Qt4
BuildRequires:  desktop-file-utils
BuildRequires:  qt5-qtbase-devel

%description    gui
Ansifilter handles text files containing ANSI terminal escape codes. The
command sequences may be stripped or be interpreted to generate formatted
output (HTML, RTF, TeX, LaTeX, BBCode).

This is a GUI of %{name} based on Qt4.
%endif

%prep
%setup -q

# Preserve timestamps.
sed -i 's|install -m|install -pm|g' makefile

%if %{with gui}
# Remove pre-configured files which may cause errors during building.
rm -frv src/qt-gui/moc_*.cpp
rm -frv src/qt-gui/Makefile*
%endif

# CRLF quickfix
find . -type f -exec sed -i 's/\r$//' {} + -print

%build
# Upstream embeds the cli code in gui so no need to require cli to use GUI
# program, in order to achieve this we need to preserve the objects with -c.
%make_build CFLAGS+="%{optflags} -c" LDFLAGS="%{?__global_ldflags}"

%if %{with gui}
# %%_qt5_qmake will respect the redhat-rpm-config
%make_build all-gui QMAKE="%{_qt5_qmake}"
%endif

%install
%make_install

%if %{with gui}
make install-gui DESTDIR=%{buildroot}
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:1}
install -pDm644 %{S:2} %{buildroot}%{_datadir}/pixmaps/%{name}.png
%endif

# Use %%doc and %%license to handle docs.
rm -frv %{buildroot}%{_docdir}

%files
%doc ChangeLog README
%license COPYING
%{_bindir}/ansifilter
%{_mandir}/man1/ansifilter.1*

%if %{with gui}
%files gui
%doc ChangeLog README
%license COPYING
%{_bindir}/ansifilter-gui
%{_datadir}/applications/%{name}.desktop
%{_datadir}/pixmaps/%{name}.png
%endif

%changelog
* Wed May 18 2016 Filipe Rosset <rosset.filipe@gmail.com> - 1.16-1
- Updated to new 1.16 upstream version, build against qt5 instead of qt4

* Wed Feb 03 2016 Fedora Release Engineering <releng@fedoraproject.org> - 1.12-4
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Tue Jun 16 2015 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.12-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_23_Mass_Rebuild

* Sat May 02 2015 Kalev Lember <kalevlember@gmail.com> - 1.12-2
- Rebuilt for GCC 5 C++11 ABI change

* Tue Mar 31 2015 Christopher Meng <rpm@cicku.me> - 1.12-1
- Update to 1.12

* Mon Feb 16 2015 Christopher Meng <rpm@cicku.me> - 1.11-1
- Update to 1.11

* Fri Aug 15 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 1.8-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_22_Mass_Rebuild

* Thu Jun 26 2014 Christopher Meng <rpm@cicku.me> - 1.8-2
- Correct the license.
- desktop file added for gui program.

* Mon Apr 21 2014 Christopher Meng <rpm@cicku.me> - 1.8-1
- Update to 1.8

* Tue Dec 31 2013 Christopher Meng <rpm@cicku.me> - 1.7-1
- Initial Package.