ansifilter/ansifilter.spec

135 lines
3.6 KiB
RPMSpec

# vim: set ts=4 sw=4 et:
#
# spec file for package ansifilter
#
# Copyright (c) 2013 Pascal Bleser.
#
# 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 http://bugs.opensuse.org/
#
%if 0%{?suse_version} > 1030
%define with_gui 1
%else
%define with_gui 0
%endif
Name: ansifilter
Version: 1.7
Release: 0
Summary: ANSI Terminal Escape Code Converter
License: GPL-3.0
Group: Development/Tools/Other
Source: http://www.andre-simon.de/zip/ansifilter-%{version}.tar.bz2
Source1: ansifilter.desktop
Patch0: ansifilter-compiler_flags.patch
Url: http://www.andre-simon.de/
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: ImageMagick
BuildRequires: gcc
BuildRequires: gcc-c++
BuildRequires: glibc-devel
BuildRequires: libstdc++-devel
BuildRequires: make
BuildRequires: pkgconfig
BuildRequires: update-desktop-files
%if %with_gui
BuildRequires: libqt4-devel
%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).
%if %with_gui
%package gui
Summary: ANSI Terminal Escape Code Converter
Group: Development/Tools/Other
Requires: %{name} = %{version}-%{release}
%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).
This package provides a Qt4 Graphical User Interface to run %{name}.
%endif
%prep
%setup -q -n ansifilter
%patch0
convert src/qt-gui/ansifilter.{ico,png}
rm -rf src/.svn
%build
export RPM_OPT_FLAGS
%if %with_gui
moc -osrc/qt-gui/moc_mydialog.cpp src/qt-gui/mydialog.h
%endif
%__make %{?jobs:-j%{jobs}} \
CFLAGS="%{optflags}" \
QMAKE="%{_usr}/bin/qmake" \
PREFIX="%{_prefix}" \
man_dir="%{_mandir}/man1" \
doc_dir="%{_docdir}/%{name}" \
all \
%if %with_gui
all-gui
%endif
%install
%__make \
DESTDIR="%{buildroot}" \
QMAKE="%{_usr}/bin/qmake" \
PREFIX="%{_prefix}" \
man_dir="%{_mandir}/man1" \
doc_dir="%{_docdir}/%{name}" \
install \
%if %with_gui
install-gui
%endif
%__rm "%{buildroot}%{_docdir}/%{name}"/INSTALL
for f in "%{buildroot}%{_mandir}/man1"/*.gz; do
[ -e "$f" ] && %__gzip -d "$f"
done
%if %with_gui
%__install -D -m0644 "%{SOURCE1}" "%{buildroot}%{_datadir}/applications/ansifilter.desktop"
%__install -D -m0644 src/qt-gui/ansifilter.png "%{buildroot}%{_datadir}/pixmaps/ansifilter.png"
%__sed -i 's|^\(Icon=\).*$|\1ansifilter.png|g' "%{buildroot}%{_datadir}/applications/ansifilter.desktop"
%suse_update_desktop_file -r ansifilter Development Documentation
%endif
%clean
%{?buildroot:%__rm -rf "%{buildroot}"}
%files
%defattr(-,root,root)
%doc %dir %{_docdir}/%{name}
%doc %{_docdir}/%{name}/*
%{_bindir}/ansifilter
%doc %{_mandir}/man1/ansifilter.1%{ext_man}
%if %with_gui
%files gui
%defattr(-,root,root)
%{_bindir}/ansifilter-gui
%{_datadir}/applications/ansifilter.desktop
%{_datadir}/pixmaps/ansifilter.png
%endif
%changelog