diff options
author | Shaun McCance <shaunm@src.gnome.org> | 2006-12-01 17:10:57 +0000 |
---|---|---|
committer | Shaun McCance <shaunm@src.gnome.org> | 2006-12-01 17:10:57 +0000 |
commit | c5037bef7cc0f597d6fb6239564097ef6cfdb88a (patch) | |
tree | c6f85c337666ab8a13e9f6db46eea9ec6bb9183b /tools | |
parent | 72b4797345262f0dfc5e34f71f0e31527dfb32c6 (diff) | |
download | gnome-doc-utils-c5037bef7cc0f597d6fb6239564097ef6cfdb88a.tar.gz |
- Moving files to tools
* Makefile.am:
* configure.in:
* gnome-doc-html.in:
* gnome-doc-prepare.in:
* gnome-doc-utils.pc.in:
* tools/Makefile.am:
* tools/gnome-doc-html.in:
* tools/gnome-doc-prepare.in:
* tools/gnome-doc-utils.pc.in:
- Moving files to tools
Diffstat (limited to 'tools')
-rw-r--r-- | tools/Makefile.am | 18 | ||||
-rwxr-xr-x | tools/gnome-doc-html.in | 218 | ||||
-rw-r--r-- | tools/gnome-doc-prepare.in | 350 | ||||
-rw-r--r-- | tools/gnome-doc-utils.pc.in | 14 |
4 files changed, 597 insertions, 3 deletions
diff --git a/tools/Makefile.am b/tools/Makefile.am index 0e09629..cb1a0a6 100644 --- a/tools/Makefile.am +++ b/tools/Makefile.am @@ -1,9 +1,21 @@ +if ENABLE_BUILD_UTILS + aclocaldir = $(datadir)/aclocal aclocal_DATA = gnome-doc-utils.m4 sharedir = $(datadir)/gnome-doc-utils share_DATA = gnome-doc-utils.make -EXTRA_DIST = \ - $(aclocal_DATA) \ - $(share_DATA) +bin_SCRIPTS = gnome-doc-prepare gnome-doc-html + +endif + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = gnome-doc-utils.pc + +EXTRA_DIST = \ + gnome-doc-html.in \ + gnome-doc-prepare.in \ + gnome-doc-utils.m4 \ + gnome-doc-utils.make \ + gnome-doc-utils.pc.in diff --git a/tools/gnome-doc-html.in b/tools/gnome-doc-html.in new file mode 100755 index 0000000..b6bf3a2 --- /dev/null +++ b/tools/gnome-doc-html.in @@ -0,0 +1,218 @@ +#!/bin/sh +# gnome-doc-html - Convert documentation to HTML +# gnome-doc-html. Generated from gnome-doc-html.in by configure. +# Copyright (C) 2006 Shaun McCance <shaunm@gnome.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 2 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +progname=`echo "$0" | sed 's%^.*/%%'` + +PROGRAM=gnome-doc-html +PACKAGE=@PACKAGE@ +VERSION=@VERSION@ +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +pkgdatadir=@datadir@/gnome-doc-utils +xsltdir=@datadir@/xml/gnome/xslt + +function error { + echo "$progname: $1" 1>&2; + exit 1; +} +function print_help { + echo "Usage: $progname [OPTIONS] FILE" + echo "Convert FILE into HTML." + echo "" + echo "Basic Output Control:" + echo " -c, --css-file=FILE file to output CSS to" + echo " -d, --chunk-depth=INT how deep sections should be chunked" + echo " -e, --extension=EXT the extension to append to output files" + echo " -n, --no-figures do not copy figures into the output directory" + echo " -o, --output=PATH the file or directory to output to" + echo "" + echo "Formatting Control:" + echo " --admon-graphics-path=PATH the path to the admonition graphics" + echo " --admon-graphics-size=INT the size of the admonition graphics" + echo " --admon-graphics-extension=EXT the extension of the admonition grahpics" + echo " --classsynopsis-language=LANG the default programming language to be used" + echo " for classsynopsis elements" + echo " --funcsynopsis-style=STYLE the style to be used to render funcsynopsis" + echo " elements, either 'KR' or 'ANSI'" + echo "" + echo "Miscellaneous:" + echo " -v, --verbose print all the commands executed" + echo " -V, --version print version information and exit" + echo " -h, --help display this help and exit" +} +function echo_verbose { + if [ "x$doc_verbose" == "x1" ]; then echo $1; fi +} +function mkdir_p { + dir=''; + echo $1 | sed -e 's/\//\n/g' | while read d; do + dir="$dir$d/" + if [ ! -d "$dir" ]; then + echo_verbose "mkdir \"$dir\"" + mkdir "$dir" + fi + done; +} + +longopts=' + -lcss-file: + -lchunk-depth: + -lextension: + -lno-figures + -loutput: + -ladmon-graphics-path: + -ladmon-graphics-size: + -ladmon-graphics-extension: + -lclasssynopsis-language: + -lfuncsynopsis-style: + -lverbose + -lversion + -lhelp +' +options=`getopt -qn$progname $longopts -- c:d:e:o:nvVh "$@"` +if [ "$?" != "0" ]; then print_help 1>&2; exit 1; fi + +eval set -- "$options"; +while [ "$1" != "--" ]; do + case "$1" in + -c | --css-file) + doc_css_file="$2";; + -d | --chunk-depth) + doc_chunk_depth="$2";; + -e | --extension) + doc_extension="$2";; + -n | --no-figures) + doc_no_figures="1";; + -o | --output) + doc_output="$2";; + + --admon-graphics-path) + doc_admon_graphics_path="$2";; + --admon-graphics-size) + doc_admon_graphics_size="$2";; + --admon-graphics-extension) + doc_admon_graphics_extension="$2";; + --classsynopsis-language) + doc_classsynopsis_language="$2";; + --funcsynopsis-style) + doc_funcsynopsis_style="$2";; + + -v | --verbose) + doc_verbose=1;; + + -V | --version) + echo "$PROGRAM ($PACKAGE) $VERSION" + exit 0;; + -h | --help) + print_help + exit 0;; + --) + print_help 1>&2 + exit 1;; + esac + shift +done +shift + +if [ "$#" != "1" ]; then print_help 1>& 2; exit 1; fi; +doc_input="$1" +if [ ! -f "$doc_input" ]; then error "$doc_input: No such file"; fi +doc_indir=$( (cd $(dirname $doc_input) && pwd) ) +doc_infile=$(basename $doc_input) +if [ "x${doc_infile: -4}" == "x.xml" ]; then + doc_inbase=${doc_infile:0:$((${#doc_infile}-4))} +else + doc_inbase="$doc_infile" +fi + +if [ "x$doc_output" == "x" ]; then + doc_outdir=`pwd` + if [ "x$doc_extension" == "x" ]; then doc_extension='.xhtml'; fi + doc_outfile="${doc_inbase}${doc_extension}" +elif [ -d "$doc_output" -o "${doc_output: -1}" == "/" ]; then + mkdir_p "$doc_output" + doc_outdir=`(cd "$doc_output" && pwd)` + if [ "x$doc_extension" == "x" ]; then doc_extension='.xhtml'; fi + doc_outfile="${doc_inbase}${doc_extension}" +else + dir=`dirname "$doc_output"` + mkdir_p "$dir" + doc_outdir=`(cd "$dir" && pwd)` + doc_outfile=`basename "$doc_output"` + if [ "x$doc_extension" == "x" ]; then + doc_extension=`echo "$doc_outfile" | grep -o '\..*'` + fi; +fi; +if [ "x${doc_outfile: -${#doc_extension}}" == "x${doc_extension}" ]; then + doc_outbase="${doc_outfile:0:$((${#doc_outfile}-${#doc_extension}))}" +else + doc_outbase="${doc_outfile}" +fi + +params='--param db.chunk.chunk_top 0' +params="$params --stringparam db.chunk.basename \"$doc_outbase\"" +params="$params --stringparam db.chunk.extension \"$doc_extension\"" +if [ "x$doc_chunk_depth" != "x" ]; then + params="$params --param db.chunk.max_depth $doc_chunk_depth" +fi +if [ "x$doc_css_file" != "x" ]; then + params="$params --stringparam db2html.css.file \"$doc_css_file\"" +fi +if [ "x$doc_admon_graphics_path" != "x" ]; then + params="$params --stringparam db2html.admon.graphics_path" + params="$params \"$doc_admon_graphics_path\"" +fi +if [ "x$doc_admon_graphics_size" != "x" ]; then + params="$params --stringparam db2html.admon.graphics_size" + params="$params \"$doc_admon_graphics_size\"" +fi +if [ "x$doc_admon_graphics_extension" != "x" ]; then + params="$params --stringparam db2html.admon.graphics_extension" + params="$params \"$doc_admon_graphics_extension\"" +fi +if [ "x$doc_classsynopsis_language" != "x" ]; then + params="$params --stringparam db2html.classsynopsis.language" + params="$params \"$doc_classsynopsis_language\"" +fi +if [ "x$doc_funcsynopsis_style" != "x" ]; then + params="$params --stringparam db2html.funcsynopsis.style" + params="$params \"$doc_funcsynopsis_style\"" +fi + +cmd="xmllint --noent --xinclude \"$doc_indir/$doc_infile\" |\ + xsltproc $params -o \"$doc_outdir/$doc_outfile\" \"$xsltdir/docbook/html/db2html.xsl\" -" +echo_verbose "$cmd" +eval "$cmd" + +if [ "x$doc_no_figures" != "x1" -a "$doc_indir" != "$doc_outdir" ]; then + xmllint --noent --xinclude "$doc_indir/$doc_infile" \ + | xsltproc "$xsltdir/docbook/utils/figures.xsl" - \ + | while read fig; do + mkdir_p "$doc_outdir/"`dirname "$fig"` + cmd="cp \"$doc_indir/$fig\" \"$doc_outdir/$fig\"" + echo_verbose "$cmd" + eval "$cmd" + done +fi diff --git a/tools/gnome-doc-prepare.in b/tools/gnome-doc-prepare.in new file mode 100644 index 0000000..0777178 --- /dev/null +++ b/tools/gnome-doc-prepare.in @@ -0,0 +1,350 @@ +#! /bin/sh +# gnome-doc-prepare - Prepare a package to use gnome-doc-utils. +# @configure_input@ +# Copyright (C) 1996-1999 Free Software Foundation, Inc. +# Copyright (C) 2001 Eazel, Inc. +# Copyright (C) 2004 Danilo Segan <danilo@gnome.org>. +# +# Originally based on libtoolize by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996 +# +# Modified for xml-i18n-tools by Maciej Stachowiak <mjs@noisehavoc.org> +# +# Modified for gnome-doc-utils by Danilo Ĺ egan <danilo@gnome.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 2 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, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# The name of this program. +progname=`echo "$0" | sed 's%^.*/%%'` + +# Constants. +PROGRAM=gnome-doc-prepare +PACKAGE=@PACKAGE@ +VERSION=@VERSION@ + +# Directory names. +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +pkgdatadir=@datadir@/gnome-doc-utils + +# FIXME: I want this through pkg-config +gdu_m4="${datadir}/aclocal/gnome-doc-utils.m4" +gdu_make="${pkgdatadir}/gnome-doc-utils.make" +omf_template="${pkgdatadir}/template.omf.in" +xml_template="${pkgdatadir}/template-document.xml" +makefile_template="${pkgdatadir}/template.make" + +dry_run=no +help="Try '$progname --help' for more information." +rm="rm -f" +rm_rec="rm -rf" +ln_s="ln -s" +cp="cp -f" +mkdir="mkdir" +sed="sed" +mkinstalldirs="mkinstalldirs" + +# Global variables. +automake= +copy= +force= +status=0 + +for arg +do + case "$arg" in + --help) + cat <<EOF +Usage: $progname [OPTION]... + +Prepare a package to use gnome-doc-utils. + + --automake work silently, and assume that Automake is in use +-c, --copy copy files rather than symlinking them + --new-document DOCUMENT + initialize help/DOCUMENT/* + --debug enable verbose shell tracing +-n, --dry-run print commands rather than running them +-f, --force replace existing files + --help display this message and exit + --version print version information and exit + +You must 'cd' to the top directory of your package before you run +'$progname'. +EOF + exit 0 + ;; + + --version) + echo "$PROGRAM (GNU $PACKAGE) $VERSION" + exit 0 + ;; + + --automake) + automake=yes + ;; + + --new-document) + shift + docname=yes + ;; + + -c | --copy) + ln_s= + ;; + + --debug) + echo "$progname: enabling shell trace mode" + set -x + ;; + + -n | --dry-run) + if test "$dry_run" != yes; then + dry_run=yes + rm="echo $rm" + rm_rec="echo $rm_rec" + test -n "$ln_s" && ln_s="echo $ln_s" + cp="echo $cp" + mkdir="echo mkdir" + mkinstalldirs="echo $mkinstalldirs" + sed="echo $sed" + fi + ;; + + -f | --force) + force=yes + ;; + + -*) + echo "$progname: unrecognized option '$arg'" 1>&2 + echo "$help" 1>&2 + exit 1 + ;; + + *) + if [ "x$docname" = "xyes" ] + then + newdocument="$arg" + docname=no + else + echo "$progname: too many arguments" 1>&2 + echo "$help" 1>&2 + exit 1 + fi + ;; + esac +done + +if test -f configure.ac; then + configure="configure.ac" +else + if test -f configure.in; then + configure="configure.in" + else + echo "$progname: neither 'configure.ac' nor 'configure.in' exists" 1>&2 + echo "$help" 1>&2 + exit 1 + fi +fi + + +files='gnome-doc-utils.make' + +auxdir=. +auxdirline=`egrep '^AC_CONFIG_AUX_DIR' $configure 2>/dev/null` +if test -n "$auxdirline"; then + # Handle explicit AC_CONFIG_AUX_DIR settings. + auxdir=`echo "$auxdirline" | sed 's/^AC_CONFIG_AUX_DIR(\([^)]*\)).*$/\1/'` + + if test "$auxdir" = "$auxdirline"; then + echo "$progname: invalid AC_CONFIG_AUX_DIR syntax: $auxdirline" 1>&2 + exit 1 + else + # Strip any quote brackets. + auxdir=`echo "$auxdir" | sed 's/^\[\(.*\)\]$/\1/g'` + case "$auxdir" in + *\$*) + echo "$progname: cannot handle variables in AC_CONFIG_AUX_DIR" 1>&2 + exit 1 + ;; + *) + ;; + esac + fi +else + # Try to discover auxdir the same way it is discovered by configure. + # Note that we default to the current directory. + for dir in . .. ../..; do + if test -f $dir/install-sh; then + auxdir=$dir + break + elif test -f $dir/install.sh; then + auxdir=$dir + break + fi + done +fi + +if test -z "$automake"; then + if egrep '^GNOME_DOC_INIT' $configure >/dev/null 2>&1; then : + else + echo "Remember to add 'GNOME_DOC_INIT' to $configure." + fi + + if grep 'generated automatically by aclocal' aclocal.m4 >/dev/null 2>&1; then + updatemsg="update your 'aclocal.m4' by running aclocal" + else + updatemsg="add the contents of '$gdu_m4' to 'aclocal.m4'" + fi + + if egrep '^AC_DEFUN\(GNOME_DOC_INIT' aclocal.m4 >/dev/null 2>&1; then + # Check the version number on gnome-doc-utils.m4 and the one used in aclocal.m4. + instserial=`grep '^# serial ' $gdu_m4 | grep 'GNOME_DOC_INIT' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` + + if test -z "$instserial"; then + echo "$progname: warning: no serial number on '$gdu_m4'" 1>&2 + else + # If the local macro has no serial number, we assume it's ancient. + localserial=`grep '^# serial ' aclocal.m4 | grep 'GNOME_DOC_INIT' | sed -e 's/^# serial \([0-9][0-9]*\).*$/\1/; q'` + + test -z "$localserial" && localserial=0 + + if test "$localserial" -lt "$instserial"; then + echo "You should $updatemsg." + elif test "$localserial" -gt "$instserial"; then + echo "$progname: '$gdu_m4' is serial $instserial, less than $localserial in 'aclocal.m4'" 1>&2 + if test -z "$force"; then + echo "Use '--force' to replace newer gnome-doc-utils files with this version." 1>&2 + exit 1 + fi + echo "To remain compatible, you should $updatemsg." + fi + fi + else + echo "You should $updatemsg." + fi +fi + + + +# Change to the auxiliary directory. +( +cur=`pwd` +if test "$auxdir" != .; then + test -z "$automake" && echo "Putting files in AC_CONFIG_AUX_DIR, '$auxdir'." + cd $auxdir || exit 1 +fi + +for file in $files; do + if test -f "$file" && test -z "$force"; then + test -z "$automake" && echo "$progname: '$file' exists: use '--force' to overwrite" 1>&2 + continue + fi + + $rm $file + if test -n "$ln_s" && $ln_s $pkgdatadir/`basename $file` $file; then : + elif $cp $pkgdatadir/`basename $file` $file; then : + else + echo "$progname: cannot copy '$pkgdatadir/`basename $file`' to '$file'" 1>&2 + status=1 + fi +done + +exit $status +# make sure this subshell exits with the exit value if it failed +) || exit $? + +# Adapted from gtkdocize: +# If the AC_CONFIG_MACRO_DIR() macro is used, copy gnome-doc-utils.m4 +# from our prefix to that directory. This makes sure that the M4 macro +# used matches the automake fragment. +# If AC_CONFIG_MACRO_DIR is not used, the macro won't be copied, and +# the correct flags must be passed to aclocal for it to find the macro. +m4dir=`cat "$configure" | grep '^AC_CONFIG_MACRO_DIR' | sed -n -e 's/AC_CONFIG_MACRO_DIR(\([^()]*\))/\1/p' | sed -e 's/^\[\(.*\)\]$/\1/' | sed -e 1q` + +if test -n "$m4dir"; then +( +cur=`pwd` +if test "$m4dir" != .; then + test -z "$automake" && echo "Putting files in AC_CONFIG_MACRO_DIR, '$m4dir'." + cd $m4dir || exit 1 +fi + +files='gnome-doc-utils.m4' + +for file in $files; do + if test -f "$file" && test -z "$force"; then + test -z "$automake" && echo "$progname: '$file' exists: use '--force' to overwrite" 1>&2 + continue + fi + + $rm $file + if test -n "$ln_s" && $ln_s $datadir/aclocal/$file $file; then : + elif $cp $datadir/aclocal/$file $file; then : + else + echo "$progname: cannot copy '$datadir/aclocal/$file' to '$file'" 1>&2 + status=1 + fi +done + +exit $status +# make sure this subshell exits with the exit value if it failed +) || exit $? +fi + + +# FIXME: This probably does not work w/ builddir != srcdir because it +# gets at source files relative to the current directory. + + +if [ "x$newdocument" != "x" ] +then + MYDATE="`date -I`" + MYYEAR="`date +%Y`" + MYUSERNAME="`whoami`" + MYDOMAIN="`hostname -d`" + MYSERIESID="`scrollkeeper-gen-seriesid`" + MYDOCUMENT="$newdocument" + + ( # FIXME: check if any of these already exist, and overwrite only if $force + mkdir -p "help/$newdocument/C" && \ + sed \ + -e 's/@DATE@/$MYDATE/g' \ + -e 's/@YEAR@/$MYYEAR/g' \ + -e 's/@USERNAME@/$MYUSERNAME/g' \ + -e 's/@DOMAIN@/$MYDOMAIN/g' \ + -e 's/@DOCUMENT@/$MYDOCUMENT/g' \ + < $xml_template > "help/$newdocument/C/$newdocument.xml" && \ + $sed \ + -e 's/@DATE@/$MYDATE/g' \ + -e 's/@SERIESID@/$MYSERIESID/g' \ + < $omf_template > "help/$newdocument/$newdocument.omf.in" && \ + sed \ + -e 's/@DOCUMENT@/$MYDOCUMENT/g' \ + < $makefile_template > "help/$newdocument/Makefile.am" + ) +fi + +exit $status + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: diff --git a/tools/gnome-doc-utils.pc.in b/tools/gnome-doc-utils.pc.in new file mode 100644 index 0000000..37ac592 --- /dev/null +++ b/tools/gnome-doc-utils.pc.in @@ -0,0 +1,14 @@ +prefix=@prefix@ +datarootdir=@datarootdir@ +datadir=@datadir@ +xmldir=${datadir}/xml +xsltdir=${xmldir}/gnome/xslt +gettext=${xsltdir}/common/gettext.xsl +db2html=${xsltdir}/docbook/html/db2html.xsl +db2omf=${xsltdir}/docbook/omf/db2omf.xsl +rngdoc=${xsltdir}/rngdoc/rngdoc.xsl +xsldoc=${xsltdir}/xsldoc/xsldoc.xsl + +Name: gnome-doc-utils +Description: GNOME Documentation Utilities +Version: @VERSION@ |