Subject: HEADS UP: new info files, install-info and makeinfo framework
To: None <tech-pkg@netbsd.org>
From: Stoned Elipot <seb@starfleet.univ-paris7.fr>
List: tech-pkg
Date: 06/19/2003 23:42:35
Hi,

A new framework for handling texinfo sources and info files has
hit the pkgsrc tree.

The goal of the new framework is twofold:
	- reduce the number of '@exec' and '@unexec' in PLIST by
using INSTALL/DEINSTALL scripts to handle entries addition/removal
in the Info directory file.
	- achieve lighter dependencies by avoiding unnecessary run-time
dependency on the gtexinfo package and if needed with the help of the
standalone install-info command provided by the newly imported package
pkgtools/pkg_install-info.

This second goal deserves a little explanation.

The situation until now was that on pkgsrc platforms not providing
install-info and makeinfo commands the gtexinfo package was registered
as a _run-time_ dependency for each package using pkgsrc/mk/texinfo.mk
(that should be every package providing info files).  The same
situation was also encountered when the system provides a makeinfo
command older than the minimum version the package is requiring
(via TEXINFO_REQD variable).

The downside of this was that the gtexinfo package has itself a
somewhat important dependencies list. And more the gtexinfo package
was only really needed at run-time only for the install-info command.
Having a long list of out of date dependencies when gtexinfo is
updated or worse when gettext-lib and/or libiconv (both can be
dependencies of gtexinfo) are updated was painful...

To ease the transition from the old to the new framework both will
exist in pkgsrc tree until all existing packages are converted.
Of course new packages should use the new framework. Pkglint will be
updated to help people spotting packages using the old framework.

So a package providing info files must exhibit the following
characteristics in order to use the new framework:

* The variable USE_NEW_TEXINFO _must_ be defined.  This is a transition
variable that mark the package as using the new framework. When all
packages will be converted (see below) all its occurrences will be
removed.

* Each info files:
	- is considered to be installed in the directory
	  ${PREFIX}/${INFO_DIR};
	- is registered in the Info directory file
	  ${PREFIX}/${INFO_DIR}/dir;
	- and must be listed as a filename in the INFO_FILES variable
	  in the package Makefile (which now has a somewhat different
	  meaning than previously).

This will trigger the inclusion of texinfo.mk from bsd.pkg.mk as well as
define USE_PKGINSTALL as entries addition/removal in the Info
directory file are now handled by INSTALL/DEINSTALL scripts
automatically generated by the USE_PKGINSTALL framework.
If the system does not provide an install-info command this will add
a _run-time_ dependency on pkgtools/pkg_install-info package.

The default value of INFO_DIR is `info' but can be overridden in
the package Makefile.

Please note that as before the actual installation of the Info
files are still up to the package installation process.

* A package which need the makeinfo command at _build time_ must
define the variable USE_MAKEINFO. If a minimum version is needed
it should be noted with the TEXINFO_REQD variable as before.
According to the minimum version required and the version of the
system provided makeinfo command (if any) this could add the
_build-time_ dependency on devel/gtexinfo.

* The build and install process of the package must use the right
install-info and makeinfo commands. Two scenarii exist:

 * The package uses the buildlink2 framework and most of the time
 no more action is required from the package creator/maintainer.
 Code snippets in mk/buildlink2/bsd.buildlink2.mk will create
 wrappers on the install-info and makeinfo commands that should do
 the right things:

	** A no operation for install-info (recorded in the buildlink2
	wrapper log file).

	** Invoke the right makeinfo command or the GNU missing script
	for the makeinfo command according to USE_MAKEINFO and
	TEXINFO_REQD variables.

 * The package does not use the buildlink2 framework and then some
 care must be taken.
 The package creator/maintainer should ensure that the software build
 and installation process pick up the environment variables MAKEINFO
 and INSTALL_INFO to invoke the right commands:

	** ${TRUE} for INSTALL_INFO, intended to be a no-operation;

	** ${FALSE} -intended to serve as a missing USE_MAKEINFO trap-
	or the pathname to the right makeinfo command for MAKEINFO
	according to the value of USE_MAKEINFO.

In order to convert an existing package to the new framework one should
modify the package following the guidelines above *and* :  following:

* Follow the instructions above.

* Remove the direct inclusion of texinfo.mk from the package's
Makefile (usually done as `.include "../../mk/texinfo.mk"').

* Remove any occurrences of `@.*exec ${INSTALL_INFO} .*' from the
PLIST file(s).

* Remove the definition of TEXINFO_OVERRIDE from the package
Makefile if it is present.  Note that if the package is _not_ using
the buildlink2 framework it would surely need some specific patches.
In case of doubt ask <tech-pkg at netbsd dot org> for advice and
help.

* When the package uses the buildlink2 framework patch files removal
or reduction might be feasible: look out for patch lines involving
`install-info' and `makeinfo' insensitively, more likely
these would not be needed anymore.

* If the package has an INSTALL or DEINSTALL script without using
the USE_PKGINSTALL framework they should be converted to use it
as the info files registration via INSTALL/DEINSTALL scripts is based
on it (see comments about {DE,}INSTALL_EXTRA_TMPL in
pkgsrc/mk/bsd.pkg.install.mk).

Your help in converting the existing packages will be greatly
appreciated!

Thanks in advance.

Cheers, Stoned.