Summary: A library for editing typed in command lines.
Summary(ja): Readline ライブラリ
Name: readline
Version: 8.1.2
%global shortver %(echo %{version} | cut -d . -f 1-2)
%global shortver_nodots %(echo %{shortver} | tr -d ".")
Release: 1%{?_dist_release}
Group: system
Vendor: Project Vine
Distribution: Vine Linux

License: GPLv3+
URL: http://tiswww.tis.case.edu/~chet/readline/rltop.html
%global baseurl https://ftp.gnu.org/gnu/readline
Source: %{baseurl}/readline-%{shortver}.tar.gz

# upstream patches
Patch1: %{baseurl}/readline-%{shortver}-patches/readline%{shortver_nodots}-001
Patch2: %{baseurl}/readline-%{shortver}-patches/readline%{shortver_nodots}-002

# fix file permissions, remove RPATH, use CFLAGS
Patch100: readline-8.0-shlib.patch

Buildroot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildRequires: sed
BuildRequires: ncurses-devel
Requires(post): /sbin/install-info
Requires(preun): /sbin/install-info

%define build_compat32 %{?_with_compat32:1}%{!?_with_compat32:0}

%description
The Readline library provides a set of functions that allow users to
edit command lines. Both Emacs and vi editing modes are available. The
Readline library includes additional functions for maintaining a list
of previously-entered command lines for recalling or editing those
lines, and for performing csh-like history expansion on previous
commands.

%description -l ja
Readline ライブラリは、ユーザーがコマンドラインを編集する機能を提供します。
Emacs と vi の編集モードが利用可能です。Readline ライブラリはさらに、
これまで入力されたコマンドライン履歴を保持し、再利用する機能も備えています。


%package devel
Summary: Files needed to develop programs which use the readline library.
Summary(ja): Readline ライブラリを使うプログラムための開発用ライブラリ
Group: programming
Requires: readline = %{version}
Requires: ncurses-devel

%description devel
The Readline library provides a set of functions that allow users to
edit typed command lines. If you want to develop programs that will
use the readline library, you need to have the readline-devel package
installed. You also need to have the readline package installed.


%package -n compat32-%{name}
Summary: A library for editing typed in command lines.
Summary(ja): Readline ライブラリ
Group: system
Requires: %{name} = %{version}-%{release}

%description -n compat32-%{name}
The Readline library provides a set of functions that allow users to
edit command lines. Both Emacs and vi editing modes are available. The
Readline library includes additional functions for maintaining a list
of previously-entered command lines for recalling or editing those
lines, and for performing csh-like history expansion on previous
commands.

%description -n compat32-%{name} -l ja
Readline ライブラリは、ユーザーがコマンドラインを編集する機能を提供します。
Emacs と vi の編集モードが利用可能です。Readline ライブラリはさらに、
これまで入力されたコマンドライン履歴を保持し、再利用する機能も備えています。


%package -n compat32-%{name}-devel
Summary: Files needed to develop programs which use the readline library.
Summary(ja): Readline ライブラリを使うプログラムための開発用ライブラリ
Group: programming
Requires: %{name} = %{version}-%{release}
Requires: %{name}-devel = %{version}-%{release}
Requires: compat32-ncurses-devel

%description -n compat32-%{name}-devel
The Readline library provides a set of functions that allow users to
edit typed command lines. If you want to develop programs that will
use the readline library, you need to have the readline-devel package
installed. You also need to have the readline package installed.


%debug_package


%prep
%setup -q -n %{name}-%{shortver}
# upstream patches
%patch1 -p0 -b .001
%patch2 -p0 -b .002

%patch100 -p1 -b .shlib


%build
%configure --with-curses --disable-install-examples
make %{?_smp_mflags}


%install
[ "${RPM_BUILD_ROOT}" != "/" ] && %__rm -rf ${RPM_BUILD_ROOT}
mkdir -p ${RPM_BUILD_ROOT}%{_libdir}

make DESTDIR=$RPM_BUILD_ROOT install

mkdir $RPM_BUILD_ROOT/%{_lib}
mv $RPM_BUILD_ROOT%{_libdir}/libreadline.so.* $RPM_BUILD_ROOT/%{_lib}
for l in $RPM_BUILD_ROOT%{_libdir}/libreadline.so; do
    ln -sf $(echo %{_libdir} | \
     sed 's,\(^/\|\)[^/][^/]*,..,g')/%{_lib}/$(readlink $l) $l
done

rm -rf $RPM_BUILD_ROOT%{_docdir}/readline
rm -rf $RPM_BUILD_ROOT%{_datadir}/readline
rm -f $RPM_BUILD_ROOT%{_infodir}/dir


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


%post
/sbin/install-info %{_infodir}/history.info.gz %{_infodir}/dir &> /dev/null
/sbin/install-info %{_infodir}/rluserman.info.gz %{_infodir}/dir &> /dev/null
:

%preun
if [ $1 = 0 ]; then
   /sbin/install-info --delete %{_infodir}/history.info.gz %{_infodir}/dir &> /dev/null
   /sbin/install-info --delete %{_infodir}/rluserman.info.gz %{_infodir}/dir &> /dev/null
fi
:

%post devel
/sbin/install-info %{_infodir}/readline.info.gz %{_infodir}/dir &> /dev/null
:

%preun devel
if [ $1 = 0 ]; then
   /sbin/install-info --delete %{_infodir}/readline.info.gz %{_infodir}/dir &> /dev/null
fi
:


%files
%defattr(-,root,root)
%license COPYING
%doc CHANGES NEWS README USAGE
/%{_lib}/libreadline*.so.*
%{_libdir}/libhistory*.so.*
%{_infodir}/history.info*
%{_infodir}/rluserman.info*

%files devel
%defattr(-,root,root)
%doc examples/*.c examples/*.h examples/rlfe
%{_includedir}/readline
%{_libdir}/lib*.a
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc
%{_infodir}/readline.info*
%{_mandir}/man*/*

%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
/%{_lib}/libreadline*.so.*
%{_libdir}/libhistory*.so.*

%files -n compat32-%{name}-devel
%defattr(-,root,root)
%{_libdir}/lib*.a
%{_libdir}/lib*.so
%{_libdir}/pkgconfig/*.pc
%endif


%changelog
* Fri Jan 14 2022 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 8.1.2-1
- updated to patchlevel 002.

* Fri May 07 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 8.1.1-1
- updated to patchlevel 001.
- dropped ldconfig scriptlets.

* Thu Feb 25 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 8.1-1
- new upstream release.
- dropped Patch1-4.

* Sat Sep 12 2020 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 8.0.4-1
- updated to patchlevel 004.

* Fri Aug 30 2019 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 8.0-1
- new upstream release.
- dropped all of official patches.
- added Patch1.
- dropped Patch9.
- updated Patch10.

* Sat Mar 21 2015 Ryoichi INAGAKI <ryo1@toki.waseda.jp> 6.3-1
- new upstream release
- update upstream patches (patch1-8)

* Fri Dec 27 2013 Yoji TOYODA <bsyamato@sea.plala.or.jp> 5.2-5
- rebuild with VineSeed environment

* Sun Apr 17 2011 IWAI, Masaharu <iwai@alib.jp> 5.2-4
- add upstream patches 13,14 (Patch13,14)

* Fri Mar  5 2010 MATSUBAYASHI Kohji <shaolin@vinelinux.org> - 5.2-3
- rebuilt with new toolchain
- add Requires(post,pre): /sbin/ldconfig

* Tue Aug 19 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 5.2-2vl5
- build with ncurses-devel
- spec in utf8
- move libncurses.so.* to %%_lib from %%_libdir

* Sat Apr 19 2008 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.2-1vl5
- added upstream patches (patch8-12)

* Fri Oct 19 2007 Ryoichi INAGAKI <ryo1@bc.wakwak.com> 5.2-0vl1
- new upstream release
- update upstream patches (patch1-7)

* Sun Mar 19 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 5.1-0vl1
- new upstream release
- update upstream patches (patch1-4)
- add doc/*.{html,pdf} instead of doc/

* Sun Mar 19 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 4.3-5vl3
- s/Copyright/License/
- add URL
- update source URL
- add PreReq: ldconfig
- move outdated.patch (patch1) to patch10
- add upstream patches (patch1-5)
- add no_rpath.patch (patch11)

* Fri Oct 28 2005 NAKAMURA Kenta <kenta@c.csce.kyushu-u.ac.jp> 4.3-5vl2
- added compat32- packages for x86_64 architecture support
- fixed %files section (TODO* has been removed)

* Sat Mar  8 2003 Daisuke SUZUKI <daisuke@linux.or.jp> 4.3-5vl1
- new upstream release 4.3
- merged with rawhide package.
  * Wed Nov 20 2002 Tim Powers <timp@redhat.com>
  - rebuild in current collinst
  - BuildRequires autoconf only
  * Wed Aug 07 2002 Phil Knirsch <pknirsch@redhat.com> 4.3-3
  - Fixed Esc-O-M stack overflow bug.
  * Mon Jul 22 2002 Phil Knirsch <pknirsch@redhat.com> 4.3-1
  - Updated to latest readline release 4.3
  * Thu Jul 11 2002 Phil Knirsch <pknirsch@redhat.com> 4.2a-7
  - Fixed problem with alpha build.
  * Wed Jul 10 2002 Phil Knirsch <pknirsch@redhat.com>
  - Fixed utf8 problem (originally observed in bash).
  * Fri Jun 21 2002 Tim Powers <timp@redhat.com> 4.2a-6
  - automated rebuild
  * Thu May 23 2002 Tim Powers <timp@redhat.com> 4.2a-5
  - automated rebuild
  * Wed Mar 20 2002 Trond Eivind Glomsrod <teg@redhat.com> 4.2a-4
  - Use autoconf 2.53, not 2.52
  * Mon Mar  4 2002 Bernhard Rosenkraenzer <bero@redhat.com> 4.2a-3
  - Rebuild
  * Mon Nov 26 2001 Matt Wilson <msw@redhat.com> 4.2a-2
  - removed the manual symlinking of .so, readline handles this by itself
  - call only %%makeinstall, not %%makeinstall install install-shared as
    this makes bogus .old files in the buildroot
  * Tue Nov 20 2001 Bernhard Rosenkraenzer <bero@redhat.com> 4.2a-1
  - 4.2a
  * Tue Oct  2 2001 Bernhard Rosenkraenzer <bero@redhat.com> 4.2-4
  - Work around autoconf bug
  * Mon Oct  1 2001 Bernhard Rosenkraenzer <bero@redhat.com> 4.2-3
  - Don't use readline's internal re-implementation of strpbrk on systems
    that have strpbrk - the system implementation is faster and better maintained.
  * Tue Aug  7 2001 Bernhard Rosenkraenzer <bero@redhat.com> 4.2-2
  - Make sure headers can be included from C++ applications (#51131)
    (Patch based on Debian's with the bugs removed ;) )
  * Wed May 09 2001 Florian La Roche <Florian.LaRoche@redhat.de>
  - update to 4.2 and adapt patches
  * Fri Apr  6 2001 Nalin Dahyabhai <nalin@redhat.com>
  - change the paths listed for the header files in the man page to reflect
    the location changes from previous versions (#35073)
  - note that "on" is acceptable instead of "On" in the man page (#21327)
  * Thu Mar  8 2001 Preston Brown <pbrown@redhat.com>
  - fix reading of end key termcap value (@7 is correct, was kH) (#30884)
  * Tue Jan 30 2001 Nalin Dahyabhai <nalin@redhat.com>
  - mark the man page as currently out-of-date (#25294)

* Tue Sep  4 2001 Jun Nishii <jun@vinelinux.org> 4.1-6vl5
- remove texi2dvi and texi2html from doc/

* Fri Jun 29 2001 Jun Nishii <jun@vinelinux.org> 4.1-6vl4
- added doc and examples

* Mon Jun 11 2001 MATSUBAYASHI 'Shaolin' Kohji <shaolin@vinelinux.org>
- 4.1-6vl3
- rebuilt for VineSeed

* Wed Dec 13 2000 MATSUBAYASHI 'Shaolin' Kohji <shaolin@rhythmaning.org>
- 4.1-6vl2
- Oops, spec was written in SJIS...

* Sat Dec  9 2000 Jun Nishii <jun@vinelinux.org>
- 4.1-6vl1
- got i18n patch from Kondara

* Thu Sep  7 2000 Jeff Johnson <jbj@redhat.com>
- FHS packaging (64bit systems need to use libdir).

* Thu Aug 17 2000 Jeff Johnson <jbj@redhat.com>
- summaries from specspo.

* Wed Aug  2 2000 Florian La Roche <Florian.LaRoche@redhat.com>
- use "rm -f" in specfile

* Wed Jul 12 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

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

* Tue Mar 21 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- 4.1

* Thu Feb 03 2000 Nalin Dahyabhai <nalin@redhat.com>
- update to 4.0

* Fri Apr 09 1999 Michael K. Johnson <johnsonm@redhat.com>
- added guard patch from Taneli Huuskonen <huuskone@cc.helsinki.fi>

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

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

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

* Wed May 06 1998 Cristian Gafton <gafton@redhat.com>
- don't package /usr/info/dir

* Thu Apr 30 1998 Cristian Gafton <gafton@redhat.com>
- devel package moved to Development/Libraries

* Tue Apr 21 1998 Cristian Gafton <gafton@redhat.com>
- updated to 2.2

* Tue Oct 14 1997 Donnie Barnes <djb@redhat.com>
- spec file cleanups

* Fri Oct 10 1997 Erik Troan <ewt@redhat.com>
- added proper sonames

* Tue Jul 08 1997 Erik Troan <ewt@redhat.com>
- updated to readline 2.1

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