X-Git-Url: http://g0dil.de/git?a=blobdiff_plain;f=doclib%2FSConscript;h=696fc27891d0b361ef33e85ac323fc51b64aa09d;hb=87204d50de0c429f265aec817bc9efd9af816082;hp=a9d17ec3158934fe2068f010f4535d3bf89718cd;hpb=0990bd1c4f917855f3645e7329a84b00e54ccd7d;p=senf.git diff --git a/doclib/SConscript b/doclib/SConscript index a9d17ec..696fc27 100644 --- a/doclib/SConscript +++ b/doclib/SConscript @@ -1,7 +1,123 @@ # -*- python -*- +# +# The documentation generation process is tightly integrated with the +# scons build framework: +# +# * SCons analyzes the Doxyfile's to find all the documentation +# dependencies. This happens in the doxygen builder in +# senfscons/Doxygen.py. +# +# * the doclib/doxy-header.html and/or doclib/doxy-footer.html files +# are regenerated +# +# * If any documentation is out-of-date with respect to it's source +# files, the documentation is regenerated. +# +# * To fix some link errors, the additional 'linklint' and 'fixlinks' +# targets are used +# +# +# 1. Scanning the Doxyfile's +# +# The doxygen builder scans all documentation source files which have +# the text 'doxyfile' in any case in their name. It understands +# @INCLUDE directives and will find all the dependencies of the +# documentation: +# +# * All the source files as selected by INPUT, INPUT_PATTERN, +# RECURSIVE and so on. +# +# * Any referenced tag-files +# +# * Documentation header and/or footer +# +# * The INPUT_FILTER program +# +# * Any included doxygen configuration files +# +# +# 2. Regenerating header and/or footer +# +# If needed, the doxy-header.html and/or doxy-footer.html file will be +# regenerated. The header and/or footer are generated from templates +# using a simple python based templating system called yaptu which is +# included in doclib/. +# +# +# 3. Calling doxygen +# +# The doxygen call itself is quite complex since there is some pre- +# and post-processing going on. We can separate this step into two +# steps +# +# * Building prerequisites (e.g. images) +# +# * The processing done by the Doxygen builder and doclib/doxygen.sh +# +# +# 3.1. Building prerequisites +# +# The prerequisites are images referenced by the documentation. These +# images are mostly generated using the Dia2Png builder. +# +# +# 3.2. The main doxygen build (Doxygen builder) +# +# The Doxygen builder will call the doxygen command to build the +# documentation. +# +# The doxygen command is configured as 'doclib/doxygen.sh' which +# does some additional processing in addition to calling doxygen +# proper +# +# * it sets environment variables depending on command line arguments. +# These variables are then used in the Doxyfile's +# +# * after doxygen is finished, 'installdox' is called to resolve +# tag file references. +# +# * the HTML documentation is post-processed using some sed, tidy, and +# an XSLT template +# +# * a generated tag file is post-processed using an XSLT template +# +# (see doclib/doxygen.sh for more information). The Doxygen +# configuration is set up such, that +# +# * doxygen calls 'doclib/filter.pl' on each source file. This filter +# will strip excess whitespace from the beginning of lines in +# '\code' and '
' blocks. Additionally it will expand all tabs,
+#   tab width is 8 spaces (there should be no tabs in the source but
+#   ...)
+# 
+# * doxygen calls 'doclib/dot' to generate the 'dot' images.
+#
+# * 'doclib/dot' calls 'doclib/dot-munge.pl' on the .dot
+#    files. dot-munge.pl changes the font and font-size and adds
+#    line-breaks to long labels
+#
+# * 'doclib/dot' calls the real dot binary. If the resulting image is
+#   more than 800 pixels wide, dot is called again, this time using
+#   the oposite rank direction (top-bottom vs. left-right). The image
+#   with the smaller width is selected and returned.
+#
+#
+# 4. Fixing broken links
+#
+# After the documentation has been generated, additional calls first
+# to the 'linklint' and then to the 'fixlinks' target will try to fix
+# broken links generated by doxygen. First, 'linklint' will call the
+# linklint tool to check for broken links in the documentation.
+#
+# 'fixlinks' is then called which calls 'doclib/fixlinks.py' which
+# scans *all* html files, builds an index of all (unique) anchors and
+# then fixes the url part of all links with correct anchor but bad
+# file name.
+#
+
 
 Import('env')
-import SENFSCons
+import SENFSCons, datetime, os
 
 ###########################################################################
 
@@ -66,7 +182,10 @@ def indices():
              if doc.name == "search.idx" ]
 
 def writeTemplate(target = None, source = None, env = None):
-    file(target[0].abspath,"w").write(yaptu.process(str(env['TEMPLATE']), globals(), env.Dictionary()))
+    file(target[0].abspath,"w").write(processTemplate(env))
+
+def processTemplate(env):
+    return yaptu.process(str(env['TEMPLATE']), globals(), env.Dictionary())
 
 writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ])
 
@@ -77,7 +196,7 @@ writeTemplate = env.Action(writeTemplate, varlist = [ 'TEMPLATE' ])
 EXTRA_MODULES = [
     ('Overview', '#/doc/html'),
     ('Examples', '#/Examples/doc/html'),
-    ('HowTo\'s', '#/HowTos/doc/html'),
+    ('HowTos', '#/HowTos/doc/html'),
     ('SENFSCons', '#/senfscons/doc/html') ]
 
 HEADER = """
@@ -106,15 +225,14 @@ div.tabs li.$projectname a { background-color: #EDE497; }
   
   
-

${TITLE}

@@ -154,11 +272,42 @@ function paths() { } ?>""" -env.Command('doxy-header.html', 'SConscript', writeTemplate, - TEMPLATE = Literal(HEADER), - TITLE = "Documentation and API reference") -env.Command('doxy-footer.html', 'SConscript', writeTemplate, - TEMPLATE = Literal(FOOTER)) +env.Append( ENV = { + 'TODAY' : str(datetime.date.today()), + 'TEXINPUTS' : os.environ.get('TEXINPUTS',env.Dir('#/doclib').abspath + ':'), + 'DOXYGEN' : env.get('DOXYGEN', 'doxygen'), +}) + +env.Replace( + ALL_TAGFILES = [], + DOXYGENCOM = "doclib/doxygen.sh $DOXYOPTS $SOURCE", +) + +SENFSCons.PhonyTarget(env, 'linklint', [ + 'rm -rf linklint', + 'linklint -doc linklint -limit 99999999 `find -type d -name html -printf "/%P/@ "`', + '[ ! -r linklint/errorX.html ] || python doclib/linklint_addnames.py linklint/errorX.html.new', + '[ ! -r linklint/errorX.html.new ] || mv linklint/errorX.html.new linklint/errorX.html', + '[ ! -r linklint/errorAX.html ] || python doclib/linklint_addnames.py linklint/errorAX.html.new', + '[ ! -r linklint/errorAX.html.new ] || mv linklint/errorAX.html.new linklint/errorAX.html', + 'echo -e "\\nLokal link check results: linklint/index.html\\nRemote link check results: linklint/urlindex.html\\n"', +]) + +env.Clean('all', env.Dir('linklint')) + +SENFSCons.PhonyTarget(env, 'fixlinks', [ + 'python doclib/fix-links.py -v -s .svn -s linklint -s debian linklint/errorX.txt linklint/errorAX.txt', +]) + + +header = env.Command('doxy-header.html', 'SConscript', writeTemplate, + TEMPLATE = Literal(HEADER), + TITLE = "Documentation and API reference") +env.Depends(header, env.Value(repr(list(modules())))) + +footer = env.Command('doxy-footer.html', 'SConscript', writeTemplate, + TEMPLATE = Literal(FOOTER)) + env.Alias('all_docs', env.Command('search.php', [ 'html-munge.xsl', 'SConscript' ], [ writeTemplate,