+# 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.7
-Release: 4
+Version: 4.0.4
+Release: 1
Epoch: 1
-License: GPL
+License: GPL v2+
Group: Applications/System
-Source0: http://procps.sourceforge.net/%{name}-%{version}.tar.gz
-# Source0-md5: f490bca772b16472962c7b9f23b1e97d
-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
-Patch0: %{name}-make.patch
-Patch1: %{name}-global.patch
-Patch2: %{name}-FILLBUG_backport.patch
-# http://www.nsa.gov/selinux/patches/procps-selinux.patch.gz
-Patch3: %{name}-selinux.patch
-URL: http://procps.sourceforge.net/
+
+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
-%patch0 -p1
+%setup -q -n %{name}-ng-%{version}
+
%patch1 -p1
%patch2 -p1
-%patch3 -p1
+
+%{__sed} -i -e "s#usrbin_execdir=.*#usrbin_execdir='\${bindir}'#g" configure.ac
%build
-%{__make} proc/libproc.a \
- CC="%{__cc}" \
- ALL_CFLAGS="%{rpmcflags} -Wall -ffast-math" \
- LDFLAGS="%{rpmldflags}" \
- SHARED=0
-mv -f proc/libproc.a .
-%{__make} clean
-
-%{__make} \
- CURSES="-lncurses -ltinfo" \
- CC="%{__cc}" \
- ALL_CFLAGS="%{rpmcflags} -Wall -ffast-math" \
- LDFLAGS="%{rpmldflags}"
+%{__gettextize}
+%{__libtoolize}
+%{__aclocal} -I m4
+%{__autoconf}
+%{__autoheader}
+%{__automake}
+%configure \
+ --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{%{_includedir}/proc,%{_libdir},%{_desktopdir},%{_pixmapsdir}}
-
+install -d $RPM_BUILD_ROOT{%{_desktopdir},%{_pixmapsdir},/%{_lib},/bin}
%{__make} install \
DESTDIR=$RPM_BUILD_ROOT \
- lib64=%{_lib} \
- install="install -D" \
- ldconfig=true
+ pkgconfigdir=%{_pkgconfigdir}
+
+# 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}
-ln -sf /%{_lib}/libproc-%{version}.so \
- $RPM_BUILD_ROOT%{_libdir}/libproc.so
+%{__mv} $RPM_BUILD_ROOT{%{_bindir},/bin}/ps
+%if %{with pidof}
+%{__mv} $RPM_BUILD_ROOT{%{_bindir},/bin}/pidof
+%endif
-install libproc.a $RPM_BUILD_ROOT%{_libdir}
-install proc/*.h $RPM_BUILD_ROOT%{_includedir}/proc
-install %{SOURCE2} $RPM_BUILD_ROOT%{_desktopdir}
-install %{SOURCE3} $RPM_BUILD_ROOT%{_pixmapsdir}
-install %{SOURCE4} $RPM_BUILD_ROOT%{_bindir}/XConsole
+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
-rm -f $RPM_BUILD_ROOT/bin/kill
-rm -f $RPM_BUILD_ROOT%{_mandir}/man1/{kill,oldps}.1
-rm -f $RPM_BUILD_ROOT%{_bindir}/{oldps,kill}
+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}/libproc2.la
+# packaged as doc
+%{__rm} -r $RPM_BUILD_ROOT%{_docdir}/procps-ng
bzcat -dc %{SOURCE1} | tar xf - -C $RPM_BUILD_ROOT%{_mandir}
-rm -f $RPM_BUILD_ROOT%{_mandir}/*/man1/{kill,oldps}.1
-rm -f $RPM_BUILD_ROOT%{_mandir}/README-procps-non-english-man-pages
+%{__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 NEWS BUGS TODO
-%attr(755,root,root) /%{_lib}/libproc*.*so
-%attr(755,root,root) /bin/*
+%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}/*
+%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
+%attr(755,root,root) %{_bindir}/snice
+%attr(755,root,root) %{_bindir}/tload
+%attr(755,root,root) %{_bindir}/top
+%attr(755,root,root) %{_bindir}/uptime
+%attr(755,root,root) %{_bindir}/vmstat
+%attr(755,root,root) %{_bindir}/w
+%attr(755,root,root) %{_bindir}/watch
%{_desktopdir}/top.desktop
%{_pixmapsdir}/top.png
-%{_mandir}/man*/*
-%lang(cs) %{_mandir}/cs/man*/*
-%lang(de) %{_mandir}/de/man*/*
-%lang(es) %{_mandir}/es/man*/*
-%lang(fi) %{_mandir}/fi/man*/*
-%lang(fr) %{_mandir}/fr/man*/*
-%lang(hu) %{_mandir}/hu/man*/*
-%lang(it) %{_mandir}/it/man*/*
-%lang(ja) %{_mandir}/ja/man*/*
-%lang(ko) %{_mandir}/ko/man*/*
-%lang(nl) %{_mandir}/nl/man*/*
-%lang(pl) %{_mandir}/pl/man*/*
+%{_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*
+%{_mandir}/man1/snice.1*
+%{_mandir}/man1/tload.1*
+%{_mandir}/man1/top.1*
+%{_mandir}/man1/uptime.1*
+%{_mandir}/man1/w.1*
+%{_mandir}/man1/watch.1*
+%{_mandir}/man5/sysctl.conf.5*
+%{_mandir}/man8/sysctl.8*
+%{_mandir}/man8/vmstat.8*
+%lang(cs) %{_mandir}/cs/man[158]/*
+%lang(de) %{_mandir}/de/man[158]/*
+%lang(es) %{_mandir}/es/man[158]/*
+%lang(fi) %{_mandir}/fi/man[158]/*
+%lang(fr) %{_mandir}/fr/man[158]/*
+%lang(hu) %{_mandir}/hu/man[158]/*
+%lang(it) %{_mandir}/it/man[158]/*
+%lang(ja) %{_mandir}/ja/man[158]/*
+%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
-%{_includedir}/proc
+%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}/libproc2.a