Name:           perl-Term-ReadLine-Gnu
Version:        1.26
Release:        1%{?_dist_release}
Summary:        Perl extension for the GNU Readline/History Library
Summary(ja):    GNU Readline/History ライブラリのための Perl 拡張
License:        GPL+ or Artistic
Group:          Development/Libraries
URL:            http://search.cpan.org/dist/Term-ReadLine-Gnu/
Source0:        http://www.cpan.org/authors/id/H/HA/HAYASHI/Term-ReadLine-Gnu-%{version}.tar.gz

BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires:  expect
BuildRequires:  ncurses-devel
BuildRequires:  perl(ExtUtils::MakeMaker)
BuildRequires:  readline-devel >= 2.1
Requires:       perl(:MODULE_COMPAT_%(eval "`%{__perl} -V:version`"; echo $version))

%description
An implementation of Term::ReadLine using the GNU Readline/History Library.

%prep
%setup -q -n Term-ReadLine-Gnu-%{version}

%build
# Fix permissions and shebang paths at one shot
find . -type f -exec chmod 0664 '{}' \; \
       -exec sed 's,^#! */usr/local,#!%{_prefix},' -i '{}' \;
%{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS"
make %{?_smp_mflags}


%install
rm -rf $RPM_BUILD_ROOT

make pure_install PERL_INSTALL_ROOT=$RPM_BUILD_ROOT

find $RPM_BUILD_ROOT -type f -name .packlist -exec rm -f {} \;
find $RPM_BUILD_ROOT -type f -name '*.bs' -size 0 -exec rm -f {} \;
find $RPM_BUILD_ROOT -depth -type d -exec rmdir {} 2>/dev/null \;

%{_fixperms} $RPM_BUILD_ROOT

%check
# Expect is used so that we get a PTY, as if we were
# in a real terminal, where readline works
expect -c '
	spawn make test
	expect eof
	exit [lindex [wait] 3]
'

%clean
rm -rf $RPM_BUILD_ROOT


%files
%defattr(-,root,root,-)
%doc README
%{_bindir}/perlsh
%{perl_vendorarch}/auto/*
%{perl_vendorarch}/Term*
%{_mandir}/man1/perlsh.1*
%{_mandir}/man3/*


%changelog
* Sun Mar 22 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.26-1
- new upstream release
- built with readline 6.3

* Fri Dec 19 2014 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 1.24-1
- updated to 1.24
- dropt Patch0
- built with perl 5.16.3

* Sat Apr 30 2011 Yoji TOYODA <bsyamato@sea.plala.or.jp> 1.17a-2
- rebuild with perl-5.12.3

* Sun Aug 24 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 1.17a-1
- initial build for Vine Linux

* Wed Jul 02 2008 Lubomir Rintel (Good Data) <lubo.rintel@gooddata.com> 1.17a-4
- Remote the workaround introduced in previous change
- Disable Visual Bell test

* Tue Jul 01 2008 Lubomir Rintel (Good Data) <lubo.rintel@gooddata.com> 1.17a-3
- Patch around rt#56500 perl bug hoping for better tomorrows

* Sat Jun 28 2008 Lubomir Rintel (Good Data) <lubo.rintel@gooddata.com> 1.17a-2
- Tun the test suite with a pseudo-terminal

* Fri Jun 27 2008 Lubomir Rintel (Good Data) <lubo.rintel@gooddata.com> 1.17a-1
- Specfile autogenerated by cpanspec 1.75.
