File htop.spec of Package htop

#
# spec file for package htop
#
# Copyright (c) 2012-2014 Pascal Bleser <pascal.bleser@opensuse.org>
#
# 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/
#


Name:           htop
Version:        1.0.3
Release:        0
Summary:        Interactive Process Viewer for Linux
License:        GPL-2.0+
Group:          System/Monitoring
Url:            http://hisham.hm/htop/
Source0:        http://hisham.hm/htop/releases/1.0.3/htop-1.0.3.tar.gz
# PATCH-FIX-OPENSUSE htop-libtinfo.patch pascal.bleser@opensuse.org -- Adds linking -ltinfo on > 12.1 (part of ncurses, but only since then, needed for the function napms):
Patch0:         htop-libtinfo.patch
# PATCH-FIX-OPENSUSE htop-fix-incorrect-fsf-address.patch malcolmlewis@opensuse.org -- Update FSF Address in COPYING.
Patch1:         htop-fix-incorrect-fsf-address.patch
BuildRequires:  autoconf
BuildRequires:  automake
BuildRequires:  bison
BuildRequires:  flex
BuildRequires:  gcc
BuildRequires:  glibc-devel
BuildRequires:  libtool
# not actually needed, but to let the build fail if that package is not available:
BuildRequires:  lsof
BuildRequires:  make
BuildRequires:  python
Requires:       lsof
BuildRoot:      %{_tmppath}/%{name}-%{version}-build
%if 0%{?mdkversion} > 0
BuildRequires:  ncursesw-devel
%else
BuildRequires:  ncurses-devel
%endif
%if 0%{?suse_version}
BuildRequires:  update-desktop-files
%endif

%description
htop is an interactive process viewer for Linux. It aims to be a 'better top':
you can scroll the process list vertically and horizontally, and select a
process to be killed with the arrow keys instead of by typing its process id.

%prep
%setup -q -n "htop-%{version}"
# only apply patch1 on > 12.1, as it requires and causes autoreconf
# to run, which is rather fragile, and unnecessary on older dists anyway
%if 0%{?suse_version} > 1210
%patch0 -p1
autoreconf -fiv
%endif
%patch1 -p1

%build
%configure \
    --enable-taskstats \
%if 0%{?suse_version} == 0 || 0%{?suse_version} >= 1100
    --enable-unicode \
%endif
    --enable-openvz \
    --enable-vserver

make %{?_smp_mflags}

%install
make DESTDIR=%{buildroot} install %{?_smp_mflags}
%if 0%{?suse_version}
%suse_update_desktop_file -r "%{name}" System Monitor
%endif

%if 0%{?suse_version} == 0 || 0%{?suse_version} >= 1130
%post
%desktop_database_post
%endif

%if 0%{?suse_version} == 0 || 0%{?suse_version} >= 1130
%postun
%desktop_database_postun
%endif

%files
%defattr(-,root,root)
%doc AUTHORS COPYING NEWS README ChangeLog
%{_bindir}/htop
%{_datadir}/applications/%{name}.desktop
%{_mandir}/man1/htop.1%{?ext_man}
%{_datadir}/pixmaps/%{name}.png

%changelog
openSUSE Build Service is sponsored by