generalize the genmanpages code to be more flexible.

git-svn-id: http://emdebian.org/svn/current@6616 563faec7-e20c-0410-992a-a66f704d0ccd
main
codehelp 15 years ago
parent eeb55c9465
commit 75fcb90b68

@ -9,10 +9,7 @@ emdebian.gtk ./usr/share/emdebian-tools/
emdebian.grip ./usr/share/emdebian-tools/
emdebian.gpe ./usr/share/emdebian-tools/
emdebian.coreutils ./usr/share/emdebian-tools/
doc/man/man1/emsandbox.1 ./usr/share/man/man1/
doc/man/pt/man1/emsandbox.1 ./usr/share/man/pt/man1/
doc/man/man3/* ./usr/share/man/man3/
doc/man/pt/man3/* ./usr/share/man/pt/man3/
doc/emdebian-rootfs/man/* ./usr/share/man/
examples/packages.conf ./usr/share/doc/emdebian-rootfs/examples/
examples/setup.sh ./usr/share/doc/emdebian-rootfs/examples/
examples/config.sh ./usr/share/doc/emdebian-rootfs/examples/

@ -1,5 +1,4 @@
em_multistrap ./usr/sbin/
multistrap ./usr/sbin/
doc/man/man1/em_multistrap.1 ./usr/share/man/man1/
doc/man/pt/man1/em_multistrap.1 ./usr/share/man/pt/man1/
doc/multistrap/man/* ./usr/share/man/
bash/multistrap ./etc/bash_completion.d/

3
debian/rules vendored

@ -11,6 +11,5 @@ install/emdebian-rootfs::
po4a --rm-backups doc/po4a.config
clean::
# debconf-updatepo
rm -rf doc/man/man1 doc/man/man3
rm -rf doc/emdebian-rootfs doc/multistrap
rm -rf pod2htmd.tmp pod2htmi.tmp

@ -16,6 +16,33 @@ set -e
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# name and location of the config file
# relative to the top level source directory of the translations
# i.e. the directory containing ./po/
CONFIG="doc/po4a.config"
# POTFILE path
POTFILE="po/emdebian-rootfs.pot"
# the binary packages that will contain generated manpages
BINARIES="emdebian-rootfs multistrap"
# the binary packages with manpages in Section 3.
HASMAN3="emdebian-rootfs"
# the binary packages using DocBook XML & xsltproc
XMLPACKAGES="emdebian-rootfs"
# the DocBook XML files (TODO: let this take paths)
XMLFILE="emdebian-rootfs.1.xml"
# the XSL file to use for Docbook XSL
XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
# the POD files (TODO: let this take paths)
PODFILE="em_multistrap"
# the binary packages using POD
PODPACKAGES="multistrap"
# 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.
wrap_langs () {
if [ -z "$LANGS" ]; then
echo "$1 $2" >> $CONFIG
@ -30,7 +57,7 @@ fi
if [ -f ../po4a.config ]; then
cd ../../
fi
CONFIG="doc/po4a.config"
# calculate the langs, automatically.
LANGS=`ls po/*.po 2>/dev/null || true`
if [ ! -z "$LANGS" ]; then
@ -45,74 +72,73 @@ if [ ! -z "$LANGS" ]; then
else
echo > $CONFIG
fi
wrap_langs "[po4a_paths]" "po/emdebian-rootfs.pot" "\$lang:po/\$lang.po"
# need to determine directory for the target package.
# rootfs only has empbuilderlib.3, emrootfslib.3 and emsandbox.1
wrap_langs "[po4a_paths]" "$POTFILE" "\$lang:po/\$lang.po"
for l in $LANGS; do
mkdir -p doc/html/$l/
mkdir -p doc/man/$l/man1/
mkdir -p doc/man/$l/man3/
for d in $BINARIES; do
for l in $LANGS; do
mkdir -p doc/$d/man/$l/man1/
if [ "$d" = "$HASMAN3" ]; then
mkdir -p doc/$d/man/$l/man3/
fi
done
mkdir -p doc/$d/man/man1/
if [ "$d" = "$HASMAN3" ]; then
mkdir -p doc/$d/man/man3/
fi
mkdir -p doc/pod/$l/
done
mkdir -p doc/html/
mkdir -p doc/man/man3/
mkdir -p doc/man/man1/
echo "Checking emrootfslib for POSIX compatibility"
# doesn't expect a shell library, hence nuisance message
# about interpreter that just needs to be ignored.
checkbashisms emrootfslib
echo "Processing Docbook XML . . . "
for file in `ls doc/xml/*.xml`; do
xmllint --format "$file" --output "$file"
LOCAL=`basename $file`
wrap_langs "[type:docbook]" "$file" "\$lang:doc/xml/\$lang/$LOCAL"
done
echo "Processing POD . . ."
# rootfs
for file in em_multistrap; do
pod2html -outfile doc/html/$file.html -title $file < $file
pod2man $file > doc/man/man1/$file.1
wrap_langs "[type: pod]" "$file" "\$lang:doc/pod/\$lang/$file"
done
echo "Refreshing POT file for translators"
# use -k to create all XML even if untranslated or the XSL breaks the build.
po4a -k 0 $CONFIG
# just make sure the XML catalog is available for XSL.
# never go to the internet for build config, use --nonet.
XML_CATALOG_FILES="/etc/xml/catalog" \
xsltproc -o doc/man/ --nonet \
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \
doc/xml/emdebian-rootfs.1.xml
mv doc/man/empbuilderlib.3 doc/man/man3/empbuilderlib.3
mv doc/man/emrootfslib.3 doc/man/man3/emrootfslib.3
mv doc/man/emsandbox.1 doc/man/man1/emsandbox.1
#mv doc/man/*.1 doc/man/man1/
#mv doc/man/*.3 doc/man/man3/
for d in $BINARIES; do
for P in $XMLPACKAGES; do
for X in $XMLFILE; do
XML_CATALOG_FILES="/etc/xml/catalog" \
xsltproc -o doc/man/ --nonet $XSLFILE doc/xml/$X
done
if [ "$d" = "$HASMAN3" ]; then
mv doc/man/*.3 doc/$d/man/man3/
fi
mv doc/man/*.1 doc/$d/man/man1/
done
for POD in $PODPACKAGES; do
pod2man $POD > doc/$d/man/man1/$POD.1
done
for l in $LANGS; do
for P in $XMLPACKAGES; do
for X in $XMLFILE; do
XML_CATALOG_FILES="/etc/xml/catalog" \
xsltproc -o doc/man/ --nonet $XSLFILE doc/xml/$l/$X
done
if [ "$d" = "$HASMAN3" ]; then
mv doc/man/*.3 doc/$d/man/$l/man3/
fi
mv doc/man/*.1 doc/$d/man/$l/man1/
done
for POD in $PODPACKAGES; do
pod2man doc/pod/$l/$PODFILE > doc/$d/man/$l/man1/$POD.1
done
done
done
for l in $LANGS; do
mkdir -p doc/man/$l/man3/
mkdir -p doc/man/$l/man1/
XML_CATALOG_FILES="/etc/xml/catalog" \
xsltproc -o doc/man/ --nonet \
http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl \
doc/xml/$l/emdebian-rootfs.1.xml
mv doc/man/*.3 doc/man/$l/man3/
mv doc/man/*.1 doc/man/$l/man1/
pod2man doc/pod/$l/em_multistrap > doc/man/$l/man1/em_multistrap.1
xsltproc -o doc/html/$l/ --nonet \
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \
doc/xml/$l/emdebian-rootfs.1.xml
pod2html -outfile doc/html/$l/em_multistrap.html -title em_multistrap < doc/pod/$l/em_multistrap
rm -rf xml/$lang
rm -rf doc/xml/$l
done
rm -rf doc/pod/
# never go to the internet for build config, use -nonet.
# the rest is specific to emdebian-rootfs - ignore.
# HTML versions, not packaged.
xsltproc -o doc/html/ --nonet \
http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl \
doc/xml/emdebian-rootfs.1.xml
@ -122,6 +148,3 @@ for i in `ls doc/html/*.html`; do
sed < doc/html/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'
done
rm -f doc/html/tmp
rm -f pod2htmd.tmp
rm -f pod2htmi.tmp
rm -rf doc/pod/

Loading…
Cancel
Save