summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorseb <seb@pkgsrc.org>2003-06-19 21:41:13 +0000
committerseb <seb@pkgsrc.org>2003-06-19 21:41:13 +0000
commit5ab8be8066273669ac731b3a0f60adee2c6fa7d9 (patch)
treea2fb7483e3a18fa8f83edeb1496c00f88dff6039
parent4c7c717eed7b924103792374e8c81cc3608d302c (diff)
downloadpkgsrc-5ab8be8066273669ac731b3a0f60adee2c6fa7d9.tar.gz
Introduce a new framework to handle info files, install-info and
makeinfo commands. 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 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 recently imported package pkgtools/pkg_install-info. A package must be sightly updated to use this new framework and must define the variable USE_NEW_TEXINFO. This variable will be removed from the pkgsrc tree when all package would have been updated. For details see section 10.24 of Packages.txt, comments in mk/{texinfo.mk,buildlink2/bsd.buildlink2.mk} and upcoming mail to <tech-pkg at netbsd dot org>.
-rw-r--r--Packages.txt88
-rw-r--r--mk/bsd.pkg.mk20
-rw-r--r--mk/buildlink2/bsd.buildlink2.mk53
-rw-r--r--mk/install/install-info25
-rw-r--r--mk/texinfo.mk135
5 files changed, 262 insertions, 59 deletions
diff --git a/Packages.txt b/Packages.txt
index ed1bf8362b9..6a4e8ae1fbd 100644
--- a/Packages.txt
+++ b/Packages.txt
@@ -1,4 +1,4 @@
-# $NetBSD: Packages.txt,v 1.294 2003/06/05 17:32:13 jmmv Exp $
+# $NetBSD: Packages.txt,v 1.295 2003/06/19 21:41:13 seb Exp $
###########################################################################
==========================
@@ -2298,49 +2298,46 @@ examples.
===================================
Some packages install info files or use the makeinfo or install-info
-commands. In such cases, the makefile fragment mk/texinfo.mk should be
-included in the package Makefile before the inclusion of mk/bsd.pkg.mk.
-Newer versions of texinfo (version 4 and above) are, unfortunately,
-incompatible from previous versions at the command line level and some
-extensions were introduced in the TeXinfo macro set. So the package creator
-should ensure that the correct binaries are selected, rather than relying
-on the contents of the PATH variable in the shell.
-
-The main info directory file needs to be updated to reflect the
-installation of info files. Some packages' installation processes take care
-of this for you. Otherwise the NetBSD Packages Collection has an INFO_FILES
-definition which can be used to do this. Simply use the
-
- INFO_FILES= ident.info
-
-definition in the package Makefile, where "ident.info" is the name of the
-info file which installs an info dir entry.
-
-A package creator should also take care that the package build and install
-process uses the correct version of the makeinfo and install-info commands.
-Some Makefiles and configure scripts from recent software packages include
-the pathnames to the makeinfo and install-info commands. Unfortunately,
-older software packages tend not to do this, and, should this be the case,
-further action is required of the package creator.
-
-The mk/texinfo.mk makefile fragment will ensure that the proper makeinfo
-and install-info commands are available on the system as well as help the
-configure and build process of the package to use known binaries for these
-commands.
-
-If a minimum version of makeinfo and install-info commands are required,
-define TEXINFO_REQD in the package's Makefile to this minimum version.
-
-If a package is not well behaved (i.e., it does not pick MAKEINFO or
-INSTALL_INFO in the environment at configure or build time) you should do
-one of the following, whichever is more appropriate:
- a) patch the package files so MAKEINFO or INSTALL_INFO are picked from the
- environment at configure or build time and get used instead of
- relying on makeinfo or install-info being accessible in PATH;
- b) put TEXINFO_OVERRIDE=YES in the package Makefile to let some sed
- manipulation happen on some packages source files (see contents of
- mk/texinfo.mk).
-
+commands. 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.
+
+INFO_DIR defaults to `info' and can be overridden in the package Makefile.
+INSTALL and DEINSTALL scripts will be generated for handling registration
+of the info files in the Info directory file.
+The command install-info used for the info files registration is either
+provided by the system or by a special purpose package automatically
+added as dependency if needed.
+
+A package which need the makeinfo command at build time must define
+the variable USE_MAKEINFO in its Makefile. If a minimum version of the
+makeinfo command is needed it should be noted with the TEXINFO_REQD variable
+in the package Makefile. By default a minimum version of 3.12 is required.
+If the system does not provide a makeinfo command or if it does not match
+the required minimum a build dependency on the devel/gtexinfo package is
+added.
+
+The installation process of the software provided by the package must not
+use the install-info as the registration of info files
+is the task of the package INSTALL SCRIPT, and it must use
+the right makeinfo command.
+
+If the package use buildlink2 framework no special action should be needed
+to achieve this goal.
+
+If the package does not use the buildlink2 framework patch files are likely
+to be needed so the build and installation process of the software
+picks up the -possibly dummys- values of INSTALL_INFO and MAKEINFO in the
+environment.
+
+*NOTE* Temporally the variable USE_NEW_TEXINFO must be defined in the
+package Makefile. Previously info files, install-info and makeinfo
+were handled somewhat differently and the two ways will coexist for
+a short period of time until all older packages are updated.
10.25 Packages whose distfiles aren't available for plain downloading
=====================================================================
@@ -2653,7 +2650,6 @@ The file contents in this section must be used without the "> " prefix.
GNU_CONFIGURE= yes
INFO_FILES= bison.info
- .include "../../mk/texinfo.mk"
.include "../../mk/bsd.pkg.mk"
@@ -2671,14 +2667,12 @@ The file contents in this section must be used without the "> " prefix.
@comment <$>NetBSD<$>
bin/bison
man/man1/bison.1.gz
- @unexec install-info --delete %D/info/bison.info %D/info/dir
info/bison.info
info/bison.info-1
info/bison.info-2
info/bison.info-3
info/bison.info-4
info/bison.info-5
- @exec install-info %D/info/bison.info %D/info/dir
share/bison.simple
share/bison.hairy
diff --git a/mk/bsd.pkg.mk b/mk/bsd.pkg.mk
index ccf96583ed7..51747854524 100644
--- a/mk/bsd.pkg.mk
+++ b/mk/bsd.pkg.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.pkg.mk,v 1.1200 2003/06/17 14:33:17 abs Exp $
+# $NetBSD: bsd.pkg.mk,v 1.1201 2003/06/19 21:41:14 seb Exp $
#
# This file is in the public domain.
#
@@ -496,6 +496,12 @@ PLIST_SUBST+= PERL5_SITEARCH=${PERL5_SITEARCH:S/^${LOCALBASE}\///}
PLIST_SUBST+= PERL5_ARCHLIB=${PERL5_ARCHLIB:S/^${LOCALBASE}\///}
.endif
+.if defined(USE_NEW_TEXINFO)
+. if defined(INFO_FILES)
+. include "../../mk/texinfo.mk"
+. endif
+.endif
+
.if defined(USE_PKGINSTALL) && !empty(USE_PKGINSTALL:M[yY][eE][sS])
. include "../../mk/bsd.pkg.install.mk"
.endif
@@ -2317,11 +2323,13 @@ real-su-install: ${MESSAGE}
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} do-install
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} post-install
${_PKG_SILENT}${_PKG_DEBUG}cd ${.CURDIR} && ${MAKE} ${MAKEFLAGS} post-install-script
-.for f in ${INFO_FILES}
+.if !defined(USE_NEW_TEXINFO)
+. for f in ${INFO_FILES}
${_PKG_SILENT}${_PKG_DEBUG}${ECHO} "${INSTALL_INFO} --info-dir=${PREFIX}/info ${PREFIX}/info/${f}"; \
${INSTALL_INFO} --remove --info-dir=${PREFIX}/info ${PREFIX}/info/${f}; \
${INSTALL_INFO} --info-dir=${PREFIX}/info ${PREFIX}/info/${f}
-.endfor
+. endfor
+.endif # !USE_NEW_TEXINFO
@# PLIST must be generated at this late point (instead of
@# depending on it somewhere earlier), as the
@# pre/do/post-install aren't run then yet:
@@ -4096,11 +4104,7 @@ print-PLIST:
next; \
} \
{ \
- if (/\.info$$/) { \
- print "\@unexec $${INSTALL_INFO} --delete --info-dir=%D/info %D/" $$0; \
- print $$0; \
- print "\@exec $${INSTALL_INFO} --info-dir=%D/info %D/" $$0; \
- } else if (!/^info\/dir$$/) { \
+ if (!/^info\/dir$$/) { \
print $$0; \
} \
}'
diff --git a/mk/buildlink2/bsd.buildlink2.mk b/mk/buildlink2/bsd.buildlink2.mk
index 0add32dfc3d..516105ab99d 100644
--- a/mk/buildlink2/bsd.buildlink2.mk
+++ b/mk/buildlink2/bsd.buildlink2.mk
@@ -1,4 +1,4 @@
-# $NetBSD: bsd.buildlink2.mk,v 1.85 2003/06/19 17:20:41 jschauma Exp $
+# $NetBSD: bsd.buildlink2.mk,v 1.86 2003/06/19 21:41:15 seb Exp $
#
# An example package buildlink2.mk file:
#
@@ -1019,3 +1019,54 @@ ${BUILDLINK_DIR}/${_prog_}: ${_GNU_MISSING}
${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
. endfor
.endfor
+
+.if defined(USE_NEW_TEXINFO)
+# install-info and makeinfo handling.
+#
+.if defined(INFO_FILES)
+# Create an install-info script that is a "no operation" command
+# as registration of info files is handled by the INSTALL script.
+CONFIGURE_ENV+= INSTALL_INFO="${BUILDLINK_DIR}/bin/install-info"
+MAKE_ENV+= INSTALL_INFO="${BUILDLINK_DIR}/bin/install-info"
+
+do-buildlink: hide-install-info
+
+hide-install-info: ${BUILDLINK_DIR}/bin/install-info
+${BUILDLINK_DIR}/bin/install-info:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} "#!${BUILDLINK_SHELL}" > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} '${ECHO} "==> Noop install-info $$*" >> ${_BLNK_WRAP_LOG}' >> ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+
+# Create a makeinfo script that will invoke the right makeinfo
+# command if USE_MAKEINFO is 'yes' or invoke the GNU missing script if not.
+CONFIGURE_ENV+= MAKEINFO="${BUILDLINK_DIR}/bin/makeinfo"
+MAKE_ENV+= MAKEINFO="${BUILDLINK_DIR}/bin/makeinfo"
+
+. if empty(USE_MAKEINFO:M[nN][oO])
+do-buildlink: makeinfo-wrapper
+makeinfo-wrapper: ${BUILDLINK_DIR}/bin/makeinfo
+${BUILDLINK_DIR}/bin/makeinfo:
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} "#!${BUILDLINK_SHELL}" > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} 'echo "${MAKEINFO} $$*" >> ${_BLNK_WRAP_LOG}' >> ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} 'exec ${MAKEINFO} $$*' >> ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. else # !USE_MAKEINFO
+do-buildlink: hide-makeinfo
+hide-makeinfo: ${BUILDLINK_DIR}/bin/makeinfo
+${BUILDLINK_DIR}/bin/makeinfo: ${_GNU_MISSING}
+ ${_PKG_SILENT}${_PKG_DEBUG}${MKDIR} ${.TARGET:H}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} "#!${BUILDLINK_SHELL}" > ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG} \
+ ${ECHO} 'exec ${_GNU_MISSING} makeinfo "$$*"' >> ${.TARGET}
+ ${_PKG_SILENT}${_PKG_DEBUG}${CHMOD} +x ${.TARGET}
+. endif # USE_MAKEINFO
+.endif # INFO_FILES
+.endif # USE_NEW_TEXINFO
diff --git a/mk/install/install-info b/mk/install/install-info
new file mode 100644
index 00000000000..b55194c76a4
--- /dev/null
+++ b/mk/install/install-info
@@ -0,0 +1,25 @@
+# $NetBSD
+#
+# Handle registration of Info files; used by texinfo.mk.
+#
+
+INFO_FILES="@INFO_FILES@"
+INSTALL_INFO="@INSTALL_INFO@"
+INFO_DIR="@INFO_DIR@"
+
+case ${STAGE} in
+POST-INSTALL)
+ for f in ${INFO_FILES}; do
+ ${INSTALL_INFO} --delete --info-dir=${PKG_PREFIX}/${INFO_DIR} \
+ ${PKG_PREFIX}/${INFO_DIR}/${f} 1>/dev/null 2>&1
+ ${INSTALL_INFO} --info-dir=${PKG_PREFIX}/${INFO_DIR} \
+ ${PKG_PREFIX}/${INFO_DIR}/${f}
+ done
+ ;;
+DEINSTALL)
+ for f in ${INFO_FILES}; do
+ ${INSTALL_INFO} --delete --info-dir=${PKG_PREFIX}/${INFO_DIR} \
+ ${PKG_PREFIX}/${INFO_DIR}/${f} 1>/dev/null 2>&1
+ done
+ ;;
+esac
diff --git a/mk/texinfo.mk b/mk/texinfo.mk
index ce0b05cea53..22f31764c90 100644
--- a/mk/texinfo.mk
+++ b/mk/texinfo.mk
@@ -1,11 +1,138 @@
-# $NetBSD: texinfo.mk,v 1.10 2003/05/06 23:43:53 seb Exp $
+# $NetBSD: texinfo.mk,v 1.11 2003/06/19 21:41:15 seb Exp $
#
-# This Makefile fragment is included by packages that provide info files.
+# This Makefile fragment is included by bsd.pkg.mk when INFO_FILES and
+# USE_NEW_TEXINFO are defined.
+#
+# Or...
+#
+# This Makefile fragment is included by packages that provide info files
+# and do not _yet_ use the new framework.
#
.if !defined(TEXINFO_MK)
TEXINFO_MK= # defined
+#
+# This switch is here only until all packages are converted to use
+# the new framework.
+#
+.if defined(USE_NEW_TEXINFO)
+#
+# Handle install-info.
+#
+
+# Use bsd.pkg.install.mk framework i.e. INSTALL/DEINSTALL scripts
+# to handle install-info execution.
+USE_PKGINSTALL= YES
+
+# Pathname relative to ${PREFIX} of directory holding the info
+# files and the Info dir file.
+INFO_DIR?= info
+
+# Does the system have the install-info command?
+# Any version will fit (really?).
+_INSTALL_INFO=
+.for _i_ in /usr/bin/install-info /sbin/install-info
+. if exists(${_i_})
+_INSTALL_INFO= ${_i_}
+. endif
+.endfor
+
+# If no install-info was found provide one with the pkg_install-info package.
+# And set INSTALL_INFO to the install-info command it provides.
+.if empty(_INSTALL_INFO)
+_PKG_INSTALL_INFO_PREFIX_DEFAULT= ${LOCALBASE}
+DEPENDS+= pkg_install-info-[0-9]*:../../pkgtools/pkg_install-info
+EVAL_PREFIX+= _PKG_INSTALL_INFO_PREFIX=pkg_install-info
+INSTALL_INFO= ${_PKG_INSTALL_INFO_PREFIX}/bin/pkg_install-info
+.else
+INSTALL_INFO= ${_INSTALL_INFO}
+.endif
+
+# Generate INSTALL/DEINSTALL scripts code for handling install-info.
+INSTALL_EXTRA_TMPL+= ${.CURDIR}/../../mk/install/install-info
+DEINSTALL_EXTRA_TMPL+= ${.CURDIR}/../../mk/install/install-info
+FILES_SUBST+= INFO_FILES=${INFO_FILES:Q}
+FILES_SUBST+= INSTALL_INFO=${INSTALL_INFO:Q}
+FILES_SUBST+= INFO_DIR=${INFO_DIR:Q}
+
+# When not using buildlink2 set INSTALL_INFO in environment to ${ECHO}
+# so the package build/install step does not register itself the info
+# files as this is the job of the INSTALL script.
+# WARNING: this is far from being failsafe.
+# When not using buildlink2 patch files so that install-info is _not_
+# run are likely to be needed.
+.if !empty(USE_BUILDLINK2:M[nN][oO])
+CONFIGURE_ENV+= INSTALL_INFO="${TRUE}"
+MAKE_ENV+= INSTALL_INFO="${TRUE}"
+.endif
+
+#
+# Handle makeinfo if requested.
+#
+
+# Minimum required version for the GNU makeinfo command.
+TEXINFO_REQD?= 3.12
+
+# By default makeinfo is not needed for building.
+USE_MAKEINFO?= NO
+
+.if empty(USE_MAKEINFO:M[nN][oO])
+
+# Does the system has a makeinfo command?
+_MAKEINFO=
+. for _i_ in /usr/bin/makeinfo
+. if exists(${_i_})
+_MAKEINFO= ${_i_}
+. endif
+. endfor
+
+# Record makeinfo's version.
+# If makeinfo's version contains useful information outside [0-9].[0-9],
+# the following would have to be changed as well as the comparison below.
+. if !empty(_MAKEINFO) && !defined(MAKEINFO_VERSION)
+MAKEINFO_VERSION_OUTPUT!= ${_MAKEINFO} --version 2>/dev/null || ${ECHO}
+MAKEINFO_VERSION=${MAKEINFO_VERSION_OUTPUT:M[0-9]*.[0-9]*:C/[^0-9.]//}
+MAKEFLAGS+= MAKEINFO_VERSION=${MAKEINFO_VERSION}
+. endif
+
+# Sort out if the version provided by devel/gtexinfo is needed.
+# If it is add it as build time dependency and set MAKEINFO
+# to the makeinfo it provides.
+# Here it is assumed devel/gtexinfo's makeinfo version will be
+# superior or equal to TEXINFO_REQD.
+_NEED_TEXINFO= YES
+. if defined(MAKEINFO_VERSION) && ${MAKEINFO_VERSION} >= ${TEXINFO_REQD}
+_NEED_TEXINFO= NO
+. endif
+. if !empty(_NEED_TEXINFO:M[yY][eE][sS])
+BUILD_DEPENDS+= gtexinfo>=${TEXINFO_REQD}:../../devel/gtexinfo
+_GTEXINFO_PREFIX_DEFAULT= ${LOCALBASE}
+EVAL_PREFIX+= _GTEXINFO_PREFIX=gtexinfo
+MAKEINFO= ${_GTEXINFO_PREFIX}/bin/makeinfo
+. else
+MAKEINFO= ${_MAKEINFO}
+. endif
+
+# When not using buildlink2 set MAKEINFO in environment to the pathname
+# of the right makeinfo command.
+. if !empty(USE_BUILDLINK2:M[nN][oO])
+CONFIGURE_ENV+= MAKEINFO="${MAKEINFO}"
+MAKE_ENV+= MAKEINFO="${MAKEINFO}"
+. endif
+
+.else # !USE_MAKEINFO
+# When not using buildlink2 set MAKEINFO in environment to ${FALSE}
+. if !empty(USE_BUILDLINK2:M[nN][oO])
+CONFIGURE_ENV+= MAKEINFO="${FALSE}"
+MAKE_ENV+= MAKEINFO="${FALSE}"
+. endif
+.endif # USE_MAKEINFO
+
+##############################################################
+.else # !USE_NEW_TEXINFO
+# Obsolete handling below... Will go away ASAP.
+
# Does the system have the GNU texinfo tools and if yes, what version are they?
_INSTALL_INFO=
.for _i_ in /usr/bin/install-info /sbin/install-info
@@ -15,7 +142,7 @@ _INSTALL_INFO= ${_i_}
.endfor
.if !empty(_INSTALL_INFO)
. if !defined(INSTALL_INFO_VERSION)
-_INSTALL_INFO_VERSION_OUTPUT!= ${_INSTALL_INFO} --version 2>/dev/null
+_INSTALL_INFO_VERSION_OUTPUT!= ${_INSTALL_INFO} --version 2>/dev/null || ${ECHO}
# If the install-info version contains useful information outside [0-9].[0-9],
# the following would have to be changed as well as the comparison below
INSTALL_INFO_VERSION=${_INSTALL_INFO_VERSION_OUTPUT:M[0-9]*.[0-9]*:C/[^0-9.]//}
@@ -87,4 +214,6 @@ texinfo-override:
done )
.endif # TEXINFO_OVERRIDE
+.endif # USE_NEW_TEXINFO
+
.endif # TEXINFO_MK