%bcond_without  test

%define         extraver	a
%define         _infodir	/usr/share/info

Summary:        Tools needed to create Texinfo format documentation files.
Summary(ja):    Texinfo ドキュメントを作成する為に使うツール群
Name:           texinfo
Version:        6.8
Release:        2%{?_dist_release}
Group:          publishing
Vendor:         Project Vine
Distribution:   Vine Linux
Packager:       daisuke

License:        GPLv3+
URL:            https://www.gnu.org/software/texinfo/
Source0:        https://ftp.gnu.org/gnu/texinfo/texinfo-%{version}.tar.xz
Source1:        info-dir

# Patch1: this is needed just for koji/mock, all tests pass fine in local build
Patch1: texinfo-6.0-disable-failing-info-test.patch
# Patch2: rhbz#1348671, because of OSTree
Patch2: texinfo-6.1-install-info-use-create-tmp-then-rename-pattern.patch
# Patch3: we need to fix template fix-info-dir generates
Patch3: info-6.5-sync-fix-info-dir.patch
# Patch4: rhbz#1592433, bug in fix-info-dir --delete
Patch4: texinfo-6.5-fix-info-dir.patch
# Patch5: fixes issues detected by static analysis
Patch5: texinfo-6.5-covscan-fixes.patch
# Patch5: undos change done in gnulib that causes build to fail
# https://lists.gnu.org/r/bug-gnulib/2021-03/msg00066.html
Patch6: texinfo-6.8-undo-gnulib-nonnul.patch

BuildRoot: %{_tmppath}/%{name}-%{version}-root
BuildRequires: autoconf libtool ncurses-devel zlib-devel help2man
Requires: install-info

# Texinfo perl packages are not installed in default perl library dirs
%global __provides_exclude ^perl\\(.*Texinfo.*\\)$
%global __requires_exclude ^perl\\(.*Texinfo.*\\)$

# Redifine this to "dir" in the info directory isn't compressed

%define __spec_install_post /usr/lib/rpm/brp-strip \; /usr/lib/rpm/brp-strip-comment-note \; rm -f

%description
Texinfo is a documentation system that can produce both online
information and printed output from a single source file. The GNU
Project uses the Texinfo file format for most of its documentation.

Install texinfo if you want a documentation system for producing both
online and print documentation from the same source file and/or if you
are going to write documentation for the GNU Project.

%description -l ja
Texinfo は，単一ソースファイルから，オンラインドキュメントと
印刷用ファイルを出力することの出来るドキュメントシステムです．
GNU Project では，殆どのドキュメントでこの Texinfo フォーマットを
採用しています．

単一ソースファイルからオンラインドキュメントと印刷用ファイルを出力
したい場合，あるいは GNU Project 用にドキュメントを書こうと思っている
場合は，この texinfo をインストールして下さい．


%package -n info
Summary:     A stand-alone TTY-based reader for GNU texinfo documentation.
Summary(ja): TTY ベースのスタンドアロン GNU texinfo ドキュメントリーダ
Group:       system
# By making info prereq bash, other packages which have triggers based on
# info don't run those triggers until bash is in place as well. This is an
# ugly method of doing it (triggers which fire on set intersection would
# be better), but it's the best we can do for now. Talk to Erik before
# removing this.
Requires(pre): bash
Requires: install-info

%description -n info
The GNU project uses the texinfo file format for much of its
documentation. The info package provides a standalone TTY-based
browser program for viewing texinfo files.

%description -n info -l ja
GNU Project では殆どのドキュメントに texinfo 形式を採用しています．
この info パッケージには texinfo ファイルを読む TTY ベースの
ブラウザプログラムが収められています．


%package -n install-info
Summary:     info file installer
Summary(ja): info ファイルのインストーラー
Group:       system
Conflicts: info < 4.0b-3vl2
Requires: gzip, bzip2

%description -n install-info
info file installer.

%description -n install-info -l ja
info ファイルのインストーラーです．


#debug_package


%prep
%autosetup -p1


%build
%configure \
	--mandir=%{_mandir} \
	--infodir=%{_infodir} \
	--enable-perl-xs=no

make %{?_smp_mflags}
#make -C util LIBS=%{_libdir}/libz.a


%install
rm -rf %{buildroot}
mkdir -p %{buildroot}/{etc,sbin}

%makeinstall

 ( cd %{buildroot}
  gzip -n -9f .%{_infodir}/*info*
  gzip -n -9f .%{_mandir}/*/*
  mv -f .%{_bindir}/install-info ./sbin
)

install -Dpm0755 -t %{buildroot}%{_sbindir} contrib/fix-info-dir

%find_lang %name
%find_lang %{name}_document


%if %{with test}
%check
export ALL_TESTS=yes
%make_build check
%endif


%clean
rm -rf %{buildroot}


%transfiletriggerin -n install-info -- %{_infodir}
[ -f %{_infodir}/dir ] && create_arg="" || create_arg="--create"
%{_sbindir}/fix-info-dir $create_arg %{_infodir}/dir &>/dev/null

%transfiletriggerpostun -n install-info -- %{_infodir}
[ -f %{_infodir}/dir ] && %{_sbindir}/fix-info-dir --delete %{_infodir}/dir &>/dev/null


%files -f %{name}.lang -f %{name}_document.lang
%defattr(-,root,root)
%license COPYING
%doc AUTHORS ChangeLog NEWS README TODO
%{_bindir}/makeinfo
%{_bindir}/pdftexi2dvi
%{_bindir}/pod2texi
%{_bindir}/texi2any
%{_bindir}/texi2dvi
%{_bindir}/texi2pdf
%{_bindir}/texindex
%{_datadir}/texinfo
%{_infodir}/texinfo*
#dir %{_libdir}/texinfo
#{_libdir}/texinfo/*
%{_mandir}/man1/makeinfo.1*
%{_mandir}/man1/pdftexi2dvi.1*
%{_mandir}/man1/pod2texi.1.gz
%{_mandir}/man1/texi2any.1.gz
%{_mandir}/man1/texi2dvi.1*
%{_mandir}/man1/texi2pdf.1*
%{_mandir}/man1/texindex.1*
%{_mandir}/man5/texinfo.5*

%files -n info
%defattr(-,root,root)
#%config(missingok) /etc/X11/applnk/Utilities/info.desktop
#%config(noreplace) %verify(not md5 size mtime) /etc/info-dir
#%config(noreplace) %{_infodir}/dir
%license COPYING
%{_bindir}/info
#{_bindir}/infokey
#{_infodir}/info.info*
%{_infodir}/info-stnd.info*
%{_mandir}/man1/info.1*
#{_mandir}/man1/infokey.1*
%{_mandir}/man5/info.5*

%files -n install-info
%defattr(-,root,root)
%license COPYING
%ghost %{_infodir}/dir
%ghost %attr(644, root, root) %{_infodir}/dir.old
%ghost %{_sysconfdir}/info-dir
%{_syssbindir}/install-info
%{_sbindir}/fix-info-dir
%{_mandir}/man1/install-info.1*


%changelog
* Tue Sep 14 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 6.8-2
- added filetriggers.
- dropped install-info scriptlets.

* Tue Jul 27 2021 Tomohiro "Tomo-p" KATO <tomop@teamgedoh.net> 6.8-1
- new upstream release.
- dropped Patch0.
- updated Patch5.
- imported Patch6 from rawhide.

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

* Sun Jul 13 2014 Yoji TOYODA <bsyamato@sea.plala.or.jp> 4.13a-2
- rebuild with VineSeed environment

* Sun Apr 24 2011 Daisuke SUZUKI <daisuke@linux.or.jp> 4.13a-1
- update to 4.13a
- add patch2-6 from upstream
- add BR: help2man

* Mon May 10 2010 Satoshi IWAMOTO <satoshi.iwamoto@nifty.ne.jp> 4.13-2
- add R: gzip, bzip2 into install-info to fix making vbootstrap env.
- change tag Prereq -> Req(pre)

* Wed Apr 21 2010 Shu KONNO <owa@bg.wakwak.com> 4.13-1
- new upstream release, and rebuilt with new environment
- dropt Patch3: texinfo-4.3-zlib.patch

* Sat Aug 16 2008 Shu KONNO <owa@bg.wakwak.com> 4.8-1vl5
- applied new versioning policy, spec in utf-8

* Tue Oct 24 2006 KAZUKI SHIMURA <kazuki@ma.ccnw.ne.jp> 4.8-0vl1
- new upstream release (4.8a)
- move /etc/info-dir, %%{_infodir}/dir to install-info package
- add URL
- not apply patch1

* Thu Mar 09 2006 Shu KONNO <owa@bg.wakwak.com> 4.7-0vl2
- rebuilt for x86_64 architecture support

* Thu Jul 01 2004 Daisuke SUZUKI <daisuke@linux.or.jp> 4.7-0vl1
- new upstream release

* Sat Dec 20 2003 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 4.2-5vl1
- updated to 4.2 based on 4.2-5

  * Mon Sep  2 2002 Bernhard Rosenkraenzer <bero@redhat.com> 4.2-5
  - Fix crash w/ MALLOC_CHECK_ == 2 (#72831)
  * Tue Jul  2 2002 Bernhard Rosenkraenzer <bero@redhat.com> 4.2-4
  - Add infokey (#67728)
  * Fri Jun 21 2002 Tim Powers <timp@redhat.com>
  - automated rebuild
  * Thu May 23 2002 Tim Powers <timp@redhat.com>
  - automated rebuild
  * Tue Apr 23 2002 Florian La Roche <Florian.LaRoche@redhat.de>
  - 4.2

* Mon Apr  7 2003 Hiroaki Irokawa <irorin@terra.dti.ne.jp> 4.1-1vl4
- rebuild

* Fri Nov 29 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 4.1-1vl3
- /usr/info -> /usr/share/info (defined on the first line of this spec)
  (rpm-4.0.4-18vl11 and later will define so, though)

* Sun Mar 17 2002 Satoshi MACHINO <machino@vinelinux.org> 4.1-1vl2
- rewrote changelog at 4.0b-3vl4 (fixed typo)
- rebuild

* Sat Mar 16 2002 Satoshi MACHINO <machino@vinelinux.org> 4.1-1vl1
- updated texinfo-4.1
- fixed broken changelog ;P

* Fri Mar 15 2002 Satoshi MACHINO <machino@vinelinux.org> 4.0b-3vl4
- updated on zlib (security Fix.)

* Wed Feb 20 2002 Daisuke SUZUKI <daisuke@linux.or.jp> 4.0b-3vl3
  - just rebuild with new release number.
    * Mon Feb 18 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 4.0b-3vl2
    - Oops the spec was in Shift-JIS. Fixed.

* Mon Feb 11 2002 akira yamada <akira@vinelinux.org> 4.0b-3vl2
- %{_syssbindir}/install-info is separated from info package.
- added autoconf, libtool, ncurses-devel, zlib-devel to BuildRequires.

* Mon Jan 07 2002 MATSUBAYASHI Kohji <shaolin@vinelinux.org> 4.0b-3vl1
- based on 4.0b-3 from Rawhide and built for Vine Linux
- added Japanese summary and description
- fixed rpm macros

* Tue Aug  7 2001 Bernhard Rosenkraenzer <bero@redhat.com> 4.0b-3
- Don't create the desktop file - we don't install it anyway.

* Sat Jul 21 2001 Tim Powers <timp@redhat.com>
- remove the info viewer from the menus, it's cluttering things

* Wed May 09 2001 Florian La Roche <Florian.LaRoche@redhat.de>
- 4.0b

* Tue Apr 24 2001 Bernhard Rosenkraenzer <bero@redhat.com> 4.0a-1
- Update to 4.0a, the patch looks sane

* Fri Feb 23 2001 Trond Eivind Glomsr <teg@redhat.com>
- langify
- don't create desktop file in spec file

* Tue Jan 23 2001 Preston Brown <pbrown@redhat.com>
- danish translation added

* Tue Dec 12 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Rebuild to get rid of 0777 dirs

* Wed Nov  8 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Fix recognition of .?o extensions in texi2dvi, Bug #20498

* Thu Sep  7 2000 Jeff Johnson <jbj@redhat.com>
- FHS packaging (64bit systems need to use %%_libdir not /usr/lib).

* Sat Aug 19 2000 Trond Eivind Glomsr <teg@redhat.com>
- really do it - #16120

* Mon Aug 14 2000 Helge Deller <hdeller@redhat.com>
- gzip man-pages, #16120

* Mon Aug  7 2000 Tim Waugh <twaugh@redhat.com>
- List man-pages in %%files.

* Fri Aug  4 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- Add Swedish and German translations to desktop file, Bug #15366

* Thu Aug  3 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- mark /etc/info-dir %%verify(not md5 size mime), Bug #14826

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

* Wed Jun 28 2000 Bill Nottingham <notting@redhat.com>
- fix build wackiness with info page compressing

* Fri Jun 16 2000 Bill Nottingham <notting@redhat.com>
- fix info-dir symlink

* Thu May 18 2000 Preston Brown <pbrown@redhat.com>
- use FHS paths for info.

* Fri Mar 24 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- rebuild with current ncurses

* Wed Feb 09 2000 Preston Brown <pbrown@redhat.com>
- wmconfig -> desktop

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

* Wed Jan 26 2000 Bernhard Rosenkraenzer <bero@redhat.com>
- move info-stnd.info* to the info package, /sbin/install-info it
  in %post (Bug #6632)

* Thu Jan 13 2000 Jeff Johnson <jbj@redhat.com>
- recompile to eliminate ncurses foul-up.

* Tue Nov  9 1999 Bernhard Rosenkr舅zer <bero@redhat.com>
- 4.0
- handle RPM_OPT_FLAGS

* Tue Sep 07 1999 Cristian Gafton <gafton@redhat.com>
- import version 3.12h into 6.1 tree from HJLu

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

* Wed Mar 17 1999 Erik Troan <ewt@redhat.com>
- hacked to use zlib to get rid of the requirement on gzip

* Wed Mar 17 1999 Matt Wilson <msw@redhat.com>
- install-info prerequires gzip

* Thu Mar 11 1999 Cristian Gafton <gafton@redhat.com>
- version 3.12f
- make /usr/info/dir to be a %config(noreplace)
* Wed Nov 25 1998 Jeff Johnson <jbj@redhat.com>
- rebuild to fix docdir perms.

* Thu Sep 24 1998 Cristian Gafton <gafton@redhat.com>
- fix allocation problems in install-info

* Wed Sep 23 1998 Jeff Johnson <jbj@redhat.com>
- /sbin/install-info should not depend on /usr/lib/libz.so.1 -- statically
  link with /usr/lib/libz.a.

* Fri Aug 07 1998 Erik Troan <ewt@redhat.com>
- added a prereq of bash to the info package -- see the comment for a
  description of why that was done

* Tue Jun 09 1998 Prospector System <bugs@redhat.com>
- translations modified for de

* Tue Jun  9 1998 Jeff Johnson <jbj@redhat.com>
- add %attr to permit non-root build.

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

* Sun Apr 12 1998 Cristian Gafton <gafton@redhat.com>
- added %clean
- manhattan build

* Wed Mar 04 1998 Cristian Gafton <gafton@redhat.com>
- upgraded to version 3.12
- added buildroot

* Sun Nov 09 1997 Donnie Barnes <djb@redhat.com>
- moved /usr/info/dir to /etc/info-dir and made /usr/info/dir a
  symlink to /etc/info-dir.

* Wed Oct 29 1997 Donnie Barnes <djb@redhat.com>
- added wmconfig entry for info

* Wed Oct 01 1997 Donnie Barnes <djb@redhat.com>
- stripped /sbin/install-info

* Mon Sep 22 1997 Erik Troan <ewt@redhat.com>
- added info-dir to filelist

* Sun Sep 14 1997 Erik Troan <ewt@redhat.com>
- added patch from sopwith to let install-info understand gzip'ed info files
- use skeletal dir file from texinfo tarball (w/ bash entry to reduce
  dependency chain) instead (and install-info command everywhere else)
- patches install-info to handle .gz names correctly

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

* Tue Feb 25 1997 Erik Troan <ewt@redhat.com>
- patched install-info.c for glibc.
- added /usr/bin/install-info to the filelist

* Tue Feb 18 1997 Michael Fulbright <msf@redhat.com>
- upgraded to version 3.9.
