Use default config filename for po4a-build.
git-svn-id: http://emdebian.org/svn/current@6702 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
parent
7fffa79748
commit
836506554e
4 changed files with 4 additions and 353 deletions
4
Makefile
4
Makefile
|
@ -7,7 +7,7 @@ all: docbuild
|
|||
$(MAKE) -C po
|
||||
|
||||
docbuild:
|
||||
po4a-build -f manpages.conf
|
||||
po4a-build
|
||||
|
||||
install:
|
||||
$(MAKE) -C po install DESTDIR=../debian/multistrap
|
||||
|
@ -19,5 +19,5 @@ clean:
|
|||
|
||||
# adds the POT file to the source tarball
|
||||
native-dist: Makefile
|
||||
po4a-build --pot-only -f manpages.conf
|
||||
po4a-build --pot-only
|
||||
$(MAKE) -C po pot
|
||||
|
|
3
debian/changelog
vendored
3
debian/changelog
vendored
|
@ -13,8 +13,9 @@ emdebian-rootfs (2.0.4) unstable; urgency=low
|
|||
around dash and dpkg-divert issue. Use dpkg -X to avoid problems
|
||||
with data.tar.bz2 and check that the /bin/sh symlink exists.
|
||||
* Switch to po4a-build for manpage generation and translation.
|
||||
* Use default config filename for po4a-build.
|
||||
|
||||
-- Neil Williams <codehelp@debian.org> Mon, 23 Nov 2009 21:17:35 +0000
|
||||
-- Neil Williams <codehelp@debian.org> Tue, 24 Nov 2009 08:37:09 +0000
|
||||
|
||||
emdebian-rootfs (2.0.3) unstable; urgency=low
|
||||
|
||||
|
|
350
genmanpages
350
genmanpages
|
@ -1,350 +0,0 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Copyright (C) 2006-2009 Neil Williams <codehelp@debian.org>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# DEFAULTS:
|
||||
# name and location of the config file
|
||||
# relative to the top level source directory of the translations
|
||||
# i.e. the directory containing ./po/
|
||||
CONFIG="po4a.config"
|
||||
# PODIR po directory for manpages/docs
|
||||
PODIR="po"
|
||||
# POTFILE path
|
||||
POTFILE=""
|
||||
# base directory for generated files, e.g. doc
|
||||
BASEDIR=""
|
||||
# the binary packages that will contain generated manpages
|
||||
BINARIES=""
|
||||
# the Docbook XML manpages for Section 3.
|
||||
XMLMAN3=""
|
||||
# the binary packages using DocBook XML & xsltproc
|
||||
XMLPACKAGES=""
|
||||
# the DocBook XML files for Section 1.
|
||||
XMLMAN1=""
|
||||
# the pattern to find the XML files
|
||||
XMLDIR=""
|
||||
# the pattern to find the .docbook files
|
||||
DOCBOOKDIR=""
|
||||
# the XSL file to use for Docbook XSL
|
||||
XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
|
||||
# the POD files for man1
|
||||
PODFILE=""
|
||||
# the POD files for man3/ - module names regenerated from the path.
|
||||
PODMODULES=""
|
||||
# POD files for section 7
|
||||
POD7FILES=""
|
||||
# the binary packages using POD
|
||||
PODPACKAGES=""
|
||||
# html output (subdirectory of BASEDIR)
|
||||
HTMLDIR=""
|
||||
# html DocBook file
|
||||
HTMLFILE=""
|
||||
# the XSL file to use for Docbook XSL
|
||||
HTMLXSL="http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl"
|
||||
# Minimal threshold for translation percentage to keep
|
||||
KEEP=
|
||||
|
||||
# remember to add something to the clean:: rule in debian/rules
|
||||
# to remove each binary package sub-directory.
|
||||
# $(RM) -r doc/emdebian-rootfs doc/multistrap
|
||||
|
||||
# below this point, no changes should be needed.
|
||||
|
||||
# use a default manpages.cnf in the current directory.
|
||||
FILE="manpages.conf"
|
||||
|
||||
wrap_langs () {
|
||||
if [ -z "$LANGS" ]; then
|
||||
echo "$1 $2" >> $CONFIG
|
||||
else
|
||||
echo "$1 $2 $3" >> $CONFIG
|
||||
fi
|
||||
}
|
||||
|
||||
usagehelp () {
|
||||
# print out help message
|
||||
cat <<EOF
|
||||
genmanpages - po4a frontend
|
||||
|
||||
Syntax: genmanpages
|
||||
genmanpages --pot-only
|
||||
|
||||
Commands:
|
||||
-?|-h|--help|-version: print this help message and exit
|
||||
--pot-only: only create the POT file
|
||||
|
||||
Options:
|
||||
-f|--file FILE: manpages.conf config file path
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
--help|-h|-\?|--version)
|
||||
echo usagehelp
|
||||
exit;
|
||||
;;
|
||||
--pot-only)
|
||||
POTONLY=1
|
||||
shift
|
||||
;;
|
||||
-f|--file)
|
||||
shift
|
||||
FILE=$1
|
||||
shift
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognised command: $1"
|
||||
exit;
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ ! -f "$FILE" ]; then
|
||||
# without config, there's nothing to do.
|
||||
echo "Cannot find config file! '$FILE'";
|
||||
exit 3
|
||||
else
|
||||
. ./$FILE
|
||||
fi
|
||||
OURS=`pwd|tr -d '\n'`
|
||||
cd `dirname $FILE`
|
||||
|
||||
# calculate the langs, automatically.
|
||||
LANGS=`ls $PODIR/*.po 2>/dev/null || true`
|
||||
if [ ! -z "$LANGS" ]; then
|
||||
LANGS=`ls $PODIR/*.po | sed -e 's/.*\/\(.*\)\.po/\1 /' || true`
|
||||
fi
|
||||
if [ ! -z "$LANGS" ]; then
|
||||
LANGS=`echo $LANGS|tr -d '\n'`
|
||||
echo "[po4a_langs] $LANGS" > $CONFIG
|
||||
else
|
||||
echo > $CONFIG
|
||||
fi
|
||||
wrap_langs "[po4a_paths]" "$POTFILE" "\$lang:$PODIR/\$lang.po"
|
||||
|
||||
if [ -n "$XMLDIR" ]; then
|
||||
for file in $XMLDIR/*.xml; do
|
||||
LOCAL=`basename $file`
|
||||
wrap_langs "[type:docbook]" "$file" "\$lang:$XMLDIR/\$lang/$LOCAL"
|
||||
done
|
||||
fi
|
||||
if [ -n "$DOCBOOKDIR" ]; then
|
||||
for file in $DOCBOOKDIR; do
|
||||
LOCAL=`basename $file`
|
||||
wrap_langs "[type:docbook]" "$file" "\$lang:$BASEDIR/\$lang/$LOCAL"
|
||||
done
|
||||
fi
|
||||
if [ -n "$PODFILE" ]; then
|
||||
for file in $PODFILE; do
|
||||
LOCAL=`basename $file`
|
||||
wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/1/\$lang/$LOCAL"
|
||||
done
|
||||
fi
|
||||
if [ -n "$POD7FILES" ]; then
|
||||
for file in $POD7FILES; do
|
||||
LOCAL=`basename $file`
|
||||
wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/7/\$lang/$LOCAL"
|
||||
done
|
||||
fi
|
||||
if [ -n "$PODMODULES" ]; then
|
||||
for file in $PODMODULES; do
|
||||
wrap_langs "[type:pod]" "$file" "\$lang:$BASEDIR/pod/3/\$lang/$file"
|
||||
done
|
||||
fi
|
||||
|
||||
if [ "$POTONLY" = "1" ]; then
|
||||
# Allow internal builds within po4a
|
||||
if [ "$USE_INTERNAL_PO4A" = "yes" ]; then
|
||||
echo "Internal po4a from $OURS being used instead of /usr/bin/"
|
||||
PERL5LIB=$OURS/lib perl $OURS/po4a --no-translations $CONFIG
|
||||
else
|
||||
po4a --no-translations $CONFIG
|
||||
fi
|
||||
exit
|
||||
fi
|
||||
|
||||
for d in $BINARIES; do
|
||||
for l in $LANGS; do
|
||||
mkdir -p $BASEDIR/$d/man/$l/man1/
|
||||
if [ "$d" = "$XMLsMAN3" ]; then
|
||||
mkdir -p $BASEDIR/$d/man/$l/man3/
|
||||
fi
|
||||
if [ -n "$PODMODULES" ]; then
|
||||
mkdir -p $BASEDIR/$d/man/$l/man3/
|
||||
fi
|
||||
if [ -n "$HTMLDIR" ]; then
|
||||
mkdir -p $BASEDIR/$d/$l/$HTMLDIR/
|
||||
fi
|
||||
if [ -n "$POD7FILES" ]; then
|
||||
mkdir -p $BASEDIR/$d/man/$l/man7/
|
||||
fi
|
||||
done
|
||||
mkdir -p $BASEDIR/$d/man/man1/
|
||||
if [ "$d" = "$XMLMAN3" ]; then
|
||||
mkdir -p $BASEDIR/$d/man/man3/
|
||||
fi
|
||||
mkdir -p $BASEDIR/pod/$l/
|
||||
if [ -n "$PODMODULES" ]; then
|
||||
mkdir -p $BASEDIR/$d/man/man3/
|
||||
fi
|
||||
if [ -n "$POD7FILES" ]; then
|
||||
mkdir -p $BASEDIR/$d/man/man7/
|
||||
fi
|
||||
done
|
||||
|
||||
# use -k to create all XML even if untranslated or the XSL breaks the build.
|
||||
if [ -n "$KEEP" ]; then
|
||||
K="-k $KEEP"
|
||||
fi
|
||||
|
||||
# Allow internal builds within po4a
|
||||
if [ "$USE_INTERNAL_PO4A" = "yes" ]; then
|
||||
echo "Internal po4a from $OURS being used instead of /usr/bin/"
|
||||
PERL5LIB=$OURS/lib perl $OURS/po4a $K $CONFIG
|
||||
else
|
||||
po4a $K $CONFIG
|
||||
fi
|
||||
|
||||
for d in $BINARIES; do
|
||||
for P in $XMLPACKAGES; do
|
||||
if [ $d = $P ]; then
|
||||
for X in $XMLMAN1; do
|
||||
echo "Processing untranslated files for $X (1). . ."
|
||||
MANDIR=$BASEDIR/$P/man/man1/
|
||||
XML_CATALOG_FILES="/etc/xml/catalog" \
|
||||
xsltproc -o $MANDIR --nonet $XSLFILE $XMLDIR/$X
|
||||
done
|
||||
for X3 in $XMLMAN3; do
|
||||
echo "Processing untranslated files for $X3 (3). . ."
|
||||
MANDIR=$BASEDIR/$P/man/man3/
|
||||
XML_CATALOG_FILES="/etc/xml/catalog" \
|
||||
xsltproc -o $MANDIR --nonet $XSLFILE $XMLDIR/$X3
|
||||
done
|
||||
fi
|
||||
done
|
||||
for POD in $PODPACKAGES; do
|
||||
if [ $d = "$POD" ]; then
|
||||
for file in $PODFILE; do
|
||||
LOCAL=`basename $file`
|
||||
echo "Processing untranslated files for $file (1) . . ."
|
||||
pod2man $file $BASEDIR/$POD/man/man1/$LOCAL.1
|
||||
done
|
||||
if [ -n "$PODMODULES" ]; then
|
||||
for file in $PODMODULES; do
|
||||
# a bit of sed magic to convert a path to a module name.
|
||||
name=`echo $file| sed -e 's/^lib\///'|sed -e 's/\//::/g'|sed -e 's/\.pm$//'`
|
||||
echo "Processing untranslated files for $name (3) . . ."
|
||||
pod2man $file $BASEDIR/$POD/man/man3/$name.3
|
||||
done
|
||||
fi
|
||||
if [ -n "$POD7FILES" ]; then
|
||||
for file in $POD7FILES; do
|
||||
LOCAL=`basename $file`
|
||||
echo "Processing untranslated files for $file (7) . . ."
|
||||
# shorten names that already contain the 7.
|
||||
SHORT=`echo $LOCAL|cut -d'7' -f1|tr -d .`
|
||||
if [ -n "$SHORT" ]; then
|
||||
pod2man -s 7 $file $BASEDIR/$POD/man/man7/${SHORT}.7
|
||||
else
|
||||
pod2man -s 7 $file $BASEDIR/$POD/man/man7/${LOCAL}.7
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
done
|
||||
if [ -n "$HTMLDIR" ]; then
|
||||
xsltproc -o $BASEDIR/$d/$HTMLDIR/ --nonet $HTMLXSL $XMLDIR/$HTMLFILE
|
||||
fi
|
||||
for l in $LANGS; do
|
||||
for P in $XMLPACKAGES; do
|
||||
if [ $d = "$P" ]; then
|
||||
for X in $XMLMAN1; do
|
||||
if [ -f $XMLDIR/$l/$X ]; then
|
||||
echo "Processing $l translations for $X (1). . ."
|
||||
MANDIR=$BASEDIR/$P/man/$l/man1/
|
||||
XML_CATALOG_FILES="/etc/xml/catalog" \
|
||||
xsltproc -o $MANDIR --nonet $XSLFILE $XMLDIR/$X
|
||||
fi
|
||||
done
|
||||
for X3 in $XMLMAN3; do
|
||||
if [ -f $XMLDIR/$l/$X3 ]; then
|
||||
echo "Processing $l translations for $X3 (3). . ."
|
||||
MANDIR=$BASEDIR/$P/man/$l/man3/
|
||||
XML_CATALOG_FILES="/etc/xml/catalog" \
|
||||
xsltproc -o $MANDIR --nonet $XSLFILE $XMLDIR/$X3
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
for POD in $PODPACKAGES; do
|
||||
if [ $d = "$POD" ]; then
|
||||
for file in $PODFILE; do
|
||||
LOCAL=`basename $file`
|
||||
if [ -f $BASEDIR/pod/1/$l/$LOCAL ]; then
|
||||
echo "Processing $l translations for $file (1). . ."
|
||||
pod2man $BASEDIR/pod/1/$l/$LOCAL $BASEDIR/$POD/man/$l/man1/$LOCAL.1
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ -n "$PODMODULES" ]; then
|
||||
for file in $PODMODULES; do
|
||||
# a bit of sed magic to convert a path to a module name.
|
||||
name=`echo $file| sed -e 's/^lib\///'|sed -e 's/\//::/g'|sed -e 's/\.pm$//'`
|
||||
if [ -f $BASEDIR/pod/3/$l/$file ]; then
|
||||
echo "Processing $l translations for $name (3). . ."
|
||||
pod2man $BASEDIR/pod/3/$l/$file $BASEDIR/$POD/man/$l/man3/$name.3
|
||||
fi
|
||||
done
|
||||
fi
|
||||
if [ -n "$POD7FILES" ]; then
|
||||
for file in $POD7FILES; do
|
||||
LOCAL=`basename $file`
|
||||
if [ -f $BASEDIR/pod/7/$l/$LOCAL ]; then
|
||||
echo "Processing $l translations for $file (7). . ."
|
||||
# shorten names that already contain the 7.
|
||||
SHORT=`echo $LOCAL|cut -d'7' -f1|tr -d .`
|
||||
if [ -n "$SHORT" ]; then
|
||||
pod2man -s 7 $BASEDIR/pod/7/$l/$LOCAL $BASEDIR/$POD/man/$l/man7/${SHORT}.7
|
||||
else
|
||||
pod2man -s 7 $BASEDIR/pod/7/$l/$LOCAL $BASEDIR/$POD/man/$l/man7/$LOCAL.7
|
||||
fi
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done
|
||||
if [ -n "$HTMLDIR" ]; then
|
||||
mkdir -p $BASEDIR/$d/$HTMLDIR/$l/
|
||||
xsltproc -o $BASEDIR/$d/$HTMLDIR/$l/ --nonet $HTMLXSL $XMLDIR/$l/$HTMLFILE
|
||||
fi
|
||||
done
|
||||
if [ -n "$HTMLDIR" ]; then
|
||||
for i in `ls $BASEDIR/$d/$HTMLDIR/*.html`; do
|
||||
iconv -t utf-8 -f iso8859-1 $i > $BASEDIR/$HTMLDIR/tmp
|
||||
sed < $BASEDIR/$HTMLDIR/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'
|
||||
done
|
||||
fi
|
||||
if [ -n "$HTMLDIR" ]; then
|
||||
rm -f $BASEDIR/$HTMLDIR/tmp
|
||||
fi
|
||||
done
|
||||
|
||||
for l in $LANGS; do
|
||||
rm -rf $XMLDIR/$l
|
||||
done
|
||||
rm -rf $BASEDIR/pod/
|
Loading…
Reference in a new issue