-%define snap 20111124
-%define rel 1
+# TODO
+# - switch pidof to this package instead of sysvinit-tools:
+# 3.3.9 contains pidof reimplemented from scratch (replacing sysvinit pidof)
+# sysvinit compatibility was fixed in 3.3.12: https://gitlab.com/procps-ng/procps/issues/4
+
+# Conditional build:
+%bcond_without systemd # systemd support
+%bcond_with elogind # elogind support (instead of systemd)
+%bcond_with pidof # include pidof here [see also SysVinit.spec:SysVinit-tools
+%bcond_with selinux # libselinux support (get ps context values from dynamically loaded libselinux.so.1 instead of /proc/*/attr/current)
+%bcond_with tests # run tests. The testsuite is unsuitable for running on buildsystems
+
+%if %{with elogind}
+%undefine with_systemd
+%endif
Summary: Utilities for monitoring your system and processes on your system
Summary(de.UTF-8): Utilities zum Ueberwachen Ihres Systems und der Prozesse
Summary(es.UTF-8): Utilitarios de monitoración de procesos
Summary(pt_BR.UTF-8): Utilitários de monitoração de processos
Summary(tr.UTF-8): Süreç izleme araçları
Name: procps
-Version: 3.2.8
-Release: 1.%{snap}.%{rel}
+Version: 4.0.4
+Release: 1
Epoch: 1
-License: GPL
+License: GPL v2+
Group: Applications/System
-Source0: http://gitorious.org/procps/procps/archive-tarball/master#/%{name}-%{snap}.tar.gz
-# Source0-md5: 01acfb2f9a2d832c95d9abbedbdbe3ce
-Source1: http://atos.wmid.amu.edu.pl/~undefine/%{name}-non-english-man-pages.tar.bz2
+Source0: https://downloads.sourceforge.net/procps-ng/%{name}-ng-%{version}.tar.xz
+# Source0-md5: 2f747fc7df8ccf402d03e375c565cf96
+Source1: %{name}-non-english-man-pages.tar.bz2
# Source1-md5: 60d24720b76c10553ed4abf68b76e079
Source2: top.desktop
Source3: top.png
+# Source3-md5: 5f0133b3c18000116ca48381eecc07af
Source4: XConsole.sh
-Patch2: %{name}-FILLBUG_backport.patch
-# http://www.nsa.gov/selinux/patches/procps-selinux.patch.gz
-Patch3: %{name}-selinux.patch
-URL: http://gitorious.org/procps/
+
+Patch1: %{name}-FILLBUG_backport.patch
+Patch2: %{name}-pl.po-update.patch
+URL: https://gitlab.com/procps-ng/procps
+BuildRequires: autoconf >= 2.69
+BuildRequires: automake >= 1:1.11
+%{?with_tests:BuildRequires: dejagnu}
+%{?with_elogind:BuildRequires: elogind-devel}
+BuildRequires: gettext-tools >= 0.14.1
+%{?with_selinux:BuildRequires: libselinux-devel}
+BuildRequires: libtool >= 2:2
BuildRequires: ncurses-devel >= 5.1
+BuildRequires: pkgconfig
BuildRequires: rpmbuild(macros) >= 1.402
-Requires(post): /sbin/ldconfig
+BuildRequires: sed >= 4.0
+%{?with_systemd:BuildRequires: systemd-devel >= 1:254}
+BuildRequires: tar >= 1:1.22
+BuildRequires: xz
+Requires: /sbin/ldconfig
Requires: fileutils
-Obsoletes: procps-X11
+%{?with_systemd:Requires: systemd-libs >= 1:254}
+Obsoletes: procps-X11 < 2.0.2
BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
%description
Statyczna wersja biblioteki libproc.
%prep
-%setup -q -n %{name}-%{name}
+%setup -q -n %{name}-ng-%{version}
+%patch1 -p1
%patch2 -p1
-%patch3 -p1
-sed -i -e "s#usrbin_execdir=.*#usrbin_execdir='\${bindir}'#g" configure.ac
+%{__sed} -i -e "s#usrbin_execdir=.*#usrbin_execdir='\${bindir}'#g" configure.ac
%build
+%{__gettextize}
%{__libtoolize}
-%{__aclocal}
+%{__aclocal} -I m4
%{__autoconf}
%{__autoheader}
%{__automake}
%configure \
- CPPFLAGS="-I%{_includedir}/ncurses" \
+ --disable-silent-rules \
+ %{?with_elogind:--with-elogind} \
+ %{?with_systemd:--with-systemd} \
+ --disable-kill \
+ %{?with_selinux:--enable-libselinux} \
+ %{!?with_pidof:--disable-pidof} \
+ --enable-sigwinch \
+ --enable-skill \
+ --enable-w-from \
+ --enable-watch8bit \
+ --enable-wide-percent \
--sbindir=/sbin
%{__make}
+%if %{with tests}
+%{__make} check
+%endif
+
%install
rm -rf $RPM_BUILD_ROOT
install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},/%{_lib},/bin}
-
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT \
pkgconfigdir=%{_pkgconfigdir}
-mv $RPM_BUILD_ROOT%{_bindir}/ps $RPM_BUILD_ROOT/bin/ps
-mv $RPM_BUILD_ROOT%{_libdir}/libproc-ng-*.so $RPM_BUILD_ROOT/%{_lib}
-ln -snf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/libproc-ng-*.so) \
- $RPM_BUILD_ROOT%{_libdir}/libproc-ng.so
-ln -snf libproc-ng.so $RPM_BUILD_ROOT%{_libdir}/libproc.so
-ln -snf libproc-ng.a $RPM_BUILD_ROOT%{_libdir}/libproc.a
-
-install %{SOURCE2} $RPM_BUILD_ROOT%{_desktopdir}
-install %{SOURCE3} $RPM_BUILD_ROOT%{_pixmapsdir}
-install %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}/XConsole
-
-# PLD: kill is packaged in util-linux
-%{__rm} $RPM_BUILD_ROOT%{_bindir}/kill
-%{__rm} $RPM_BUILD_ROOT%{_mandir}/man1/kill.1
-# PLD: packaged in rc-scripts
-%{__rm} $RPM_BUILD_ROOT%{_sysconfdir}/sysctl.conf
+# identical programs are built independently, not hard- or symlinked:
+ln -f $RPM_BUILD_ROOT%{_bindir}/{pkill,pgrep}
+ln -f $RPM_BUILD_ROOT%{_bindir}/{snice,skill}
+
+%{__mv} $RPM_BUILD_ROOT{%{_bindir},/bin}/ps
+%if %{with pidof}
+%{__mv} $RPM_BUILD_ROOT{%{_bindir},/bin}/pidof
+%endif
+
+install -d $RPM_BUILD_ROOT/%{_lib}
+%{__mv} $RPM_BUILD_ROOT{%{_libdir}/libproc2.so.*,/%{_lib}}
+ln -sf /%{_lib}/$(basename $RPM_BUILD_ROOT/%{_lib}/libproc2.so.*.*.*) \
+ $RPM_BUILD_ROOT%{_libdir}/libproc2.so
+
+cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_desktopdir}
+cp -p %{SOURCE3} $RPM_BUILD_ROOT%{_pixmapsdir}
+install -p %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}/XConsole
+
# obsoleted by pkg-config
-%{__rm} $RPM_BUILD_ROOT%{_libdir}/libproc-ng.la
+%{__rm} $RPM_BUILD_ROOT%{_libdir}/libproc2.la
# packaged as doc
%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/procps-ng
%{__rm} $RPM_BUILD_ROOT%{_mandir}/*/man1/{kill,oldps}.1
%{__rm} $RPM_BUILD_ROOT%{_mandir}/README-procps-non-english-man-pages
+%find_lang procps-ng
+
%clean
rm -rf $RPM_BUILD_ROOT
%post -p /sbin/ldconfig
%postun -p /sbin/ldconfig
-%files
+%files -f procps-ng.lang
%defattr(644,root,root,755)
-%doc AUTHORS BUGS FAQ NEWS README README.top TODO
-%attr(755,root,root) /%{_lib}/libproc-ng-3.3.0.so
+%doc AUTHORS doc/{FAQ,TODO,bugs.md} NEWS
+%attr(755,root,root) /%{_lib}/libproc2.so.*.*
+%ghost %attr(755,root,root) /%{_lib}/libproc2.so.0
%attr(755,root,root) /bin/ps
+%if %{with pidof}
+%attr(755,root,root) /bin/pidof
+%endif
%attr(755,root,root) /sbin/sysctl
%attr(755,root,root) %{_bindir}/XConsole
%attr(755,root,root) %{_bindir}/free
%attr(755,root,root) %{_bindir}/pgrep
%attr(755,root,root) %{_bindir}/pkill
%attr(755,root,root) %{_bindir}/pmap
+%attr(755,root,root) %{_bindir}/pidwait
%attr(755,root,root) %{_bindir}/pwdx
%attr(755,root,root) %{_bindir}/skill
%attr(755,root,root) %{_bindir}/slabtop
%{_desktopdir}/top.desktop
%{_pixmapsdir}/top.png
%{_mandir}/man1/free.1*
+%if %{with pidof}
+%{_mandir}/man1/pidof.1*
+%endif
%{_mandir}/man1/pgrep.1*
%{_mandir}/man1/pkill.1*
%{_mandir}/man1/pmap.1*
%{_mandir}/man1/ps.1*
+%{_mandir}/man1/pidwait.1*
%{_mandir}/man1/pwdx.1*
%{_mandir}/man1/skill.1*
%{_mandir}/man1/slabtop.1*
%lang(ko) %{_mandir}/ko/man[158]/*
%lang(nl) %{_mandir}/nl/man[158]/*
%lang(pl) %{_mandir}/pl/man[158]/*
+%lang(pt_BR) %{_mandir}/pt_BR/man[158]/*
+%lang(ro) %{_mandir}/ro/man[158]/*
+%lang(sv) %{_mandir}/sv/man[158]/*
+%lang(uk) %{_mandir}/uk/man[158]/*
%files devel
%defattr(644,root,root,755)
-%attr(755,root,root) %{_libdir}/libproc.so
-%attr(755,root,root) %{_libdir}/libproc-ng.so
-%{_includedir}/proc
-%{_pkgconfigdir}/libproc-ng.pc
+%attr(755,root,root) %{_libdir}/libproc2.so
+%{_includedir}/libproc2
+%{_pkgconfigdir}/libproc2.pc
+%{_mandir}/man3/procps.3*
+%{_mandir}/man3/procps_misc.3*
+%{_mandir}/man3/procps_pids.3*
+%lang(pl) %{_mandir}/pl/man3/procps.3*
+%lang(pl) %{_mandir}/pl/man3/procps_misc.3*
+%lang(pl) %{_mandir}/pl/man3/procps_pids.3*
+%lang(ro) %{_mandir}/ro/man3/procps.3*
+%lang(ro) %{_mandir}/ro/man3/procps_misc.3*
+%lang(ro) %{_mandir}/ro/man3/procps_pids.3*
+%lang(sv) %{_mandir}/sv/man3/procps.3*
+%lang(sv) %{_mandir}/sv/man3/procps_misc.3*
+%lang(sv) %{_mandir}/sv/man3/procps_pids.3*
+%lang(uk) %{_mandir}/uk/man3/procps.3*
+%lang(uk) %{_mandir}/uk/man3/procps_misc.3*
+%lang(uk) %{_mandir}/uk/man3/procps_pids.3*
%files static
%defattr(644,root,root,755)
-%{_libdir}/libproc.a
-%{_libdir}/libproc-ng.a
+%{_libdir}/libproc2.a