Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 17 Nov 2006 01:31:37 -0800
From:      Nick Barkas <snb@threerings.net>
To:        freebsd-ports@freebsd.org
Subject:   installing partially translated man pages
Message-ID:  <AC5E84BC-302B-490C-B3D4-9814FD0CA149@threerings.net>

next in thread | raw e-mail | index | archive | help

--Apple-Mail-3-765103871
Content-Transfer-Encoding: 7bit
Content-Type: text/plain;
	charset=US-ASCII;
	delsp=yes;
	format=flowed

I've been working on an update to the archivers/dpkg port (see PR  
105560) and am having some trouble with installing translated man  
pages. The latest version of dpkg includes and installs translations  
of *some* manual pages to several languages, but not all of the pages  
are translated. Using MANLANG and MAN<section> in the port's Makefile  
doesn't work so well for the partially translated languages, as make  
will try to compress or remove the man pages that are still  
untranslated, and hence didn't ever get installed.

Currently my updated port uses the default MANLANG of "" to only  
track the English versions of the man pages using various MAN  
variables, and simply notes the translated man pages in the pkg-plist  
file. This is less than optimal since the non-English man pages do  
not get compressed. Portlint -A will complain, too.

I looked through the list archives and saw that this sort of problem  
has been brought up a couple of times before. One potential solution  
was presented here: http://lists.freebsd.org/mailman/htdig/freebsd- 
ports/2005-May/023688.html. I decided to go ahead and implement  
something like that, and it seems to have worked out ok. In addition  
to using MANLANG and MAN<section> to specify a group of man pages  
installed for all languages, I added a MAN_PARTIAL_TRANSLATIONS  
variable which can be used to list languages for which you have some  
man pages, but not all those listed in MAN<section>. Also, I added  
support for using MAN<section>_<language variables to list the man  
pages the port does install for a given language. Here's an example:  
if you have English man pages foo.1 and bar.1, and only foo.1 in  
German, you could do this:

MANLANG=	""
MAN1=		foo.1 bar.1
MAN_PARTIAL_TRANSLATIONS=	de
MAN1_DE=	foo.1

I've tested this change with the partially translated man pages  
provided with dpkg, and it seems to work. Attached is a patch to  
bsd.port.mk that makes this work. It should be completely backwards  
compatible. I have not (yet) added any support for MLINKS in the  
partially translated man pages. Also, there is currently no support  
for installing English man pages with MAN_PARTIAL_TRANSLATIONS, but  
this can be worked around by just using MANLANG and MAN<section> for  
English translations and MAN_PARTIAL_TRANSLATIONS for whatever your  
port's primary man page language is, if that isn't English.

Any thoughts on whether this would be a good change? I will file a PR  
with my patch tomorrow unless someone has a better solution.

Nick


--Apple-Mail-3-765103871
Content-Transfer-Encoding: 7bit
Content-Type: application/octet-stream; x-unix-mode=0644;
	name=bsd.port.mk.patch
Content-Disposition: attachment;
	filename=bsd.port.mk.patch

--- bsd.port.mk.orig	Sat Sep 30 12:25:45 2006
+++ bsd.port.mk	Thu Nov 16 21:52:23 2006
@@ -621,6 +621,20 @@
 #				  Default: "yes" if USE_IMAKE is set and NO_INSTALL_MANPAGES
 #				  is not set, and "no" otherwise.
 #
+# MAN_PARTIAL_TRANSLATIONS 
+#				- Use this to define a list of two letter codes for langauges 
+#				  your port has one or more man page translations for, but not 
+#				  every page that is defined in the MAN<sect> variables.
+# MAN<sect>_<lang>
+#				- These variables define the man pages your port only installs 
+#				  some pages for. For example, if you have English man pages 
+#				  foo.1 and bar.1, and and only the foo.1 man page in German, 
+#				  you would set 
+#					MANLANG=	""
+#				  	MAN1=		foo.1 bar.1
+#					MAN_PARTIAL_TRANSLATIONS=	de 
+#					MAN1_DE=	foo.1
+#
 # Set the following to specify all .info files your port installs.
 #
 # INFO			- A list of .info files (omitting the trailing ".info");
@@ -2959,6 +2973,14 @@
 .endif
 .endfor
 
+.endfor
+
+.for mantrans in ${MAN_PARTIAL_TRANSLATIONS}
+.for sect in 1 2 3 4 5 6 7 8 9 L N
+.if defined(MAN${sect}_${mantrans:U})
+_MANPAGES+=	${MAN${sect}_${mantrans:U}:S%^%${MAN${sect}PREFIX}/man/${mantrans}/man${sect:L}/%}
+.endif
+.endfor
 .endfor
 
 .if !defined(_TMLINKS)

--Apple-Mail-3-765103871--



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?AC5E84BC-302B-490C-B3D4-9814FD0CA149>