%ifos linux
%define _bindir /bin
%endif

Summary: A GNU stream text editor.
Summary(ja): GNU ストリームテキストエディタ
Name: sed
Version: 4.2.1
Release: 2%{?_dist_release}
License: GPLv2+
Group: Applications/Text
Source0: ftp://ftp.gnu.org/pub/gnu/sed/sed-%{version}.tar.bz2
Patch0: sed-4.2.1-dummyparam.diff
Patch1: sed-4.2.1-multibyte.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: glibc-devel
BuildRequires: libacl-devel
Requires(post,preun): /sbin/install-info

%description
The sed (Stream EDitor) editor is a stream or batch (non-interactive)
editor.  Sed takes text as input, performs an operation or set of
operations on the text and outputs the modified text.  The operations
that sed performs (substitutions, deletions, insertions, etc.) can be
specified in a script file or from the command line.

%description -l ja
sed (Stream Editor) エディタはストリームまたはバッチ(非インタラクティブ)
エディタです。sed は入力としてテキストを用い、テキストの操作または
操作のセットをテキストとに対して行い、修正されたテキストを出力します。
sed が行う操作 (置換、削除、挿入、その他) はスクリプトファイルか、
コマンドラインから指定されます。

%prep
%setup -q
%patch0 -p1
%patch1 -p1 -b .mb

%build
export LANG=C 
%configure --without-included-regex
make %{_smp_mflags}

echo ====================TESTING=========================
make check
echo ====================TESTING END=====================

%install
rm -rf $RPM_BUILD_ROOT

%makeinstall
rm -f $RPM_BUILD_ROOT/%{_infodir}/dir

%find_lang %{name}

%post
/sbin/install-info %{_infodir}/sed.info.gz %{_infodir}/dir

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

%clean
rm -rf ${RPM_BUILD_ROOT}

%files -f %{name}.lang
%defattr(-,root,root)
%doc BUGS NEWS THANKS README AUTHORS
%{_bindir}/sed
%{_infodir}/*.info*
%{_mandir}/man*/*

%changelog
* Mon Dec 14 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.2.1-2
- added Patch1 from Debian (#551075)
  Apply patch from WANG Yunfeng to treat incomplete multibyte 
  sequences as a single-byte character.

* Mon Nov 30 2009 Ryoichi INAGAKI <ryo1@bc.wakwak.com> - 4.2.1-1
- new upstream release, dropped Patch1 and 2
- added Patch0 from Fedora
  * Mon Jun 29 2009  Jiri Moskovcak <jmoskovc@redhat.com> 
  - added patch to maintain backwards compatibility for scripts using -c/--copy
  - Resolves: #502934

* Mon Sep 29 2008 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 4.1.5-3
- rebuilt against current toolchain
- spec in UTF-8

* Sun Apr 20 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.1.5-2vl5
- dropped Patch0

* Sat Apr 19 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.1.5-1vl5
- added Patch0-2 from Fedora
  * Mon Sep  4 2006 Petr Machata <pmachata@redhat.com> - 4.1.5-5
  - Fix handling of relative symlinks (#205122)
  * Wed Aug  3 2006 Petr Machata <pmachata@redhat.com> - 4.1.5-4
  - remove superfluous multibyte processing in str_append for UTF-8
    encoding (thanks Paolo Bonzini, #177246)
  * Thu Jun 29 2006 Petr Machata <pmachata@redhat.com> - 4.1.5-2
  - #185374:
    - Follow symlinks before rename (avoid symlink overwrite)
    - Add -c flag for copy instead of rename (avoid ownership change)

* Sat Aug 25 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 4.1.5-0vl1
- new upstream release
- run 'make check' on non-English locale

* Thu Mar 09 2006 Shu KONNO <owa@bg.wakwak.com> 4.1.2-0vl2
- s/Copyright/License/
- rebuilt for x86_64 architecture support

* Wed Oct 13 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 4.1.2-0vl1
- new upstream release

* Thu Jun 17 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 4.1-0vl1
- new upstream release
- remove obsolete patch

* Sat Apr 12 2004 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 4.0.8-4vl2
- rebuilt for Vine
  * Wed Jan  7 2004 Jakub Jelinek <jakub@redhat.com> 4.0.8-3
  - if not -n, print current buffer after N command on the last line
    unless POSIXLY_CORRECT (#112952)
  - adjust XFAIL_TESTS for the improved glibc regex implementation
    (#112642)

  * Fri Nov 14 2003 Jakub Jelinek <jakub@redhat.com> 4.0.8-2
  - enable --without-included-regex again
  - use fastmap for regex searching

  * Sat Oct 25 2003 Florian La Roche <Florian.LaRoche@redhat.de>
  - update to 4.0.8
  - simplify specfile
  - disable --without-included-regex to pass the testsuite

  * Sat Apr 12 2003 Florian La Roche <Florian.LaRoche@redhat.de>
  - update to 4.0.7
  - use "--without-included-regex"
  - do not gzip info pages in spec file, "TODO" is not present anymore

  * Thu Jan 23 2003 Jakub Jelinek <jakub@redhat.com> 4.0.5-1
  - update to 4.0.5

  * Tue Oct 22 2002 Jakub Jelinek <jakub@redhat.com>
  - rebuilt to fix x86-64 miscompilation
  - run make check in %%build

  * Fri Apr  5 2002 Jakub Jelinek <jakub@redhat.com>
  - Remove stale URLs from documentation (#62519)

  * Sun Jun 24 2001 Elliot Lee <sopwith@redhat.com>
  - Bump release + rebuild.

  * Mon Dec 18 2000 Yukihiro Nakai <ynakai@redhat.com>
  - Update to 2000.11.28 patch
  - Rebuild for 7.1 tree

  * Mon Jun  5 2000 Jeff Johnson <jbj@redhat.com>
  - FHS packaging.

  * Mon Feb  7 2000 Jeff Johnson <jbj@redhat.com>
  - compress man pages.

  * Tue Jan 18 2000 Jakub Jelinek <jakub@redhat.com>
  - rebuild with glibc 2.1.3 to fix an mmap64 bug in sys/mman.h

* Sat Oct 06 2001 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 3.02_mb1.09-0vl1
- mb patch updated to 1.09

* Tue May 29 2001 <sagami@vinelinux.org>
- 3.02_mb1.08-1vl2: use better macros

* Fri Sep 08 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 3.02_mb1.08-1vl1
- modified %files section to handle compressed man page(s)

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

* Tue Aug 18 1998 Jeff Johnson <jbj@redhat.com>
- update to 3.02

* Sun Jul 26 1998 Jeff Johnson <jbj@redhat.com>
- update to 3.01

* Mon Apr 27 1998 Prospector System <bugs@redhat.com>
- translations modified for de, fr, tr

* Thu Oct 23 1997 Donnie Barnes <djb@redhat.com>
- removed references to the -g option from the man page that we add

* Fri Oct 17 1997 Donnie Barnes <djb@redhat.com>
- spec file cleanups
- added BuildRoot

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