##
##  texinfo.spec -- OpenPKG RPM Package Specification
##  Copyright (c) 2000-2025 OpenPKG Project <http://openpkg.org/>
##
##  Permission to use, copy, modify, and distribute this software for
##  any purpose with or without fee is hereby granted, provided that
##  the above copyright notice and this permission notice appear in all
##  copies.
##
##  THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
##  WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
##  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
##  IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR
##  CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
##  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
##  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
##  USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
##  ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
##  OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
##  OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
##  SUCH DAMAGE.
##

#   package version
%define       V_tarball 7.2
%define       V_subdir  7.2

#   package information
Name:         texinfo
Summary:      GNU Documentation System
URL:          http://www.gnu.org/software/texinfo/
Vendor:       Free Software Foundation
Packager:     OpenPKG Project
Distribution: OpenPKG Community
Class:        BASE
Group:        Typesetting
License:      GPL
Version:      %{V_tarball}
Release:      20241223

#   package options
%option       with_perl no

#   list of sources
Source0:      http://ftp.gnu.org/gnu/texinfo/texinfo-%{V_tarball}.tar.gz

#   build information
BuildPreReq:  OpenPKG, openpkg >= 20160101, make
PreReq:       OpenPKG, openpkg >= 20160101
BuildPreReq:  ncurses
PreReq:       ncurses
%if "%{with_perl}" == "yes"
BuildPreReq:  perl, perl-locale
PreReq:       perl, perl-locale
%else
BuildPreReq:  perl
%endif

%description
    Texinfo is a documentation system that uses a single source file to
    produce both on-line information and printed output.  Using texinfo, you
    can create a printed document with the normal features of a book,
    including chapters, sections, cross references, and indices. From the same
    texinfo source file, you can create a menu-driven, on-line info file with
    nodes, menus, cross references, and indices.

%track
    prog texinfo = {
        version   = %{V_tarball}
        url       = http://ftp.gnu.org/gnu/texinfo/
        regex     = texinfo-(__VER__)\.tar\.(bz2|gz)
    }

%prep
    %setup -q -n texinfo-%{V_subdir}
    chmod a+x build-aux/install-sh

%build
    CC="%{l_cc}" \
    CFLAGS="%{l_cflags -O} %{l_cppflags ncurses}" \
    LDFLAGS="%{l_ldflags}" \
    GREP="grep" \
    ./configure \
        --prefix=%{l_prefix} \
        --infodir=%{l_prefix}/info \
        --mandir=%{l_prefix}/man \
%if "%{with_perl}" == "yes"
        --enable-perl-api-texi-build \
        --enable-perl-xs \
%else
        --disable-perl-api-texi-build \
        --disable-perl-xs \
%endif
        --without-nls
    %{l_make} %{l_mflags}

%install
    %{l_make} %{l_mflags} install AM_MAKEFLAGS="DESTDIR=$RPM_BUILD_ROOT"
    strip $RPM_BUILD_ROOT%{l_prefix}/bin/* >/dev/null 2>&1 || true
    rm -rf $RPM_BUILD_ROOT%{l_prefix}/share/locale
    rm -f $RPM_BUILD_ROOT%{l_prefix}/info/dir
    rm -f $RPM_BUILD_ROOT%{l_prefix}/lib/charset.alias
    %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std}

%files -f files

%clean

