Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 09 Oct 2000 11:22:22 +0300
From:      Maxim Sobolev <sobomax@FreeBSD.org>
To:        ports@FreeBSD.org
Cc:        asami@FreeBSD.org
Subject:   PROPOSAL: Handling of GNU Texinfo documentation in bsd.port.mk [patch]
Message-ID:  <39E1803D.7A049B1D@FreeBSD.org>

next in thread | raw e-mail | index | archive | help
This is a multi-part message in MIME format.
--------------1486476D245C0406F5854465
Content-Type: text/plain; charset=koi8-r
Content-Transfer-Encoding: 7bit

Hi there,

I suppose that anyone here aware that handling of GNU Texinfo documentation in
our port system is quite suboptimal - the port authors required to insert
appropriate post-install targets and @unexec/@exec directives by hand, while
this process could be quite easily automated. The following patch is expected
to solve the problem by introducing new INFOPAGES make variable, so for most
cases you just need to list info pages installed by the port in INFOPAGES and
forget about it (no more post-install/@exec/@unexec), for example if the port
installs foo.info and bar.info you just need the following in Makefile:

[...]
INFOPAGES=    foo bar
[...]

In more complex cases, when the installed infopages for some strange reason
don't contain information required for install-info(1) to register those pages
into info/dir directory file, you may need something like the following:

[...]
INFOPAGES=    foo%"Utilities"%"* Foo: (foo).    Foo manual" \
                            bar%"Utilities"%"* Bar: (bar).    Bar manual"

As usually any comments/suggestions are welcomed.

-Maxim



--------------1486476D245C0406F5854465
Content-Type: text/plain; charset=koi8-r;
 name="bsd.port.mk-ingopages.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="bsd.port.mk-ingopages.diff"

--- bsd.port.mk	2000/10/08 18:05:35	1.1
+++ bsd.port.mk	2000/10/08 20:29:11
@@ -293,6 +293,16 @@
 #				  NOMANCOMPRESS.  The default is "yes" if USE_IMAKE
 #				  is set and NO_INSTALL_MANPAGES is not set, and
 #				  "no" otherwise.
+# INFOPAGES		- A list of GNU Texinfo pages installed by the port. The
+#				  format for entries is the following:
+#				  name[%[section]%[entry]]. For example if your port has
+#				  "info/foo.info" and "info/bar.info", set
+#				  "INFOPAGES=foo bar". Optional section and entry fields
+#				  provided for the cases when info page doesn't contain
+#				  information required for install-info(1) to correctly
+#				  register the page into catalog of info pages. In this
+#				  case use something like the following:
+#				  ``INFOPAGES=foo%"Bar utilities"%"* Foo: (foo).	Foo utility"''
 #
 # Default targets and their behaviors:
 #
@@ -949,6 +959,7 @@
 AUTOCONF?=		autoconf
 LIBTOOL?=		libtool
 XMKMF?=			xmkmf -a
+INSTALL-INFO?=	/usr/bin/install-info
 .if exists(/sbin/md5)
 MD5?=			/sbin/md5
 .elif exists(/bin/md5)
@@ -1423,6 +1434,11 @@
 .endif
 .endif
 
+INFOPREFIX?=	${PREFIX}
+INFOSUBDIR?=	info
+LOCALINFODIR?=	${PREFIX}/${INFOSUBDIR}/dir
+INFO_SUFX?=		.info
+
 # Put this for down as possible so it will catch all PLIST_SUB definitions.
 
 .if defined(INSTALLS_SHLIB)
@@ -2076,6 +2092,27 @@
 .if make(real-install) && (defined(_MANPAGES) || defined(_MLINKS))
 	@cd ${.CURDIR} && ${MAKE} ${__softMAKEFLAGS} compress-man
 .endif
+.if make(real-install) && defined(INFOPAGES)
+	@${ECHO_MSG} "===>   Registering infopages"
+	@for i in ${INFOPAGES}; do \
+		INFOPAGE=`${ECHO} "$${i}" | ${AWK} --field-separator "%" '{ print $$1 }'`; \
+		INFOSECTION=`${ECHO} "$${i}" | ${AWK} --field-separator "%" '{ print $$2 }'`; \
+		INFOENTRY=`${ECHO} "$${i}" | ${AWK} --field-separator "%" '{ print $$3 }'`;\
+		_INFOPAGE=""; \
+		_INFOSECTION="--quiet"; \
+		_INFOENTRY="--quiet"; \
+		if [ x"$${INFOPAGE}" != x"" ]; then \
+			_INFOPAGE=${INFOPREFIX}/${INFOSUBDIR}/$${INFOPAGE}${INFO_SUFX}; \
+			if [ x"$${INFOSECTION}" != x"" ]; then \
+				_INFOSECTION="--section=$${INFOSECTION}"; \
+			fi; \
+			if [ x"$${INFOENTRY}" != x"" ]; then \
+				_INFOENTRY="--entry=$${INFOENTRY}"; \
+			fi; \
+			${INSTALL-INFO} "$${_INFOSECTION}" "$${_INFOENTRY}" $${_INFOPAGE} ${LOCALINFODIR}; \
+		fi; \
+	done
+.endif
 .if make(real-install) && defined(INSTALLS_SHLIB)
 	@${ECHO_MSG} "===>   Running ldconfig"
 	${LDCONFIG} -m ${LDCONFIG_RUNLIST}
@@ -2929,6 +2966,28 @@
 	@for man in ${__MANPAGES}; do \
 		${ECHO} $${man} >> ${TMPPLIST}; \
 	done
+.if defined(INFOPAGES)
+	@for i in ${INFOPAGES}; do \
+		INFOPAGE=`${ECHO} "$${i}" | ${AWK} --field-separator "%" '{ print $$1 }'`; \
+		INFOSECTION=`${ECHO} "$${i}" | ${AWK} --field-separator "%" '{ print $$2 }'`; \
+		INFOENTRY=`${ECHO} "$${i}" | ${AWK} --field-separator "%" '{ print $$3 }'`;\
+		_INFOPAGE=""; \
+		_INFOSECTION=""; \
+		_INFOENTRY=""; \
+		if [ x"$${INFOPAGE}" != x"" ]; then \
+			_INFOPAGE=${INFOSUBDIR}/$${INFOPAGE}${INFO_SUFX}; \
+			if [ x"$${INFOSECTION}" != x"" ]; then \
+				_INFOSECTION="--section=\"${INFOSECTION}\""; \
+			fi; \
+			if [ x"$${INFOENTRY}" != x"" ]; then \
+				_INFOENTRY="--entry=\"$${INFOENTRY}\""; \
+			fi; \
+			(${ECHO} "@unexec ${INSTALL-INFO} --delete %D/$${_INFOPAGE} ${LOCALINFODIR}"; \
+			 ${ECHO} $${_INFOPAGE}; \
+			 ${ECHO} "@exec ${INSTALL-INFO} $${_INFOSECTION} $${_INFOENTRY} %D/$${_INFOPAGE} ${LOCALINFODIR}") >> ${TMPPLIST}; \
+		fi; \
+	done
+.endif
 .for _PREFIX in ${PREFIX}
 .if ${_TMLINKS:M${_PREFIX}*}x != x
 	@for i in ${_TMLINKS:M${_PREFIX}*:S,^${_PREFIX}/,,}; do \

--------------1486476D245C0406F5854465--



To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?39E1803D.7A049B1D>