Summary: A basic system library for accessing the termcap database.
Name: libtermcap
Version: 2.0.8
Release: 47%{?_dist_release}
Source: ftp://metalab.unc.edu/pub/Linux/GCC/termcap-2.0.8.tar.bz2
Url: ftp://metalab.unc.edu/pub/Linux/GCC/
License: LGPL
Group: System Environment/Libraries
Patch0: termcap-2.0.8-shared.patch
Patch1: termcap-2.0.8-setuid.patch
Patch2: termcap-2.0.8-instnoroot.patch
Patch3: termcap-2.0.8-compat21.patch
Patch4: termcap-2.0.8-xref.patch
Patch5: termcap-2.0.8-fix-tc.patch
Patch6: termcap-2.0.8-ignore-p.patch
Patch7: termcap-buffer.patch
# This patch is a REALLY BAD IDEA without patch #10 below....
Patch8: termcap-2.0.8-bufsize.patch
Patch9: termcap-2.0.8-colon.patch
Patch10: libtermcap-aaargh.patch
Patch11: termcap-2.0.8-glibc22.patch
Patch12: libtermcap-2.0.8-ia64.patch
Patch13: termcap-116934.patch
Patch14: termcap-2.0.8-shrink.patch
Patch15: termcap-2.0.8-octal.patch
Patch16: termcap-2.0.8-nofree.patch
Requires: termcap
BuildPrereq: texinfo
BuildRoot: %{_tmppath}/%{name}-%{version}-root
Obsoletes: libtermcap-devel <= 2.0.8-46vl1

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

%description
The libtermcap package contains a basic system library needed to
access the termcap database.  The termcap library supports easy access
to the termcap database, so that programs can output character-based
displays in a terminal-independent manner.

%package -n compat32-%{name}
Summary: A basic system library for accessing the termcap database.
Group: System Environment/Libraries
Requires: %{name} = %{version}-%{release}

%description -n compat32-%{name}
The libtermcap package contains a basic system library needed to
access the termcap database.  The termcap library supports easy access
to the termcap database, so that programs can output character-based
displays in a terminal-independent manner.

%prep
%setup -q -n termcap-2.0.8
%patch0 -p1
%patch1 -p1
%patch2 -p1 -b .nochown
%patch3 -p1 -b .compat21
%patch4 -p1
%patch5 -p1 -b .fix-tc
%patch6 -p1 -b .ignore-p
%patch7 -p1 -b .buffer
%patch8 -p1 -b .bufsize
%patch9 -p1 -b .colon
%patch10 -p1 -b .aaargh
%patch11 -p1 -b .glibc22
%ifarch ia64
%patch12 -p1 -b .ia64
%endif
%patch13 -p1 -b .116934
%patch14 -p1 -b .shrink
%patch15 -p1 -b .octal
%patch16 -p1 -b .nofree

%build
make AR=%{__ar} CC=%{__cc} CFLAGS="$RPM_OPT_FLAGS -I."

%install
rm -rf $RPM_BUILD_ROOT
%ifarch x86_64
mkdir -p $RPM_BUILD_ROOT/{usr/lib,usr/lib64,%{_infodir},usr/include,etc,lib64}
%else
mkdir -p $RPM_BUILD_ROOT/{usr/lib,%{_infodir},usr/include,etc,lib}
%endif

export PATH=/sbin:$PATH
make prefix=$RPM_BUILD_ROOT/usr install

install -c -m644 termcap.src $RPM_BUILD_ROOT/etc/termcap
cp termcap.info* $RPM_BUILD_ROOT/%{_infodir}

( cd $RPM_BUILD_ROOT
  rm -f ./etc/termcap
  mv ./usr/lib/libtermcap.so* ./%{_lib}
  #ln -sf libtermcap.so.2.0.8 ./%{_lib}/libtermcap.so
  rm -f ./%{_lib}/libtermcap.so
  cd usr/%{_lib}
  ln -sf ../../%{_lib}/libtermcap.so.2.0.8 libtermcap.so
%ifarch x86_64
  mv ../lib/libtermcap.a .
  rmdir ../lib
%endif
  cd ../..
  strip -R .comments --strip-unneeded ./%{_lib}/libtermcap.so.2.0.8
  gzip -9nf ./%{_infodir}/termcap.info*
  chmod 644 ./%{_infodir}/termcap.info*
)

%clean
rm -rf $RPM_BUILD_ROOT

%post -p /sbin/ldconfig

%postun -p /sbin/ldconfig

%post -n compat32-%{name} -p /sbin/ldconfig

%postun -n compat32-%{name} -p /sbin/ldconfig


%files
%defattr(-,root,root)
/%{_lib}/libtermcap.so.2.0.8

%if %{build_compat32}
%files -n compat32-%{name}
%defattr(-,root,root)
/%{_lib}/libtermcap.so.2.0.8


%changelog
* Mon Aug 04 2008 Daisuke SUZUKI <daisuke@linux.or.jp> 2.0.8-47
- new versioning policy
- remove libtermcap-devel, replaced by ncurses-devel(libtinfo)

* Thu May 10 2007 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 2.0.8-46vl1
- rebuit with new toolchain
- not postun but preun to execute install-info --delete - fixed.

  - Tue Jun 27 2006 Florian La Roche <laroche@redhat.com> - 2.0.8-46
  - no need for the trigger, if info files are in the -devel subrpm

  - Mon Feb 27 2006 Miloslav Trmac <mitr@redhat.com> - 2.0.8-45
  - Add Requires(postun): /sbin/install-info to libtermcap-devel (#182836)

* Wed Feb 08 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 2.0.8-44vl1
- s/Copyright/License/
- use %%{_tmppath}/%%{name}-%%{version}-root as BuildRoot
- import patch13-16 from FC 2.0.8-44

  * Mon Jan 2 2006 Petr Raszyk <praszyk@redhat.com> 2.0.8-43
  - libtermcap does not 'free()'memory. See #74346
    A patch termcap-2.0.8-nofree.patch

  * Fri Mar 18 2005 Nalin Dahyabhai <nalin@redhat.com> 2.0.8-41
  - don't trip over capabilities which end in '^' or '\'
  - don't accept numbers with '8' or '9' in them as valid octal numbers

  * Fri May  7 2004 Tim Waugh <twaugh@redhat.com> 2.0.8-38
  - Fix tgetent() (bug #116934).

* Fri Oct 28 2005 NAKAMURA Kenta <kenta@c.csce.kyushu-u.ac.jp> 2.0.8-36vl2
- added compat32- packages for x86_64 architecture support

* Wed Jun 11 2003 KOBAYASHI R. Taizo <tkoba@vinelinux.org> 2.0.8-36vl1
- added patch12 from rawhide

* Wed Dec 19 2001 Toru Sagami <sagami@vinelinux.org> 2.0.8-26vl2
- enabled patch11 in order to build on glibc-22

* Sat Jun 09 2001 <sagami@vinelinux.org>
- 2.0.8-26vl1: follow up with 2.0.8-26 from 2.0.8-20vl1
- disabled patch11 for glibc-22

* Sat Oct  7 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Uninstall info pages in %%postun devel rather than %%postun
  (Bug #18545)

* Wed Aug 16 2000 Nalin Dahyabhai <nalin@redhat.com>
- fix broken symlink (#16285)

* Mon Aug 14 2000 Preston Brown <pbrown@redhat.com>
- absolute --> relative symlink (#16131)

* Thu Jul 13 2000 Prospector <bugzilla@redhat.com>
- automatic rebuild

* Tue Jul  4 2000 Matt Wilson <msw@redhat.com>
- move the trigger to the devel package, that's where the info pages
  live now

* Sun Jun 18 2000 Matt Wilson <msw@redhat.com>
- rebuild for next release
- move info pages to the development package
- use %%{_infodir}
- patched to build against new glibc (patch11)

* Sun Feb  6 2000 Bernhard RosenkrçÏzer <bero@redhat.com>
- BuildPrereq: texinfo (#8927)

* Sat Feb  5 2000 Bernhard RosenkrçÏzer <bero@redhat.com>
- strip library
- fix up handling of RPM_OPT_FLAGS

* Tue Aug 30 1999 Bill Nottingham <notting@redhat.com>
- ignore the first argument to tgetent, so the last change doesn't
  keep blowing up programs.
- ignore the second argument to tgetstr() as well. 

* Sat Aug 21 1999 Jeff Johnson <jbj@redhat.com>
- increase default size of malloc'ed tgetent buffer from 1024 to 1536.
- don't shrink colons (#4270).
- rebuild for 6.1.

* Mon Aug 16 1999 Bill Nottingham <notting@redhat.com>
- add buffer overflow patch from Kevin Vajk <kvajk@ricochet.net>

* Sat May 15 1999 Jeff Johnson <jbj@redhat.com>
- permit multiple tc= continuations and ignore unnecessary %p ("push arg") (#54)

* Sun Mar 21 1999 Cristian Gafton <gafton@redhat.com> 
- auto rebuild in the new build environment (release 13)
- fix to make the texi documenattion compile

* Thu Jan 14 1999 Jeff Johnson <jbj@redhat.com>
- use __PMT(...) prototypes (#761)

* Fri Dec 18 1998 Cristian Gafton <gafton@redhat.com>
- build against glibc 2.1

* Wed Aug 05 1998 Erik Troan <ewt@redhat.com>
- run install-info from a %trigger so we don't have to make it a prereq; as
  termcap is used by bash, the install ordering issues are hairy
- commented out the chown stuff from 'make install' so you don't have to
  be root to build this
- don't run ldconfig if prefix= is used during 'make install'

* Tue Aug  4 1998 Jeff Johnson <jbj@redhat.com>
- build root.

* Tue Jun 30 1998 Alan Cox <alan@redhat.com>
- But assume system termcap is sane. Also handle setfsuid return right.

* Tue Jun 30 1998 Alan Cox <alan@redhat.com>
- TERMCAP environment hole for setuid apps squished.

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

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

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