From dd18540cee4eef71064966d5960bfdb94693cc56caa6bb973907d6a497ceffca Mon Sep 17 00:00:00 2001 From: Pascal Bleser Date: Fri, 24 Jul 2009 01:33:10 +0000 Subject: [PATCH] only build the Qt4 GUI subpackage on distributions that have a libqt4 that is recent enough OBS-URL: https://build.opensuse.org/package/show/devel:tools/ansifilter?expand=0&rev=3 --- ansifilter.spec | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/ansifilter.spec b/ansifilter.spec index 98e51dd..c415b79 100644 --- a/ansifilter.spec +++ b/ansifilter.spec @@ -1,5 +1,11 @@ # norootforbuild +%if 0%{?suse_version} > 1030 +%define with_gui 1 +%else +%define with_gui 0 +%endif + Name: ansifilter Version: 1.3 Release: 0 @@ -10,10 +16,13 @@ URL: http://www.andre-simon.de/ Group: Development/Tools/Other License: GNU General Public License version 2 (GPL v2) BuildRoot: %{_tmppath}/build-%{name}-%{version} -BuildRequires: libqt4-devel gcc-c++ libstdc++-devel pkgconfig +BuildRequires: gcc-c++ libstdc++-devel pkgconfig BuildRequires: gcc make glibc-devel BuildRequires: ImageMagick BuildRequires: update-desktop-files +%if %with_gui +BuildRequires: libqt4-devel +%endif %description Ansifilter handles text files containing ANSI terminal escape codes. @@ -27,6 +36,7 @@ Authors: -------- Andre Simon +%if %with_gui %package gui Summary: ANSI Terminal Escape Code Converter Group: Development/Tools/Other @@ -45,7 +55,7 @@ This package provides a Qt4 Graphical User Interface to run %{name}. Authors: -------- Andre Simon - +%endif %debug_package %prep @@ -59,7 +69,9 @@ convert src/qt-gui/ansifilter.{ico,png} man_dir="%{_mandir}/man1" \ doc_dir="%{_docdir}/%{name}" \ all \ +%if %with_gui all-gui +%endif %install %__make \ @@ -69,18 +81,22 @@ convert src/qt-gui/ansifilter.{ico,png} 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 %__rm -rf "%{buildroot}" @@ -92,11 +108,13 @@ done %{_bindir}/ansifilter %doc %{_mandir}/man1/ansifilter.1* +%if %with_gui %files gui %defattr(-,root,root) %{_bindir}/ansifilter-gui %{_datadir}/applications/ansifilter.desktop %{_datadir}/pixmaps/ansifilter.png +%endif %changelog * Fri Jul 24 2009 Pascal Bleser 1.3