Summary:        The GNU versions of grep pattern matching utilities.
Summary(ja):    GNU版 grep パターンマッチングユーティリティ
Name:           grep
Version:        3.7
Release:        1%{?_dist_release}
Group:          system,accessories
Vendor:         Project Vine
Distribution:   Vine Linux

License: GPLv3+
URL: http://www.gnu.org/software/grep/
Source: https://ftp.gnu.org/pub/gnu/grep/grep-%{version}.tar.xz
Source1: colorgrep.sh
Source2: colorgrep.csh
Source3: GREP_COLORS
Source1000: grep-3.7-ja.po
# upstream ticket 39445
Patch1: grep-3.33-help-align.patch

Buildroot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: pcre-devel >= 8.31
BuildRequires: texinfo, gettext, gzip
BuildRequires: autoconf, automake
Requires(post): install-info
Requires(preun): install-info

%description
The GNU versions of commonly used grep utilities.  Grep searches
through textual input for lines which contain a match to a specified
pattern and then prints the matching lines.  GNU's grep utilities
include grep, egrep and fgrep.

You should install grep on your system, because it is a very useful
utility for searching through text.

%description -l ja
一般に使われるgrepユーティリティのGNU版です。Grep は指定したパターンと一致
する行を入力ファイルから捜し出して、その行を表示します。GNUのgrepユーティリ
ティにはgrep, egrep, fgrepが入っています。

テキストファイルの検索や、システム管理にとても役に立つので、是非インストール
してください。 


%debug_package


%prep
%setup -q
%patch1 -p1 -b .help-align
cp -f %{SOURCE1000} po/ja.po

# workaround for glibc-bug
# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=50069
# https://sourceware.org/bugzilla/show_bug.cgi?id=11053
sed -i -e '/test-regex/d' -e '/test_regex/d' gnulib-tests/gnulib.mk
autoreconf -ivf


%build
%configure \
	--without-included-regex
%__make %{?_smp_mflags}
%__make -C po ja.gmo


%install
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT
%__make DESTDIR=$RPM_BUILD_ROOT install
gzip $RPM_BUILD_ROOT%{_infodir}/grep*
rm -f $RPM_BUILD_ROOT%{_infodir}/dir
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
install -pm 644 %{SOURCE1} %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/profile.d
install -pm 644 %{SOURCE3} $RPM_BUILD_ROOT%{_sysconfdir}
mkdir -p $RPM_BUILD_ROOT/bin
mv $RPM_BUILD_ROOT%{_prefix}/bin/* $RPM_BUILD_ROOT/bin/
rm -rf $RPM_BUILD_ROOT%{_bindir}

%find_lang %{name}


%check
make check


%clean
[ -n "$RPM_BUILD_ROOT" -a "$RPM_BUILD_ROOT" != / ] && rm -rf $RPM_BUILD_ROOT


%post
[ -e %{_infodir}/grep.info.gz ] && /sbin/install-info --quiet --info-dir=%{_infodir} %{_infodir}/grep.info.gz || :

%preun
if [ $1 = 0 ]; then
	[ -e %{_infodir}/grep.info.gz ] && /sbin/install-info --quiet --info-dir=%{_infodir} --delete %{_infodir}/grep.info.gz
fi


%files -f %{name}.lang
%defattr(-,root,root)
%license COPYING
%doc AUTHORS THANKS TODO NEWS README ChangeLog
/bin/*
%config(noreplace) %{_sysconfdir}/profile.d/colorgrep.*sh
%config(noreplace) %{_sysconfdir}/GREP_COLORS
%{_infodir}/*.info.gz
%{_mandir}/*/*


%changelog
* Mon Aug 16 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.7-1
- new upstream release.
- dropped Patch0: fixed in upstream.
- updated ja.po.

* Mon Feb 22 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.6-1
- new upstream release.

* Wed Mar 18 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 3.4-1
- new upstream release.
- updated patches.

* Mon Nov 09 2015 Yoji TOYODA <bsyamato@sea.plala.or.jp> 2.22-1
- updated to 2.22

* Mon Dec 22 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 2.21-1
- updated to 2.21
- dropt patch2 which was merged into upstream

* Wed Oct 24 2012 Daisuke SUZUKI <daisuke@linux.or.jp> 2.14-1
- update to 2.14
- build with pcre-8.31

* Thu Feb 10 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 2.7-1
- new upstream release
- drop unneeded old patches
- add BR: pcre-devel

* Mon Sep 29 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.5.1-60
- rebuilt against current toolchain
- fix license tag
- use CPPFLAGS= argument to configure to add an -I option.
- Do not set LDFLAGS=-s for "make install".

* Wed Sep 17 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 2.5.1-57
- rebuilt for VineSeed (previous version in VineSeed was 2.5.1-50 somehow)
  - Fri Aug 15 2008 Shu KONNO <owa@bg.wakwak.com> 2.5.1-50vl5
  - applied new versioning policy, spec in utf-8

* Tue Nov 13 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.5.1-57vl0.1
- rebuild for Vine Linux 4.x

* Tue Nov 13 2007 Daisuke SUZUKI <daisuke@linux.or.jp> 2.5.1-57vl1
- add Patch100 to fix infinite loop with 'grep -F'
  thanks to M.H (<BTS:484>)
- based on Fedora devel 2.5.1-57
  * Mon Jan 22 2007 Tim Waugh <twaugh@redhat.com> 2.5.1-57
  - Make preun scriptlet unconditionally succeed (bug #223697).
  * Wed Nov 22 2006 Tim Waugh <twaugh@redhat.com> 2.5.1-56
  - Fixed count of patterns when the last is an empty string (bug #204255).
  * Wed Nov 22 2006 Tim Waugh <twaugh@redhat.com> 2.5.1-55
  - Fix 'memory exhausted' errors by limiting in-memory buffer (bug #198165).
  * Wed Jul 12 2006 Jesse Keating <jkeating@redhat.com> - 2.5.1-54.1
  - rebuild
  * Wed May 31 2006 Tim Waugh <twaugh@redhat.com> 2.5.1-54
  - Applied upstream patch to fix '-D skip' (bug #189580).
  * Mon Feb 20 2006 Tim Waugh <twaugh@redhat.com> 2.5.1-53
  - Applied Tim Robbins' patch for 'grep -w' (bug #179698).
  * Fri Feb 10 2006 Jesse Keating <jkeating@redhat.com> - 2.5.1-52.2
  - bump again for double-long bug on ppc(64)
  * Tue Feb 07 2006 Jesse Keating <jkeating@redhat.com> - 2.5.1-52.1
  - rebuilt for new gcc4.1 snapshot and glibc changes
  * Fri Feb  3 2006 Tim Waugh <twaugh@redhat.com> 2.5.1-52
  - Prevent 'grep -P' from segfaulting (bug #171379).

* Sat Oct  7 2006 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.5.1-50vl2
- changed Group to System Environment/Base

* Tue Aug  2 2005 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.5.1-50vl1
- based on Fedora development 2.5.1-50
  * Tue Jun 28 2005 Tim Waugh <twaugh@redhat.com> 2.5.1-50
  - Futher fixing for bug #161700.
  * Mon Jun 27 2005 Tim Waugh <twaugh@redhat.com> 2.5.1-49
  - Fix 'grep -Fw' for encodings other than UTF-8 (bug #161700).
  * Wed Apr 13 2005 Tim Waugh <twaugh@redhat.com>
  - Build requires recent pcre-devel (bug #154626).
  * Fri Jan  7 2005 Tim Waugh <twaugh@redhat.com> 2.5.1-47
  - Run 'make check'.
  - Fixed -w handling for EGexecute.  Now 'make check' passes.
  - Cache MB_CUR_MAX value in egf-speedup patch.
  - Fixed variable shadowing in egf-speedup patch.
  - Removed redundant (and incorrect) code in prline.
  * Fri Jan  7 2005 Tim Waugh <twaugh@redhat.com> 2.5.1-46
  - More -w tests from Jakub Jelinek.
  - Rebased on 2.5.1a.
  * Fri Dec 31 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-45
  - More tests (Jakub Jelinek).
  - Jakub Jelinek's much improved -Fi algorithm.
  - Removed bogus part of grep-2.5.1-fgrep patch.
  * Tue Dec 21 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-44
  - Fixed -Fi for multibyte input (bug #143079).
  * Thu Dec 16 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-43
  - Bypass kwset matching when ignoring case and processing multibyte input
    (bug #143079).
  * Tue Dec 14 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-42
  - Further UTF-8 processing avoided since a '\n' byte is always an
    end-of-line character in that encoding.
  * Fri Dec  3 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-41
  - Fixed a busy loop in the egf-speedup patch (bug #140781).
  * Thu Nov 18 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-40
  - Fixed a bug in the fgrep patch, exposed by the dfa-optional patch
    (bug #138558).
  * Tue Nov 16 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-39
  - Fixed last patch.
  * Tue Nov 16 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-38
  - Applied patch from Karsten Hopp to fix background colour problems with
    --color output (bug #138913).
  * Wed Nov 10 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-37
  - Prevent false matches when DFA is disabled (bug #138558).
  * Mon Nov  8 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-36
  - Automatically disable DFA when processing multibyte input.  GREP_USE_DFA
    environment variable overrides.
  * Fri Nov  5 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-35
  - Fixes to egf-speedup patch: now it does not change any functionality,
    as intended.
  - GREP_NO_DFA now turns off the DFA engine, for performance testing.
  * Thu Nov  4 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-34
  - More improvements to egf-speedup patch (bug #138076).
  * Thu Nov  4 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-33
  - Small improvements to egf-speedup patch.
  * Wed Nov  3 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-32
  - Remove mb-caching hack.
  - Better multibyte handling in EGexecute() and Fexecute().
  - Don't need regex.c changes in grep-2.5-i18n.patch.
  * Wed Oct 13 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-31
  - Make 'grep -F' avoid UTF-8 processing if the pattern contains no
    multibyte characters (bug #133932).
  * Mon Oct 11 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-30
  - Applied patch from Robert Scheck to tidy spec file and add a URL
    tag (bug #135185).

* Sun Sep  5 2004 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.5.1-29vl1
- based on Fedora development 2.5.1-29
  * Fri Jun  4 2004 Tim Waugh <twaugh@redhat.com>
  - More build requirements (bug #125323).
  * Tue May 18 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-27
  - Fix dfa multibyte character class matching when -i is used (bug #123363).
  - Use bracket patch before i18n patch to make it clear that the bug exists
    upstream.
  * Thu Feb 26 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-26
  - Fix fgrep (bug #116909).
  * Mon Jan  5 2004 Tim Waugh <twaugh@redhat.com> 2.5.1-24
  - Work around glibc bug #112869 (segfault in re_compile_pattern).
  - Avoid patching Makefile.am, to avoid automake/autoconf weirdness.
  * Wed Dec 10 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-23
  - Another multibyte efficiency bug-fix (bug #111800).
  * Mon Dec  8 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-22
  - Fixed [:alpha:]-type character classes (bug #108484).
  - Fixed -o -i properly (bug #111489).
  * Sat Dec  6 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-21
  - Fixed 'fgrep -i' (bug #111614).
  * Fri Nov 21 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-20
  - Another two multibyte efficiency bug-fixes (bug #110524).
  * Thu Nov  6 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-19
  - Fixed a multibyte efficiency bug.
  * Thu Nov  6 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-18
  - Turn on multibyte efficiency patch again to shake out bugs.
  * Wed Oct  8 2003 Tim Waugh <twaugh@redhat.com>
  - Fixed man page bug (bug #106267).
  * Thu Sep 18 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-17
  - Use symlinks for egrep/fgrep, rather than shell script wrappers.
  * Fri Jun 27 2003 Tim Waugh <twaugh@redhat.com>
  - Fix debuginfo package.
  * Fri Jun 27 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-16
  - Finally give up on making grep go fast. :-(
  * Thu Jun 26 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-15
  - Fixed grep -i bug introduced by cache.
  * Mon Jun 23 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-14
  - Redo the gofast patch (bug #97785).
  * Thu Jun 12 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-13
  - Fixed a bug in the gofast patch (bug #97266).
  * Tue Jun 10 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-12
  - Go faster (bug #69900).
  - Fix man page.
  * Thu May 29 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-10
  - Use system regex again.
  * Thu May 29 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-9
  - Fixed bug in go-fast patch.
  * Wed May 28 2003 Tim Waugh <twaugh@redhat.com> 2.5.1-8
  - Go fast (bug #69900).
  - Run test suite.
- rebuild with new toolchains
- build with --disable-prel-regexp option

* Wed Feb 19 2003 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 2.5.1-7vl3
- based on Rawhide 2.5.1-7
  - Don't install /usr/share/info/dir.
  - Fix -o -i (bug #72641).
  - i18n patch.

* Sat Jul  6 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com>
- 2.5-0vl1
- update to 2.5
- change i18n patch

* Sun Jan 20 2002 Ryoichi INAGAKI <ryo1@bc.wakwak.com>
- 2.5-0vl1
- update to 2.5
- change i18n patch

* Sat Jan 20 2001 Lisa Sagami <czs14350@mb.infoweb.ne.jp>
- 2.4.2-4vl1
- usr better macros (%%configure/%%makeinstall)

* Mon Jun 19 2000 Jun Nishii <jun@vinelinux.org>
- 2.4-3vl1
- merge ja patch

* Thu Feb 03 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- gzip info pages (Bug #9035)

* Wed Feb 02 2000 Cristian Gafton <gafton@redhat.com>
- fix description

* Wed Dec 22 1999 Jeff Johnson <jbj@redhat.com>
- update to 2.4.

* Wed Oct 20 1999 Bill Nottingham <notting@redhat.com>
- prereq install-info

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 2)

* Mon Mar 08 1999 Preston Brown <pbrown@redhat.com>
- upgraded to grep 2.3, added install-info %post/%preun for info

* Wed Feb 24 1999 Preston Brown <pbrown@redhat.com>
- Injected new description and group.

* Sat May 09 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Fri May 01 1998 Cristian Gafton <gafton@redhat.com>
- updated to 2.2

* Thu Oct 16 1997 Donnie Barnes <djb@redhat.com>
- updated from 2.0 to 2.1
- spec file cleanups
- added BuildRoot

* Mon Jun 02 1997 Erik Troan <ewt@redhat.com>
- built against glibc
