# No tests: rpmbuild -ba --without dotests *.spec
%bcond_without dotests

Name: 		findutils
Version: 	4.8.0
Release: 	1
Group: 		System Environment/Base
License:	GPLv3+
URL:		http://www.gnu.org/software/findutils
Source0: 	http://ftp.gnu.org/pub/gnu/findutils/findutils-%{version}.tar.xz
Source1000:	%{name}-%{version}-%{release}.build.log

Summary:	The GNU versions of find utilities (find and xargs)

BuildRequires: texinfo
BuildRequires: gettext-devel

%description
The findutils package contains programs which will help you locate
files on your system.  The find utility searches through a hierarchy
of directories looking for files which match a certain set of criteria
(such as a filename pattern).  The xargs utility builds and executes
command lines from standard input arguments (usually lists of file
names generated by the find command).

You should install findutils because it includes tools that are very
useful for finding things on your system.

This package contains the find, xargs, updatedb, and locate tools.


%prep
%setup -q

%build

export AR="/usr/bin/ar -X32_64"
export CC="gcc -maix64"
export CFLAGS=$RPM_OPT_FLAGS

./configure \
    --prefix=%{_prefix}		\
    --infodir=%{_infodir}	\
    --mandir=%{_mandir}

make


%install
[ -d "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT

export AR="/usr/bin/ar -X32_64"

make DESTDIR=${RPM_BUILD_ROOT} install

cd $RPM_BUILD_ROOT%{_prefix}

# Strip all of the executables
/usr/bin/strip -X32_64 ${RPM_BUILD_ROOT}%{_bindir}/* 2>/dev/null || :

gzip -9fn ${RPM_BUILD_ROOT}/%{_infodir}/find.info*

%clean
[ "${RPM_BUILD_ROOT}" != "/" ] && rm -rf ${RPM_BUILD_ROOT}

%check
%if %{without dotests}
echo "*** Skipping tests"
exit 0
%endif # without dotests

(make -k check || true)

%post
/sbin/install-info %{_infodir}/find.info.gz %{_infodir}/dir || :
/sbin/install-info %{_infodir}/find-maint.info %{_infodir}/dir || :

cat << EOF

If you run 'updatedb' in cron, make sure to run it as user 'nobody'
instead of 'root'.

EOF

%preun
if [ $1 = 0 ] ; then
    /sbin/install-info --delete %{_infodir}/find.info.gz %{_infodir}/dir || :
    /sbin/install-info --delete %{_infodir}/find-maint.info %{_infodir}/dir || :
fi


%files
%defattr(-,root,system,-)
%doc COPYING NEWS AUTHORS README THANKS TODO
%{_bindir}/find
%{_bindir}/locate
%{_bindir}/updatedb
%{_bindir}/xargs
%{_libexecdir}/*
%{_mandir}/man1/find.1*
%{_mandir}/man1/locate.1*
%{_mandir}/man1/updatedb.1*
%{_mandir}/man1/xargs.1*
%{_mandir}/man5/locatedb.5*
%{_infodir}/find-maint*
%{_infodir}/find.info*
%{_datadir}/locale/*/LC_MESSAGES/findutils.mo


%changelog
* Thu May 20 2021 Clément Chigot <clement.chigot@atos.net> 4.8.0-1
- Update to version 4.8.0
- Rebuild in 64bit
- Rebuild with RPMv4
- Remove oldfind

* Wed Feb 01 2012 Gerard Visiedo <gerard.visiedo@bull.net> 4.4.2-3
- Initial port on Aix6.1


* Thu Sep 22 2011 Patricia Cugny <patricia.cugny@bull.net> 4.4.2-2
- rebuild for compatibility with new libiconv.a 1.13.1-2

* Wed Jun 1 2011 Gerard Visiedo <gerard.visiedo@bull.net>
- Update to 4.4.2

* Thu Jul 10 2003 David Clissold <cliss@austin.ibm.com>
- Switch to the IBM VAC compiler for performance and size.

* Fri Oct 27 2000 pkgmgr <pkgmgr@austin.ibm.com>
- Modify for AIX Freeware distribution

* Wed Feb 02 2000 Cristian Gafton <gafton@redhat.com>
- fix summary
- ma  pages are compressed

* Wed Jan 12 2000 Preston Brown <pbrown@redhat.com>
- new description.
