# -*- python -*-
-
-# Some internal information on how the documentation is generated. All
-# this is quite a mess, the complete documentation generation setup is
-# in dire need of a complete redesign, but ...
-#
#
# The documentation generation process is tightly integrated with the
# scons build framework:
# dependencies. This happens in the doxygen builder in
# senfscons/Doxygen.py.
#
-# * possibly the doclib/doxy-header.html and/or
-# doclib/doxy-footer.html files are regenerated
+# * 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.
#
-# * When building the complete documentation ('all_docs'), the
-# cross-reference page will be rebuilt if necessary (The global list
-# of 'Open Issues').
-#
-# * To fix some link errors, the additional 'linlint' and 'fixlinks'
+# * To fix some link errors, the additional 'linklint' and 'fixlinks'
# targets are used
#
#
# 2. Regenerating header and/or footer
#
# If needed, the doxy-header.html and/or doxy-footer.html file will be
-# regenerated. The dependencies are *not* complete, just adding a new
-# subdirectory sadly does not automatically update the header (which
-# contains the menu)
-#
-# The header and/or footer are written are generated from templates
+# regenerated. The header and/or footer are generated from templates
# using a simple python based templating system called yaptu which is
-# included in doclib/.
+# included in site_scons/lib/.
#
#
# 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 tree
-# parts
+# 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
-#
-# * Additional processing added by the SENFSCons.Doxygen helper.
+# * The processing done by the Doxygen builder and
+# site_scon/lib/doxygen.sh
#
#
# 3.1. Building prerequisites
#
# 3.2. The main doxygen build (Doxygen builder)
#
-# * doxygen proper is called
-#
-# * doxygen is configured in Doxyfile.global to call
-# 'doclib/filter.pl' on each source file. This filter will strip
-# excess whitespace from the beginning of lines in '\code' and
-# '<pre>' blocks. Additionally it will expand all tabs, tab width is
-# 8 spaces (there should be no tabs in the source but ...)
-#
-# * doxygen is configured in Doxyfile.global to call 'doclib/dot' to
-# generate the 'dot' images.
+# The Doxygen builder will call the doxygen command to build the
+# documentation.
#
-# * '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.
-#
-# * after doxygen is finished, the list of referenced tag-files is
-# checked. For each tag file the directory is found, where the
-# documentation is generated (by scanning the Doxyfile which is
-# repsonsible for building the tag file). For every tag file, the
-# correct 'installdox' command is generated.
+# The doxygen command is configured as 'site_scon/lib/doxygen.sh' which
+# does some additional processing in addition to calling doxygen
+# proper
#
-# * The stamp files are created
+# * 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.
#
-# 3.3. Postprocessing
+# * the HTML documentation is post-processed using some sed, tidy, and
+# an XSLT template
#
-# The following steps are mostly added to work around some stupid
-# doxygen problems
+# * a generated tag file is post-processed using an XSLT template
#
-# * If a tag file is generated, 'senfscons/tagmunge.xsl' is called on the
-# tag file. This XSLT stylesheet removes all namespace components
-# from the tag file. Without this task, doxygen will completely barf
-# when two different documentation parts have members in the same
-# namespace.
+# (see site_scon/lib/doxygen.sh for more information). The Doxygen
+# configuration is set up such, that
#
-# * All html files are processed by 'doclib/html-munge.xsl'. However,
-# since the documentation generated by doxygen is completely invalid
-# html we need to preprocess the html files with a simple 'sed'
-# script and 'tidy' before 'xsltproc' even accepts the html code.
+# * doxygen calls 'site_scons/lib/filter.pl' on each source file. This
+# filter will strip excess whitespace from the beginning of lines in
+# '\code' and '<pre>' blocks. Additionally it will expand all tabs,
+# tab width is 8 spaces (there should be no tabs in the source but
+# ...)
#
-# * We use the generated xml output of doxygen to generate an XML
-# fragment for the global cross reference. This fragment is
-# generated by 'senfscons/xrefxtract.xslt'
+# * 'site_scons/lib/filter.pl' calls 'site_scons/lib/makeDiaImageMap.py'
+# whenever finding a '\diaimage' command. This will create an image
+# map (in an encoded form which will be fixed by html-munge.xsl
+# later)
#
+# * doxygen calls 'site_scons/lib/dot' to generate the 'dot' images.
#
-# 4. Building the global cross-reference
+# * 'site_scons/lib/dot' calls 'site_scons/lib/dot-munge.pl' on the
+# .dot files. dot-munge.pl changes the font and font-size and adds
+# line-breaks to long labels
#
-# The global cross reference is built from the cross-refernce
-# fragments generated for each of the documentation parts and from the
-# doxy-header.html/doxy-footer.html files. This conversion is
-# controlled by the 'senfscons/xrefhtml.xslt' stylesheet.
+# * 'site_scons/lib/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.
#
#
-# 5. Fixing broken links
+# 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
Import('env')
-import SENFSCons
+import SENFSCons, datetime, os
###########################################################################
# Naja ... etwas rumgehackt aber was solls ...
global EXTRA_MODULES
mods = {}
- pathbase = len(env.Dir('#').abspath)+1
+ pathbase = env.Dir('#/senf').abspath
+ pathbasel = len(pathbase)+1
for module in env.Alias('all_docs')[0].sources:
if module.name != 'html.stamp' : continue
- mods[module.dir.dir.dir.abspath] = [ module.dir.dir.dir.name,
- module.dir.abspath[pathbase:],
+ if not module.dir.dir.dir.abspath.startswith(pathbase): continue
+ mods[module.dir.dir.dir.abspath] = [ module.dir.dir.dir.abspath[pathbasel:].replace('/','_'),
+ module.dir.dir.dir.name,
+ module.dir.abspath[pathbasel:],
0 ]
rv = []
for mod in keys:
i = 0
while i < len(rv):
- if len(rv[i]) > pathbase and mod.startswith(rv[i] + '/'):
- level = mods[rv[i]][2] + 1
+ if len(rv[i]) > pathbasel and mod.startswith(rv[i] + '/'):
+ level = mods[rv[i]][-1] + 1
i += 1
while i < len(rv) and mods[rv[i]][2] >= level:
i += 1
rv[i:i] = [ mod ]
- mods[mod][2] = level
+ mods[mod][-1] = level
break
i += 1
if i == len(rv):
rv.append(mod)
- for mod in keys:
- if mods[mod][2] == 0:
- mods[mod][0] = 'lib' + mods[mod][0]
-
- n = 0
- for name,path in EXTRA_MODULES:
- path = env.Dir(path).dir.dir.abspath
- i = 0
- while i < len(rv):
- if rv[i] == path:
- mods[rv[i]][0] = name
- m = 1
- while i+m < len(rv) and mods[rv[i+m]][2] > mods[rv[i]][2]:
- m += 1
- rv[n:n] = rv[i:i+m]
- rv[i+m:i+2*m] = []
- i += m
- n += m
- else:
- i += 1
-
return ( tuple(mods[mod]) for mod in rv )
def indices():
if doc.name == "search.idx" ]
def writeTemplate(target = None, source = None, env = None):
- file(target[0].abspath,"w").write(source[0].read())
+ 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' ])
###########################################################################
-# Extra documentation modules which are handled (named) different from
-# library modules
-EXTRA_MODULES = [
- ('Overview', '#/doc/html'),
- ('Examples', '#/Examples/doc/html'),
- ('HowTos', '#/HowTos/doc/html'),
- ('SENFSCons', '#/senfscons/doc/html') ]
-
HEADER = """<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<div id="subtitle">
<ul>
<li><a href="@TOPDIR@/doc/html/index.html">Home</a></li>
- <li><a class="ext" href="ftp://ftp.berlios.de/pub/senf/">Download</a></li>
+ <li><a class="ext" href="http://satext.fokus.fraunhofer.de/senf/debian">Download</a></li>
<li><a class="ext" href="http://openfacts2.berlios.de/wikien/index.php/BerliosProject:SENF_Network_Framework">Wiki</a></li>
<li><a class="ext" href="http://developer.berlios.de/projects/senf">BerliOS</a></li>
<li><a class="ext" href="http://svn.berlios.de/wsvn/senf/?op=log&rev=0&sc=0&isdir=1">ChangeLog</a></li>
<li><a class="ext" href="http://svn.berlios.de/viewcvs/senf/trunk/">Browse SVN</a></li>
<li><a class="ext" href="http://developer.berlios.de/bugs/?group_id=7489">Bug Tracker</a></li>
- <li><a href="@TOPDIR@/doc/html/xref.html">Open Issues</a></li>
</ul>
</div>
</div>
<div id="content1">
<div id="content2">
<div class="tabs menu">
+ <li class="Overview level0"><a href="@TOPDIR@/doc/html/index.html">Overview</a></li>
+ <li class="Examples level0"><a href="@TOPDIR@/Examples/doc/html/index.html">Examples</a></li>
+ <li class="HowTos level0"><a href="@TOPDIR@/HowTos/doc/html/index.html">HowTos</a></li>
+ <li class="glossary level0"><a href="@TOPDIR@/doc/html/glossary.html">Glossary</a></li>
+ </div>
+ <div class="tabs menu">
<ul>
-{{ for name, path, level in modules():
- <li class="${name} level${level}"><a href="@TOPDIR@/${path}/index.html">${name}</a></li>
+{{ for id, name, path, level in modules():
+ <li class="${id} level${level}"><a href="@TOPDIR@/senf/${path}/index.html">${name}</a></li>
}}
- <li class="glossary level0"><a href="@TOPDIR@/doc/html/glossary.html">Glossary</a></li>
</ul>
</div>"""
}
?>"""
-header = yaptu.process(HEADER, globals(), env.Dictionary(),
- TITLE = "Documentation and API reference")
+env.SetDefault(
+ DOXYGEN = "doxygen"
+)
+
+env.Append( ENV = {
+ 'TODAY' : str(datetime.date.today()),
+ 'DOXYGEN' : str(env.File(env['DOXYGEN'])),
+})
-footer = yaptu.process(FOOTER, globals(), env.Dictionary())
+env.PhonyTarget('linklint', [], [
+ 'rm -rf doc/linklint',
+ 'linklint -doc doc/linklint -limit 99999999 `find -type d -name html -printf "/%P/@ "`',
+ '[ ! -r doc/linklint/errorX.html ] || python doclib/linklint_addnames.py <doc/linklint/errorX.html >doc/linklint/errorX.html.new',
+ '[ ! -r doc/linklint/errorX.html.new ] || mv doc/linklint/errorX.html.new doc/linklint/errorX.html',
+ '[ ! -r doc/linklint/errorAX.html ] || python doclib/linklint_addnames.py <doc/linklint/errorAX.html >doc/linklint/errorAX.html.new',
+ '[ ! -r doc/linklint/errorAX.html.new ] || mv doc/linklint/errorAX.html.new doc/linklint/errorAX.html',
+])
-search_php = yaptu.process(HEADER + SEARCH_PHP.replace('<?','[[').replace('?>',']]') + FOOTER,
- globals(), env.Dictionary(),
- TITLE = "Search results")
+env.PhonyTarget('fixlinks', [], [
+ 'python doclib/fix-links.py -v -s .svn -s linklint -s debian doc/linklint/errorX.txt doc/linklint/errorAX.txt',
+])
-search_paths_php = yaptu.process(SEARCH_PATHS_PHP, globals(), env.Dictionary())
+header = env.Command('doxy-header.html', 'SConscript', writeTemplate,
+ TEMPLATE = Literal(HEADER),
+ TITLE = "Documentation and API reference")
+env.Depends(header, env.Value(repr(list(modules()))))
-env.Command('doxy-header.html', Value(header), writeTemplate)
-env.Command('doxy-footer.html', Value(footer), writeTemplate)
+footer = env.Command('doxy-footer.html', 'SConscript', writeTemplate,
+ TEMPLATE = Literal(FOOTER))
env.Alias('all_docs',
- env.Command('search.php', [ Value(search_php), 'html-munge.xsl' ],
+ env.Command('search.php', [ '#/site_scons/lib/html-munge.xsl', 'SConscript' ],
[ writeTemplate,
- 'xsltproc --nonet --html --stringparam topdir .. -o - ${SOURCES[1]} $TARGET 2>/dev/null'
+ 'xsltproc --nonet --html --stringparam topdir .. -o - $SOURCE $TARGET 2>/dev/null'
+ "| sed"
+ r" -e 's/\[\[/<?/g' -e 's/\]\]/?>/g'"
+ r" -e 's/\$$projectname/Overview/g'"
+ r" -e 's/\$$title/Search results/g'"
+ "> ${TARGETS[0]}.tmp",
- 'mv ${TARGET}.tmp ${TARGET}' ] ))
-
+ 'mv ${TARGET}.tmp ${TARGET}' ],
+ TEMPLATE = Literal(HEADER
+ + SEARCH_PHP.replace('<?','[[').replace('?>',']]')
+ + FOOTER),
+ TITLE = "Search results"))
env.Alias('all_docs',
- env.Command('search_paths.php', Value(search_paths_php), writeTemplate))
+ env.Command('search_paths.php', 'SConscript', writeTemplate,
+ TEMPLATE = Literal(SEARCH_PATHS_PHP)))
env.Alias('install_all',
env.Install( '$DOCINSTALLDIR/doclib', [ 'favicon.ico',
env.Clean('all', 'doxy-header.html') # I should not need this but I do ...
env.Clean('all_docs', 'doxy-header.html') # I should not need this but I do ...
+
+env.Install('${DOCINSTALLDIR}', 'index.html')
+
+env.Depends(SENFSCons.Doxygen(env, output_directory="../doc"), env.Value(env['ENV']['REVISION']))