b0f8346
%bcond_without  gui
a6baf6c
a6baf6c
Name:           ansifilter
4e561c5
Version:        1.12
b0f8346
Release:        1%{?dist}
a6baf6c
Summary:        ANSI terminal escape code converter
a6baf6c
License:        GPLv3+
a6baf6c
URL:            http://www.andre-simon.de/doku/ansifilter/ansifilter.php
2798387
Source0:        http://www.andre-simon.de/zip/%{name}-%{version}.tar.bz2
b0f8346
%if %{with gui}
a6baf6c
Source1:        ansifilter.desktop
a6baf6c
Source2:        http://www.andre-simon.de/img/af_icon.png
a6baf6c
%endif
a6baf6c
a6baf6c
%description
b0f8346
Ansifilter handles text files containing ANSI terminal escape codes. The
b0f8346
command sequences may be stripped or be interpreted to generate formatted
a6baf6c
output (HTML, RTF, TeX, LaTeX, BBCode).
a6baf6c
b0f8346
%if %{with gui}
a6baf6c
%package        gui
a6baf6c
Summary:        GUI for %{name} based on Qt4
a6baf6c
BuildRequires:  desktop-file-utils
a6baf6c
BuildRequires:  qt4-devel
a6baf6c
a6baf6c
%description    gui
b0f8346
Ansifilter handles text files containing ANSI terminal escape codes. The
b0f8346
command sequences may be stripped or be interpreted to generate formatted
a6baf6c
output (HTML, RTF, TeX, LaTeX, BBCode).
a6baf6c
a6baf6c
This is a GUI of %{name} based on Qt4.
a6baf6c
%endif
a6baf6c
a6baf6c
%prep
a6baf6c
%setup -q
b0f8346
b0f8346
# Preserve timestamps.
b0f8346
sed -i 's|install -m|install -pm|g' makefile
b0f8346
b0f8346
%if %{with gui}
b0f8346
# Remove pre-configured files which may cause errors during building.
a6baf6c
rm -frv src/qt-gui/moc_*.cpp
b0f8346
rm -frv src/qt-gui/Makefile*
b0f8346
%endif
b0f8346
d29ace7
# CRLF quickfix
a6baf6c
find . -type f -exec sed -i 's/\r$//' {} + -print
a6baf6c
a6baf6c
%build
d29ace7
# Upstream embeds the cli code in gui so no need to require cli to use GUI
a6baf6c
# program, in order to achieve this we need to preserve the objects with -c.
514fd36
make CFLAGS+="%{optflags} -c" LDFLAGS="%{?__global_ldflags}" %{?_smp_mflags}
b0f8346
b0f8346
%if %{with gui}
a6baf6c
# %%_qt4_qmake will respect the redhat-rpm-config
a404062
make all-gui QMAKE="%{_qt4_qmake}" %{?_smp_mflags}
a6baf6c
%endif
a6baf6c
a6baf6c
%install
b0f8346
%make_install
a6baf6c
b0f8346
%if %{with gui}
b0f8346
make install-gui DESTDIR=%{buildroot}
a6baf6c
desktop-file-install --dir=%{buildroot}%{_datadir}/applications %{S:1}
a6baf6c
install -pDm644 %{S:2} %{buildroot}%{_datadir}/pixmaps/%{name}.png
a6baf6c
%endif
a6baf6c
b0f8346
# Use %%doc and %%license to handle docs.
0a89ff6
rm -frv %{buildroot}%{_docdir}
a6baf6c
a6baf6c
%files
b0f8346
%doc ChangeLog README
b0f8346
%license COPYING
a6baf6c
%{_bindir}/ansifilter
a6baf6c
%{_mandir}/man1/ansifilter.1*
a6baf6c
b0f8346
%if %{with gui}
a6baf6c
%files gui
b0f8346
%doc ChangeLog README
b0f8346
%license COPYING
a6baf6c
%{_bindir}/ansifilter-gui
a6baf6c
%{_datadir}/applications/%{name}.desktop
a6baf6c
%{_datadir}/pixmaps/%{name}.png
a6baf6c
%endif
a6baf6c
a6baf6c
%changelog
4e561c5
* Tue Mar 31 2015 Christopher Meng <rpm@cicku.me> - 1.12-1
4e561c5
- Update to 1.12
4e561c5
b0f8346
* Mon Feb 16 2015 Christopher Meng <rpm@cicku.me> - 1.11-1
b0f8346
- Update to 1.11
b0f8346
a6baf6c
* Thu Jun 26 2014 Christopher Meng <rpm@cicku.me> - 1.8-2
a6baf6c
- Correct the license.
a6baf6c
- desktop file added for gui program.
a6baf6c
a6baf6c
* Mon Apr 21 2014 Christopher Meng <rpm@cicku.me> - 1.8-1
a6baf6c
- Update to 1.8
a6baf6c
a6baf6c
* Tue Dec 31 2013 Christopher Meng <rpm@cicku.me> - 1.7-1
a6baf6c
- Initial Package.