svn commit: r51106 - head/share/mk

Wolfram Schneider <[email protected]>
Newsgroups gmane.os.freebsd.devel.cvs.doc
Message-ID <[email protected]>
Author: wosch
Date: Thu Oct 12 14:13:48 2017
New Revision: 51106
URL: https://svnweb.freebsd.org/changeset/doc/51106

Log:
  refactor translation to a new make file "doc.translate.mk"
  
  PR: 222939

Added:
  head/share/mk/doc.translate.mk   (contents, props changed)
Modified:
  head/share/mk/doc.docbook.mk

Modified: head/share/mk/doc.docbook.mk
==============================================================================
--- head/share/mk/doc.docbook.mk	Thu Oct 12 12:59:30 2017	(r51105)
+++ head/share/mk/doc.docbook.mk	Thu Oct 12 14:13:48 2017	(r51106)
@@ -317,75 +317,7 @@ ${DOC}.parsed.xml: ${SRCS} ${XML_INCLUDES}
 	${SED} -i '' -e 's|@@URL_RELPREFIX@@|../../../..|g' ${.TARGET}
 
 # translation -------------------------------------------------------
-
-# Master English document
-MASTERDOC_EN?=	${MASTERDOC:S/${LANGCODE}/en_US.ISO8859-1/}
-TRAN_DIR?=	${MASTERDOC:H}
-EN_DIR?=	${TRAN_DIR:S/${LANGCODE}/en_US.ISO8859-1/}
-PO_LANG?=	${LANGCODE:C/\..*$//}
-PO_CHARSET?=	${LANGCODE:tl:C/^.*\.//:S/^iso/iso-/:S/utf-8/UTF-8/}
-CLEANFILES+=	${DOC}.translate.xml ${PO_LANG}.mo
-
-PO_CATALOG_FILES=	file://${EN_DIR}/catalog-cwd.xml \
-                        file://${EN_DIR:H:H}/share/xml/catalog.xml \
-                        file://${DOC_PREFIX}/share/xml/catalog.xml \
-                        file://${LOCALBASE}/share/xml/catalog
-.if defined(EXTRA_CATALOGS)
-PO_CATALOG_FILES+=     ${EXTRA_CATALOGS}
-.endif
-PO_XMLLINT=	env XML_CATALOG_FILES="${PO_CATALOG_FILES}" ${PREFIX}/bin/xmllint
-
-# fix settings in PO file
-IDSTR1=		$$Free
-IDSTR2=		BSD$$
-POSET_CMD=	${SED} -i '' -e '1s,^,\#${IDSTR1}${IDSTR2}\${.newline},' \
-			     -e 's,^\(\"Language-Team:.*\\n\"\),\1\${.newline}\"Language: ${PO_LANG}\\n\",' \
-			     -e 's,^\"Content-Type: text/plain; charset=.*\\n,\"Content-Type: text/plain; charset=${PO_CHARSET}\\n,'
-
-.if ${.TARGETS:Mpo} || ${.TARGETS:Mtran} || ${.TARGETS:M${DOC}.translate.xml}
-
-MASTER_SRCS!=	${MAKE} -C ${EN_DIR} -V SRCS
-
-${DOC}.translate.xml:
-	@if [ "${TRAN_DIR}" == "${EN_DIR}" ]; then \
-		${ECHO} "build PO file in a non-English dir" ; \
-		exit 1 ; \
-	 fi
-	# some SRCS files might need to be generated, make sure they exist
-	@${MAKE} -C ${EN_DIR} ${MASTER_SRCS} > /dev/null
-	# normalize the English original into a single file
-	@${PO_XMLLINT} --nonet --noent --valid --xinclude ${MASTERDOC_EN} > ${.TARGET}.tmp
-	# remove redundant namespace attributes
-	@${PO_XMLLINT} --nsclean ${.TARGET}.tmp > ${.TARGET}
-	@${RM} ${.TARGET}.tmp
-	@${MAKE} -C ${EN_DIR} clean > /dev/null
-
-po: ${PO_LANG}.po
-.PHONY:	po
-${PO_LANG}.po:	${DOC}.translate.xml
-	@${ITSTOOL} -o ${PO_LANG}.po.tmp ${DOC}.translate.xml
-	@( if [ -f "${PO_LANG}.po" ]; then \
-		echo "${PO_LANG}.po exists, merging" ; \
-		${MSGMERGE} -o ${PO_LANG}.po.new ${PO_LANG}.po ${PO_LANG}.po.tmp ; \
-		${MSGATTRIB} --no-obsolete -o ${PO_LANG}.po.new ${PO_LANG}.po ; \
-		${MV} ${PO_LANG}.po.new ${PO_LANG}.po ; \
-		${RM} ${PO_LANG}.po.tmp ${DOC}.translate.xml ; \
-	  else \
-	  	${ECHO} "${PO_LANG}.po created, please check and correct the settings in the header" ; \
-		${MV} ${PO_LANG}.po.tmp ${PO_LANG}.po ; \
-		${POSET_CMD} ${.TARGET} ; \
-	  fi )
-
-${PO_LANG}.mo:	${PO_LANG}.po
-	@${MSGFMT} -o ${.TARGET} ${.ALLSRC}
-
-tran ${DOC}.xml:	${DOC}.translate.xml ${PO_LANG}.mo
-	@if [ "${TRAN_DIR}" = "${EN_DIR}" ]; then \
-		${ECHO} "build translation in a non-English dir" ; \
-		exit 1 ; \
-	 fi
-	${ITSTOOL} -l ${PO_LANG} -m ${PO_LANG}.mo -o ${DOC}.xml ${DOC}.translate.xml
-.endif
+.include "${DOC_PREFIX}/share/mk/doc.translate.mk"
 
 # XHTML -------------------------------------------------------------
 

Added: head/share/mk/doc.translate.mk
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/share/mk/doc.translate.mk	Thu Oct 12 14:13:48 2017	(r51106)
@@ -0,0 +1,85 @@
+#
+# $FreeBSD$
+#
+# This include file <doc.translate.mk> handles building and installing of
+# DocBook documentation translations in the FreeBSD Documentation Project.
+#
+
+# ------------------------------------------------------------------------
+#
+# Document-specific variables
+# [...]
+#
+
+# translation -------------------------------------------------------
+
+# Master English document
+MASTERDOC_EN?=	${MASTERDOC:S/${LANGCODE}/en_US.ISO8859-1/}
+TRAN_DIR?=	${MASTERDOC:H}
+EN_DIR?=	${TRAN_DIR:S/${LANGCODE}/en_US.ISO8859-1/}
+PO_LANG?=	${LANGCODE:C/\..*$//}
+PO_CHARSET?=	${LANGCODE:tl:C/^.*\.//:S/^iso/iso-/:S/utf-8/UTF-8/}
+CLEANFILES+=	${DOC}.translate.xml ${PO_LANG}.mo
+
+PO_CATALOG_FILES=	file://${EN_DIR}/catalog-cwd.xml \
+                        file://${EN_DIR:H:H}/share/xml/catalog.xml \
+                        file://${DOC_PREFIX}/share/xml/catalog.xml \
+                        file://${LOCALBASE}/share/xml/catalog
+.if defined(EXTRA_CATALOGS)
+PO_CATALOG_FILES+=     ${EXTRA_CATALOGS}
+.endif
+PO_XMLLINT=	env XML_CATALOG_FILES="${PO_CATALOG_FILES}" ${PREFIX}/bin/xmllint
+
+# fix settings in PO file
+IDSTR1=		$$Free
+IDSTR2=		BSD$$
+POSET_CMD=	${SED} -i '' -e '1s,^,\#${IDSTR1}${IDSTR2}\${.newline},' \
+			     -e 's,^\(\"Language-Team:.*\\n\"\),\1\${.newline}\"Language: ${PO_LANG}\\n\",' \
+			     -e 's,^\"Content-Type: text/plain; charset=.*\\n,\"Content-Type: text/plain; charset=${PO_CHARSET}\\n,'
+
+.if ${.TARGETS:Mpo} || ${.TARGETS:Mtran} || ${.TARGETS:M${DOC}.translate.xml}
+
+MASTER_SRCS!=	${MAKE} -C ${EN_DIR} -V SRCS
+
+${DOC}.translate.xml:
+	@if [ "${TRAN_DIR}" == "${EN_DIR}" ]; then \
+		${ECHO} "build PO file in a non-English dir" ; \
+		exit 1 ; \
+	 fi
+	# some SRCS files might need to be generated, make sure they exist
+	@${MAKE} -C ${EN_DIR} ${MASTER_SRCS} > /dev/null
+	# normalize the English original into a single file
+	@${PO_XMLLINT} --nonet --noent --valid --xinclude ${MASTERDOC_EN} > ${.TARGET}.tmp
+	# remove redundant namespace attributes
+	@${PO_XMLLINT} --nsclean ${.TARGET}.tmp > ${.TARGET}
+	@${RM} ${.TARGET}.tmp
+	@${MAKE} -C ${EN_DIR} clean > /dev/null
+
+po: ${PO_LANG}.po
+.PHONY:	po
+${PO_LANG}.po:	${DOC}.translate.xml
+	@${ITSTOOL} -o ${PO_LANG}.po.tmp ${DOC}.translate.xml
+	@( if [ -f "${PO_LANG}.po" ]; then \
+		echo "${PO_LANG}.po exists, merging" ; \
+		${MSGMERGE} -o ${PO_LANG}.po.new ${PO_LANG}.po ${PO_LANG}.po.tmp ; \
+		${MSGATTRIB} --no-obsolete -o ${PO_LANG}.po.new ${PO_LANG}.po ; \
+		${MV} ${PO_LANG}.po.new ${PO_LANG}.po ; \
+		${RM} ${PO_LANG}.po.tmp ${DOC}.translate.xml ; \
+	  else \
+	  	${ECHO} "${PO_LANG}.po created, please check and correct the settings in the header" ; \
+		${MV} ${PO_LANG}.po.tmp ${PO_LANG}.po ; \
+		${POSET_CMD} ${.TARGET} ; \
+	  fi )
+
+${PO_LANG}.mo:	${PO_LANG}.po
+	@${MSGFMT} -o ${.TARGET} ${.ALLSRC}
+
+tran ${DOC}.xml:	${DOC}.translate.xml ${PO_LANG}.mo
+	@if [ "${TRAN_DIR}" = "${EN_DIR}" ]; then \
+		${ECHO} "build translation in a non-English dir" ; \
+		exit 1 ; \
+	 fi
+	${ITSTOOL} -l ${PO_LANG} -m ${PO_LANG}.mo -o ${DOC}.xml ${DOC}.translate.xml
+.endif
+
+
_______________________________________________
[email protected] mailing list
https://lists.freebsd.org/mailman/listinfo/svn-doc-all
To unsubscribe, send any mail to "[email protected]"
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.